Skip to content

Commit 2cde488

Browse files
WIP: v1.6.0 (#1079)
* fix(lifecycle): rename unsafe lifecycles * fix(exmaples): migrate examples to 0.60.x * refactor(example): refactor loadMinimal example * fix(loadMinimal): fix loadMinimal index mismatch when swipe to the first * fix(ios): fix bad jumping when loadMinimal set true * chore(example): provide DisableButton example re #1073 * fix(loadMinimal): prevent flick when loop and loadMinimal are enabled fix #1062 * chore(npm): bump the version * fix(loadMinimal): preload the correct item * style(prettier): keep the examples' prettier config the same as src * test(e2e): integrate e2e test by detox re #1053 * docs(1.6.0-rc): update docs for develop and changelog * chore(test): update test name to match component * test(multi): add navigation for multi exmaples' testcase * test(e2e): add e2e test for autoplay re #1080 * fix(android): fix android bad jump at second page * docs(example): setup nest swiper example re #1083 * fix(onMomentumScrollEnd): invoke onMomentumScrollEnd even offset no diff * fix(types): SwiperProps extends ScrollView base type As index.js L772 shows, {...this.props} used on ScrollView
1 parent 9e50938 commit 2cde488

File tree

81 files changed

+7387
-4032
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

81 files changed

+7387
-4032
lines changed

README.md

+11-6
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,11 @@
2323
2424
## Changelogs
2525

26-
- **[1.6.0-nightly]**
26+
- **[1.6.0-rc]**
2727
- Dependency
2828
- Remove ViewPagerAndroid, use ScrollView #1009
29+
- Test Integration
30+
- Setup e2e test
2931
- TypeScript
3032
- correct the wrong types #1000
3133
- Add missing scrollBy TypeScript definition #931
@@ -37,6 +39,9 @@
3739
- ES6 and CommonJS compatibility #717
3840
- Solves the issue of state messing up when parent component calls setState #939
3941
- replay when autoplay is setted to true #1002
42+
- fix broken examples and migrate to react-native 0.60.x
43+
- fix bad jumping on ios when loadMinimal set true
44+
- fix fliker when loop and loadMinimal are enabled #1062
4045

4146
* [1.5.6]
4247

@@ -112,10 +117,10 @@
112117
$ npm i react-native-swiper --save
113118
```
114119

115-
> v1.6.0-nightly
120+
> v1.6.0-rc
116121
117122
```
118-
npm i --save react-native-swiper@nightly
123+
npm i --save react-native-swiper@next
119124
```
120125

121126
### Basic Usage
@@ -325,14 +330,14 @@ $ react-native run-ios
325330

326331
```bash
327332
$ cd examples
328-
$ npm i
329-
$ npm run dev
333+
$ yarn
334+
$ yarn start
330335
$ react-native run-ios
331336
```
332337

333338
Then launch simulator to preview. Note that you just need to edit the source file `src/index.js`, the change will auto sync to examples.
334339

335-
And now that this project follows the [standard](https://github.com/feross/standard) code style, you'd better prepare it for IDE.
340+
After development, you should add test for your modification and make all tests passed to prevent other contributors break the feature in the future accidentally. We use detox + jest for e2e test now, you can read [Detox](https://github.com/wix/Detox) for more detail.
336341

337342
## Contribution
338343

examples/.babelrc

-3
This file was deleted.

examples/.eslintrc.js

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
module.exports = {
2+
root: true,
3+
extends: '@react-native-community',
4+
};

examples/.flowconfig

+64-10
Original file line numberDiff line numberDiff line change
@@ -11,35 +11,89 @@
1111
; Ignore duplicate module providers
1212
; For RN Apps installed via npm, "Libraries" folder is inside
1313
; "node_modules/react-native" but in the source repo it is in the root
14-
.*/Libraries/react-native/React.js
15-
.*/Libraries/react-native/ReactNative.js
14+
node_modules/react-native/Libraries/react-native/React.js
15+
16+
; Ignore polyfills
17+
node_modules/react-native/Libraries/polyfills/.*
18+
19+
; These should not be required directly
20+
; require from fbjs/lib instead: require('fbjs/lib/warning')
21+
node_modules/warning/.*
22+
23+
; Flow doesn't support platforms
24+
.*/Libraries/Utilities/HMRLoadingView.js
25+
26+
[untyped]
27+
.*/node_modules/@react-native-community/cli/.*/.*
1628

1729
[include]
1830

1931
[libs]
2032
node_modules/react-native/Libraries/react-native/react-native-interface.js
21-
node_modules/react-native/flow
22-
flow/
33+
node_modules/react-native/flow/
2334

2435
[options]
2536
emoji=true
2637

38+
esproposal.optional_chaining=enable
39+
esproposal.nullish_coalescing=enable
40+
41+
module.file_ext=.js
42+
module.file_ext=.json
43+
module.file_ext=.ios.js
44+
2745
module.system=haste
46+
module.system.haste.use_name_reducers=true
47+
# get basename
48+
module.system.haste.name_reducers='^.*/\([a-zA-Z0-9$_.-]+\.js\(\.flow\)?\)$' -> '\1'
49+
# strip .js or .js.flow suffix
50+
module.system.haste.name_reducers='^\(.*\)\.js\(\.flow\)?$' -> '\1'
51+
# strip .ios suffix
52+
module.system.haste.name_reducers='^\(.*\)\.ios$' -> '\1'
53+
module.system.haste.name_reducers='^\(.*\)\.android$' -> '\1'
54+
module.system.haste.name_reducers='^\(.*\)\.native$' -> '\1'
55+
module.system.haste.paths.blacklist=.*/__tests__/.*
56+
module.system.haste.paths.blacklist=.*/__mocks__/.*
57+
module.system.haste.paths.whitelist=<PROJECT_ROOT>/node_modules/react-native/Libraries/.*
58+
module.system.haste.paths.whitelist=<PROJECT_ROOT>/node_modules/react-native/RNTester/.*
59+
module.system.haste.paths.whitelist=<PROJECT_ROOT>/node_modules/react-native/IntegrationTests/.*
60+
module.system.haste.paths.blacklist=<PROJECT_ROOT>/node_modules/react-native/Libraries/react-native/react-native-implementation.js
61+
module.system.haste.paths.blacklist=<PROJECT_ROOT>/node_modules/react-native/Libraries/Animated/src/polyfills/.*
2862

2963
munge_underscores=true
3064

3165
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'
3266

3367
suppress_type=$FlowIssue
3468
suppress_type=$FlowFixMe
35-
suppress_type=$FixMe
69+
suppress_type=$FlowFixMeProps
70+
suppress_type=$FlowFixMeState
3671

37-
suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(>=0\\.\\(4[0-9]\\|[1-3][0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)
38-
suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(>=0\\.\\(4[0-9]\\|[1-3][0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)?:? #[0-9]+
39-
suppress_comment=\\(.\\|\n\\)*\\$FlowFixedInNextDeploy
72+
suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(<VERSION>\\)? *\\(site=[a-z,_]*react_native\\(_ios\\)?_\\(oss\\|fb\\)[a-z,_]*\\)?)\\)
73+
suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(<VERSION>\\)? *\\(site=[a-z,_]*react_native\\(_ios\\)?_\\(oss\\|fb\\)[a-z,_]*\\)?)\\)?:? #[0-9]+
4074
suppress_comment=\\(.\\|\n\\)*\\$FlowExpectedError
4175

42-
unsafe.enable_getters_and_setters=true
76+
[lints]
77+
sketchy-null-number=warn
78+
sketchy-null-mixed=warn
79+
sketchy-number=warn
80+
untyped-type-import=warn
81+
nonstrict-import=warn
82+
deprecated-type=warn
83+
unsafe-getters-setters=warn
84+
inexact-spread=warn
85+
unnecessary-invariant=warn
86+
signature-verification-failure=warn
87+
deprecated-utility=error
88+
89+
[strict]
90+
deprecated-type
91+
nonstrict-import
92+
sketchy-null
93+
unclear-type
94+
unsafe-getters-setters
95+
untyped-import
96+
untyped-type-import
4397

4498
[version]
45-
^0.49.1
99+
^0.98.0

examples/.gitignore

+13-4
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,17 @@ buck-out/
4646
# It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the
4747
# screenshots whenever they are needed.
4848
# For more information about the recommended setup visit:
49-
# https://github.com/fastlane/fastlane/blob/master/fastlane/docs/Gitignore.md
49+
# https://docs.fastlane.tools/best-practices/source-control/
5050

51-
fastlane/report.xml
52-
fastlane/Preview.html
53-
fastlane/screenshots
51+
*/fastlane/report.xml
52+
*/fastlane/Preview.html
53+
*/fastlane/screenshots
54+
55+
# Bundle artifact
56+
*.jsbundle
57+
58+
# CocoaPods
59+
/ios/Pods/
60+
61+
# TestCase from issue
62+
TestCase-*/

examples/.prettierrc

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"printWidth": 80,
3+
"tabWidth": 2,
4+
"useTabs": false,
5+
"semi": false,
6+
"singleQuote": true,
7+
"trailingComma": "none",
8+
"bracketSpacing": true,
9+
"jsxBracketSameLine": false
10+
}

examples/App.js

-9
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
1+
/**
2+
* @format
3+
*/
4+
15
import 'react-native';
26
import React from 'react';
3-
import Index from '../index.ios.js';
7+
import App from '../App';
48

59
// Note: test renderer must be required after react-native.
610
import renderer from 'react-test-renderer';
711

812
it('renders correctly', () => {
9-
const tree = renderer.create(
10-
<Index />
11-
);
13+
renderer.create(<App />);
1214
});

examples/__tests__/index.android.js

-12
This file was deleted.

examples/android/.project

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<projectDescription>
3+
<name>android</name>
4+
<comment>Project android created by Buildship.</comment>
5+
<projects>
6+
</projects>
7+
<buildSpec>
8+
<buildCommand>
9+
<name>org.eclipse.buildship.core.gradleprojectbuilder</name>
10+
<arguments>
11+
</arguments>
12+
</buildCommand>
13+
</buildSpec>
14+
<natures>
15+
<nature>org.eclipse.buildship.core.gradleprojectnature</nature>
16+
</natures>
17+
</projectDescription>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
connection.project.dir=
2+
eclipse.preferences.version=1

examples/android/app/BUCK

+4-14
Original file line numberDiff line numberDiff line change
@@ -8,23 +8,13 @@
88
# - `buck install -r android/app` - compile, install and run application
99
#
1010

11+
load(":build_defs.bzl", "create_aar_targets", "create_jar_targets")
12+
1113
lib_deps = []
1214

13-
for jarfile in glob(['libs/*.jar']):
14-
name = 'jars__' + jarfile[jarfile.rindex('/') + 1: jarfile.rindex('.jar')]
15-
lib_deps.append(':' + name)
16-
prebuilt_jar(
17-
name = name,
18-
binary_jar = jarfile,
19-
)
15+
create_aar_targets(glob(["libs/*.aar"]))
2016

21-
for aarfile in glob(['libs/*.aar']):
22-
name = 'aars__' + aarfile[aarfile.rindex('/') + 1: aarfile.rindex('.aar')]
23-
lib_deps.append(':' + name)
24-
android_prebuilt_aar(
25-
name = name,
26-
aar = aarfile,
27-
)
17+
create_jar_targets(glob(["libs/*.jar"]))
2818

2919
android_library(
3020
name = "all-libs",

0 commit comments

Comments
 (0)