Releases: satya164/react-native-tab-view
Release 1.3.3
Release 2.0.3
Release 2.0.2
Bug Fixes
- force the pager to stay in sync with state if update is dropped (374560f)
Release 2.0.1
This version includes a rewrite of the pager using react-native-gesture-handler and react-native-reanimated as opposed to the platform specific implementations in the previous version. This addresses a many platform specific bugs and performance problems.
Due to the use of reanimated
as opposed to React Native's Animated
API, this release is not backward compatible. However, I have tried my best to keep the API mostly unchanged for an easier upgrade path. If you've been using the components provided by the library, the migration will require minimal changes.
Upgrade instructions
Installation
Open a Terminal in the project root and run:
yarn add react-native-tab-view@^2.0.1
If you are using Expo, you are done. Otherwise, continue to the next step.
Install and link react-native-gesture-handler
and react-native-reanimated
. To install and link them, run:
yarn add react-native-reanimated react-native-gesture-handler
react-native link react-native-reanimated
react-native link react-native-gesture-handler
Finish configuring react-native-gesture-handler
following the instructions in this guide.
Updating your code
Since we now use react-native-reanimated
, you have to update the code using Animated
from react-native
to use react-native-reanimated
instead. This should only be necessary if you are using custom tab bar, indicator, icons etc.
Change the import
statement:
- import { Animated } from 'react-native';
+ import Animated from 'react-native-reanimated';
If you're using interpolations:
- position.interpolate({
+ Animated.interpolate(position, {
inputRange: [...],
outputRange: [...],
});
For more advanced usage, please refer to react-native-reanimated
's documentation.
The renderPager
prop is removed, move any props from the pager component to TabView
and remove any useNativeDriver
prop:
- _renderPager = props => (
- <PagerScroll
- {...props}
- onSwipeStart={this._handleSwipeStart}
- keyboardDismissMode="on-drag"
- />
- );
render() {
return (
<TabView
navigationState={this.state}
+ onSwipeStart={this._handleSwipeStart}
+ keyboardDismissMode="on-drag"
- renderPager={this._renderPager}
renderScene={this._renderScene}
onIndexChange={this._handleIndexChange}
- useNativeDriver
/>
);
}
Changelog
BREAKING CHANGES
- The
renderPager
prop is removed in favor of a single cross-platform pager. - The
animationEnabled
prop is removed as it doesn't make much sense in the scope of this library. - The
canJumpToTab
prop is removed as it's not straightforward to implement with decent UX. - The
onAnimationEnd
prop has been removed (if you need it, PR welcome to add it back). - The
position
prop received by the variousrenderX
callbacks are now reanimated nodes. - The
renderScene
prop doesn't receivenavigationState
anymore as screens rendered inrenderScene
should not rely on the navigation state for better performance. You can still pass the navigation state explicitly. UsuallynavigationState={this.state}
should be enough. react-native-web
support is dropped because reanimated doesn't support it.
New Features
Release 2.0.0-alpha.8
Features
- add onSwipeStart and onSwipeEnd listeners back (08b1dc2)
Release 2.0.0-alpha.7
Bug Fixes
- fix a regression disabling PureComponent optimizations (9a63903)
Release 2.0.0-alpha.6
Features
- add lazy prop to defer rendering unfocused scenes (a31c3e5)
Release 2.0.0-alpha.5
Bug Fixes
- add extra check to ensure that navigation state has changed (71fbaa7)
Release 2.0.0-alpha.4
Release 2.0.0-alpha.3
Code Refactoring
- Use exact types for flow (8d5c475)
BREAKING CHANGES
- Don't pass
navigationState
torenderScene
: Screens rendered inrenderScene
should not rely on the navigation state for better performance. We no longer pass the prop to encourage this behaviour. You can still pass the navigation state explicitely. UsuallynavigationState={this.state}
should be enough.