Skip to content

Commit c817d00

Browse files
committed
updates examples
1 parent 3fb4643 commit c817d00

File tree

30 files changed

+1459
-125
lines changed

30 files changed

+1459
-125
lines changed

CHANGELOG.md

+5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
## Changelog
22

3+
### 0.19.0
4+
5+
- Fixes compatibility with React Native 0.27.2
6+
- Adds `contentContainerStyle` prop to style scroll container (thanks @alaycock)
7+
38
### 0.18.1
49

510
- Fixes error when inspecting the sticky header due to cyclical object structure

README.md

+7-6
Original file line numberDiff line numberDiff line change
@@ -80,10 +80,15 @@ The `ParallaxScrollView` component adds a few additional properties, as describe
8080
| `renderScrollComponent` | `func` | No | A function with input `props` and outputs a `ScrollView`-like component in which the content is rendered. This is useful if you want to provide your own scrollable component. (See: [https://github.com/exponentjs/react-native-scrollable-mixin](https://github.com/exponentjs/react-native-scrollable-mixin)) (By default, returns a `ScrollView` with the given props) |
8181
| `renderStickyHeader` | `func` | No | This renders an optional sticky header that will stick to the top of view when parallax header scrolls up. |
8282
| `stickyHeaderHeight` | `number` | If `renderStickyHeader` is used | If `renderStickyHeader` is set, then its height must be specified. |
83-
83+
| `contentContainerStyle` | `object` | No | These styles will be applied to the scroll view content container which wraps all of the child views. (same as for [ScrollView](https://facebook.github.io/react-native/docs/scrollview.html#contentcontainerstyle)) |
8484

8585
## Latest changes
8686

87+
### 0.19.0
88+
89+
- Fixes compatibility with React Native 0.27.2
90+
- Adds `contentContainerStyle` prop to style scroll container (thanks @alaycock)
91+
8792
### 0.18.1
8893

8994
- Fixes error when inspecting the sticky header due to cyclical object structure
@@ -94,11 +99,7 @@ The `ParallaxScrollView` component adds a few additional properties, as describe
9499
- **Breaking:** Removes `ParallaxScrollView#scrollWithoutAnimationTo` since this has been deprecated in React Native. If you used this method previously, use `scrollTo` instead.
95100
- Adds `ParallaxScrollView#getScrollableNode` method, which is required in React Native 0.20.0 for components implementing
96101
`ScrollView` interface.
97-
98-
### 0.17.4
99-
100-
- The background now fades out in the same manner as the foreground. Thanks @generalChaos for the PR.
101-
102+
102103
See full changelog [here](./CHANGELOG.md).
103104

104105
## Contributing

examples/ListView/.buckconfig

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
2+
[android]
3+
target = Google Inc.:Google APIs:23
4+
5+
[maven_repositories]
6+
central = https://repo1.maven.org/maven2

examples/ListView/.flowconfig

+49-15
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,19 @@
1414

1515
# Ignore react and fbjs where there are overlaps, but don't ignore
1616
# anything that react-native relies on
17-
.*/node_modules/fbjs-haste/.*/__tests__/.*
18-
.*/node_modules/fbjs-haste/__forks__/Map.js
19-
.*/node_modules/fbjs-haste/__forks__/Promise.js
20-
.*/node_modules/fbjs-haste/__forks__/fetch.js
21-
.*/node_modules/fbjs-haste/core/ExecutionEnvironment.js
22-
.*/node_modules/fbjs-haste/core/isEmpty.js
23-
.*/node_modules/fbjs-haste/crypto/crc32.js
24-
.*/node_modules/fbjs-haste/stubs/ErrorUtils.js
25-
.*/node_modules/react-haste/React.js
26-
.*/node_modules/react-haste/renderers/dom/ReactDOM.js
27-
.*/node_modules/react-haste/renderers/shared/event/eventPlugins/ResponderEventPlugin.js
17+
.*/node_modules/fbjs/lib/Map.js
18+
.*/node_modules/fbjs/lib/ErrorUtils.js
19+
20+
# Flow has a built-in definition for the 'react' module which we prefer to use
21+
# over the currently-untyped source
22+
.*/node_modules/react/react.js
23+
.*/node_modules/react/lib/React.js
24+
.*/node_modules/react/lib/ReactDOM.js
25+
26+
.*/__mocks__/.*
27+
.*/__tests__/.*
28+
29+
.*/commoner/test/source/widget/share.js
2830

2931
# Ignore commoner tests
3032
.*/node_modules/commoner/test/.*
@@ -38,26 +40,58 @@
3840
# Ignore Website
3941
.*/website/.*
4042

43+
# Ignore generators
44+
.*/local-cli/generator.*
45+
46+
# Ignore BUCK generated folders
47+
.*\.buckd/
48+
49+
# Ignore RNPM
50+
.*/local-cli/rnpm/.*
51+
52+
.*/node_modules/is-my-json-valid/test/.*\.json
53+
.*/node_modules/iconv-lite/encodings/tables/.*\.json
54+
.*/node_modules/y18n/test/.*\.json
55+
.*/node_modules/spdx-license-ids/spdx-license-ids.json
56+
.*/node_modules/spdx-exceptions/index.json
57+
.*/node_modules/resolve/test/subdirs/node_modules/a/b/c/x.json
58+
.*/node_modules/resolve/lib/core.json
59+
.*/node_modules/jsonparse/samplejson/.*\.json
60+
.*/node_modules/json5/test/.*\.json
61+
.*/node_modules/ua-parser-js/test/.*\.json
62+
.*/node_modules/builtin-modules/builtin-modules.json
63+
.*/node_modules/binary-extensions/binary-extensions.json
64+
.*/node_modules/url-regex/tlds.json
65+
.*/node_modules/joi/.*\.json
66+
.*/node_modules/isemail/.*\.json
67+
.*/node_modules/tr46/.*\.json
68+
69+
4170
[include]
4271

4372
[libs]
4473
node_modules/react-native/Libraries/react-native/react-native-interface.js
74+
node_modules/react-native/flow
75+
flow/
4576

4677
[options]
4778
module.system=haste
4879

80+
esproposal.class_static_fields=enable
81+
esproposal.class_instance_fields=enable
82+
4983
munge_underscores=true
5084

5185
module.name_mapper='^image![a-zA-Z0-9$_-]+$' -> 'GlobalImageStub'
52-
module.name_mapper='^[./a-zA-Z0-9$_-]+\.png$' -> 'RelativeImageStub'
86+
module.name_mapper='^[./a-zA-Z0-9$_-]+\.\(bmp\|gif\|jpg\|jpeg\|png\|psd\|svg\|webp\|m4v\|mov\|mp4\|mpeg\|mpg\|webm\|aac\|aiff\|caf\|m4a\|mp3\|wav\|html\|pdf\)$' -> 'RelativeImageStub'
5387

5488
suppress_type=$FlowIssue
5589
suppress_type=$FlowFixMe
5690
suppress_type=$FixMe
5791

58-
suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(>=0\\.\\(1[0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)
59-
suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(>=0\\.\\(1[0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)? #[0-9]+
92+
suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(>=0\\.\\(2[0-5]\\|1[0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)
93+
suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(>=0\\.\\(2[0-5]\\|1[0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)?:? #[0-9]+
6094
suppress_comment=\\(.\\|\n\\)*\\$FlowFixedInNextDeploy
6195

6296
[version]
63-
0.19.0
97+
^0.25.0

examples/ListView/.gitignore

+6
Original file line numberDiff line numberDiff line change
@@ -32,3 +32,9 @@ local.properties
3232
#
3333
node_modules/
3434
npm-debug.log
35+
36+
# BUCK
37+
buck-out/
38+
\.buckd/
39+
android/app/libs
40+
android/keystores/debug.keystore

examples/ListView/Talks.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
/*
22
* This example demonstrates how to use ParallaxScrollView within a ScrollView component.
33
*/
4-
import React, {
5-
Component,
4+
import React, { Component } from 'react';
5+
import {
66
Dimensions,
77
Image,
88
ListView,

examples/ListView/android/app/BUCK

+66
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
import re
2+
3+
# To learn about Buck see [Docs](https://buckbuild.com/).
4+
# To run your application with Buck:
5+
# - install Buck
6+
# - `npm start` - to start the packager
7+
# - `cd android`
8+
# - `keytool -genkey -v -keystore keystores/debug.keystore -storepass android -alias androiddebugkey -keypass android -dname "CN=Android Debug,O=Android,C=US`
9+
# - `./gradlew :app:copyDownloadableDepsToLibs` - make all Gradle compile dependencies available to Buck
10+
# - `buck install -r android/app` - compile, install and run application
11+
#
12+
13+
lib_deps = []
14+
for jarfile in glob(['libs/*.jar']):
15+
name = 'jars__' + re.sub(r'^.*/([^/]+)\.jar$', r'\1', jarfile)
16+
lib_deps.append(':' + name)
17+
prebuilt_jar(
18+
name = name,
19+
binary_jar = jarfile,
20+
)
21+
22+
for aarfile in glob(['libs/*.aar']):
23+
name = 'aars__' + re.sub(r'^.*/([^/]+)\.aar$', r'\1', aarfile)
24+
lib_deps.append(':' + name)
25+
android_prebuilt_aar(
26+
name = name,
27+
aar = aarfile,
28+
)
29+
30+
android_library(
31+
name = 'all-libs',
32+
exported_deps = lib_deps
33+
)
34+
35+
android_library(
36+
name = 'app-code',
37+
srcs = glob([
38+
'src/main/java/**/*.java',
39+
]),
40+
deps = [
41+
':all-libs',
42+
':build_config',
43+
':res',
44+
],
45+
)
46+
47+
android_build_config(
48+
name = 'build_config',
49+
package = 'com.listviewexample',
50+
)
51+
52+
android_resource(
53+
name = 'res',
54+
res = 'src/main/res',
55+
package = 'com.listviewexample',
56+
)
57+
58+
android_binary(
59+
name = 'app',
60+
package_type = 'debug',
61+
manifest = 'src/main/AndroidManifest.xml',
62+
keystore = '//android/keystores:debug',
63+
deps = [
64+
':app-code',
65+
],
66+
)

examples/ListView/android/app/build.gradle

+61-6
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,15 @@
11
apply plugin: "com.android.application"
22

3+
import com.android.build.OutputFile
4+
35
/**
4-
* The react.gradle file registers two tasks: bundleDebugJsAndAssets and bundleReleaseJsAndAssets.
6+
* The react.gradle file registers a task for each build variant (e.g. bundleDebugJsAndAssets
7+
* and bundleReleaseJsAndAssets).
58
* These basically call `react-native bundle` with the correct arguments during the Android build
69
* cycle. By default, bundleDebugJsAndAssets is skipped, as in debug/dev mode we prefer to load the
710
* bundle directly from the development server. Below you can see all the possible configurations
811
* and their defaults. If you decide to add a configuration block, make sure to add it before the
9-
* `apply from: "react.gradle"` line.
12+
* `apply from: "../../node_modules/react-native/react.gradle"` line.
1013
*
1114
* project.ext.react = [
1215
* // the name of the generated asset file containing your JS bundle
@@ -21,6 +24,15 @@ apply plugin: "com.android.application"
2124
* // whether to bundle JS and assets in release mode
2225
* bundleInRelease: true,
2326
*
27+
* // whether to bundle JS and assets in another build variant (if configured).
28+
* // See http://tools.android.com/tech-docs/new-build-system/user-guide#TOC-Build-Variants
29+
* // The configuration property can be in the following formats
30+
* // 'bundleIn${productFlavor}${buildType}'
31+
* // 'bundleIn${buildType}'
32+
* // bundleInFreeDebug: true,
33+
* // bundleInPaidRelease: true,
34+
* // bundleInBeta: true,
35+
*
2436
* // the root of your project, i.e. where "package.json" lives
2537
* root: "../../",
2638
*
@@ -47,14 +59,29 @@ apply plugin: "com.android.application"
4759
* ]
4860
*/
4961

50-
apply from: "react.gradle"
62+
apply from: "../../node_modules/react-native/react.gradle"
63+
64+
/**
65+
* Set this to true to create two separate APKs instead of one:
66+
* - An APK that only works on ARM devices
67+
* - An APK that only works on x86 devices
68+
* The advantage is the size of the APK is reduced by about 4MB.
69+
* Upload all the APKs to the Play Store and people will download
70+
* the correct one based on the CPU architecture of their device.
71+
*/
72+
def enableSeparateBuildPerCPUArchitecture = false
73+
74+
/**
75+
* Run Proguard to shrink the Java bytecode in release builds.
76+
*/
77+
def enableProguardInReleaseBuilds = false
5178

5279
android {
5380
compileSdkVersion 23
5481
buildToolsVersion "23.0.1"
5582

5683
defaultConfig {
57-
applicationId "com.listview"
84+
applicationId "com.listviewexample"
5885
minSdkVersion 16
5986
targetSdkVersion 22
6087
versionCode 1
@@ -63,16 +90,44 @@ android {
6390
abiFilters "armeabi-v7a", "x86"
6491
}
6592
}
93+
splits {
94+
abi {
95+
reset()
96+
enable enableSeparateBuildPerCPUArchitecture
97+
universalApk false // If true, also generate a universal APK
98+
include "armeabi-v7a", "x86"
99+
}
100+
}
66101
buildTypes {
67102
release {
68-
minifyEnabled false // Set this to true to enable Proguard
103+
minifyEnabled enableProguardInReleaseBuilds
69104
proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
70105
}
71106
}
107+
// applicationVariants are e.g. debug, release
108+
applicationVariants.all { variant ->
109+
variant.outputs.each { output ->
110+
// For each separate APK per architecture, set a unique version code as described here:
111+
// http://tools.android.com/tech-docs/new-build-system/user-guide/apk-splits
112+
def versionCodes = ["armeabi-v7a":1, "x86":2]
113+
def abi = output.getFilter(OutputFile.ABI)
114+
if (abi != null) { // null for the universal-debug, universal-release variants
115+
output.versionCodeOverride =
116+
versionCodes.get(abi) * 1048576 + defaultConfig.versionCode
117+
}
118+
}
119+
}
72120
}
73121

74122
dependencies {
75123
compile fileTree(dir: "libs", include: ["*.jar"])
76124
compile "com.android.support:appcompat-v7:23.0.1"
77-
compile "com.facebook.react:react-native:0.20.+"
125+
compile "com.facebook.react:react-native:+" // From node_modules
126+
}
127+
128+
// Run this once to be able to run the application with BUCK
129+
// puts all compile dependencies into folder libs for BUCK to use
130+
task copyDownloadableDepsToLibs(type: Copy) {
131+
from configurations.compile
132+
into 'libs'
78133
}

examples/ListView/android/app/proguard-rules.pro

+8-5
Original file line numberDiff line numberDiff line change
@@ -40,17 +40,20 @@
4040

4141
-keep class * extends com.facebook.react.bridge.JavaScriptModule { *; }
4242
-keep class * extends com.facebook.react.bridge.NativeModule { *; }
43+
-keepclassmembers,includedescriptorclasses class * { native <methods>; }
4344
-keepclassmembers class * { @com.facebook.react.uimanager.UIProp <fields>; }
44-
-keepclassmembers class * { @com.facebook.react.uimanager.ReactProp <methods>; }
45-
-keepclassmembers class * { @com.facebook.react.uimanager.ReactPropGroup <methods>; }
45+
-keepclassmembers class * { @com.facebook.react.uimanager.annotations.ReactProp <methods>; }
46+
-keepclassmembers class * { @com.facebook.react.uimanager.annotations.ReactPropGroup <methods>; }
47+
48+
-dontwarn com.facebook.react.**
4649

4750
# okhttp
4851

4952
-keepattributes Signature
5053
-keepattributes *Annotation*
51-
-keep class com.squareup.okhttp.** { *; }
52-
-keep interface com.squareup.okhttp.** { *; }
53-
-dontwarn com.squareup.okhttp.**
54+
-keep class okhttp3.** { *; }
55+
-keep interface okhttp3.** { *; }
56+
-dontwarn okhttp3.**
5457

5558
# okio
5659

examples/ListView/android/app/src/main/AndroidManifest.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
2-
package="com.listview">
2+
package="com.listviewexample">
33

44
<uses-permission android:name="android.permission.INTERNET" />
55

0 commit comments

Comments
 (0)