Skip to content
This repository has been archived by the owner on Nov 27, 2022. It is now read-only.

Commit

Permalink
feat: use gesture handler and reanimated for performance
Browse files Browse the repository at this point in the history
BREAKING CHANGE: this removes some props which are difficult/impossible to implement with reanimated,
and requires linking [react-native-gesture-handler](https://github.com/kmagiera/react-native-gesture-handler)
and [react-native-reanimated](https://github.com/kmagiera/react-native-reanimated)

List of breaking changes:

- The `renderPager` prop is removed. Now there's only one pager implemented with gesture handler.
- The `animationEnabled` prop is removed. It's not straightforward to implement, and doesn't make much sense in the scope of this library.
- The `canJumpToTab` prop is removed
- Few props such as `onSwipeStart`, `onSwipeEnd` and `onAnimationEnd` have been removed (if you have ideas on how to implement these, happy to add them back)
- The `position` prop received by the `renderTabBar` and `renderScene` are now [reanimated](https://github.com/kmagiera/react-native-reanimated) nodes, so you'll need to migrate your custom tab bar to use reanimated. This should mostly be straightforward.
- No react-native-web support because both gesture handler and reanimated are native deps. I can implement the pager with pan responder for web, but can't do much for reanimated
  • Loading branch information
satya164 committed Feb 19, 2019
1 parent cc04115 commit 451435a
Show file tree
Hide file tree
Showing 45 changed files with 3,929 additions and 4,763 deletions.
3 changes: 0 additions & 3 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,3 @@ workflows:
- lint-and-flow:
requires:
- install-dependencies
- unit-tests:
requires:
- install-dependencies
5 changes: 4 additions & 1 deletion .flowconfig
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,13 @@
.*/node_modules/prettier/.*
.*/node_modules/eslint.*

; Ignore modules with errors
.*/node_modules/@expo/.*

[untyped]
.*/node_modules/expo/.*
.*/node_modules/xdl/.*
.*/node_modules/react-native-gesture-handler/.*
.*/node_modules/react-native-view-shot/.*

[include]

Expand Down
337 changes: 200 additions & 137 deletions README.md

Large diffs are not rendered by default.

6 changes: 0 additions & 6 deletions __tests__/.eslintrc

This file was deleted.

65 changes: 0 additions & 65 deletions __tests__/PagerAndroid.test.js

This file was deleted.

74 changes: 0 additions & 74 deletions __tests__/PagerPan.test.js

This file was deleted.

111 changes: 0 additions & 111 deletions __tests__/PagerScroll.test.js

This file was deleted.

2 changes: 1 addition & 1 deletion example/.babelrc
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"plugins": [
["module-resolver", {
"alias": {
"react-native-tab-view": "../src"
"react-native-tab-view": "../src/index.js"
}
}]
]
Expand Down
3 changes: 0 additions & 3 deletions example/App.js

This file was deleted.

10 changes: 5 additions & 5 deletions example/README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
## Run the example
# Run the example

- [View it with Expo](https://expo.io/@satya164/react-native-tab-view-demos)
- Run the example locally
+ Clone the repository and `cd` to this directory
+ Run `yarn` to install the dependencies
+ Run `yarn start` to start the packager
+ Scan the QR Code with the Expo app
- Clone the repository and `cd` to this directory
- Run `yarn` to install the dependencies
- Run `yarn start` to start the packager
- Scan the QR Code with the Expo app
5 changes: 3 additions & 2 deletions example/app.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
"name": "React Native Tab View Demos",
"description": "Demonstrates the various capabilities of react-native-tab-view: https://github.com/react-native-community/react-native-tab-view",
"slug": "react-native-tab-view-demos",
"sdkVersion": "27.0.0",
"privacy": "public",
"sdkVersion": "32.0.0",
"version": "1.0.0",
"primaryColor": "#2196f3",
"icon": "assets/icon.png",
Expand All @@ -15,7 +16,7 @@
"assetExts": [
"ttf"
],
"config": "./rn-cli.config.js",
"config": "./metro.config.js",
"projectRoots": ""
}
}
Expand Down
28 changes: 28 additions & 0 deletions example/metro.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/* eslint-disable import/no-commonjs */

const path = require('path');
const blacklist = require('metro-config/src/defaults/blacklist');
const pak = require('../package.json');
const escape = require('escape-string-regexp');

const peerDependencies = Object.keys(pak.peerDependencies);

module.exports = {
projectRoot: __dirname,
watchFolders: [path.resolve(__dirname, '..')],

resolver: {
blacklistRE: blacklist([
new RegExp(
`^${escape(path.resolve(__dirname, '..', 'node_modules'))}\\/.*$`
),
new RegExp(
`^${escape(
path.resolve(__dirname, '..', 'docs', 'node_modules')
)}\\/.*$`
),
]),

providesModuleNodeModules: ['@babel/runtime', ...peerDependencies],
},
};
11 changes: 5 additions & 6 deletions example/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
"name": "tabviewexample",
"version": "0.0.1",
"private": true,
"main": "App.js",
"main": "src/App.js",
"scripts": {
"start": "react-native-scripts start",
"android": "react-native-scripts android",
"ios": "react-native-scripts ios"
"start": "expo start",
"android": "expo android",
"ios": "expo ios"
},
"dependencies": {
"@expo/vector-icons": "^9.0.0",
Expand All @@ -21,7 +21,6 @@
"glob-to-regexp": "^0.4.0"
},
"resolutions": {
"**/prop-types": "15.6.1",
"**/react": "16.3.1"
"**/react": "16.5.0"
}
}
Loading

0 comments on commit 451435a

Please sign in to comment.