You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Nov 27, 2022. It is now read-only.
BREAKING CHANGE: This drops `react-native-gesture-handler` and `react-native-reanimated`.
All custom logic using GestureHandler and Reanimated will need to be rewritten.
Now that ViewPager is better maintained and cross-platform,
it's time to migrate to it for native perf and also less maintenance cost.
Co-authored-by: Michał Osadnik <[email protected]>
Copy file name to clipboardexpand all lines: .github/workflows/triage.yml
+3-18
Original file line number
Diff line number
Diff line change
@@ -34,9 +34,9 @@ jobs:
34
34
body: "Hey! Thanks for opening the issue. Can you provide a [minimal repro](https://stackoverflow.com/help/minimal-reproducible-example) which demonstrates the issue? Posting a snippet of your code in the issue is useful, but it's not usually straightforward to run. A repro will help us debug the issue faster. Please try to keep the repro as small as possible.\n\nThe easiest way to provide a repro is on [snack.expo.io](https://snack.expo.io). If it's not possible to repro it on [snack.expo.io](https://snack.expo.io), then please provide the repro in a GitHub repository."
body: "Hey! Thanks for opening the issue. The issue tracker is intended for only tracking bug reports in React Navigation. Seems you have an issue related to `react-native-reanimated` library. Please post your issue in [this repo](https://github.com/software-mansion/react-native-reanimated) so that it's notified to the maintainers of that library."
body: "Hey! Thanks for opening the issue. The issue tracker is intended for only tracking bug reports in React Navigation. Seems you have an issue related to `react-native-gesture-handler` library. Please post your issue in [this repo](https://github.com/software-mansion/react-native-gesture-handler) so that it's notified to the maintainers of that library."
49
+
body: "Hey! Thanks for opening the issue. Seems that this issue issue related to `react-native-pager-view` library which is a dependency of `react-native-tab-view`. Can you also post your issue in [this repo](https://github.com/callstack/react-native-viewpager) so that it's notified to the maintainers of that library? This will help us fix the issue faster since it's upto the maintainers of that library to investigate it."
Copy file name to clipboardexpand all lines: README.md
+13-189
Original file line number
Diff line number
Diff line change
@@ -4,7 +4,7 @@
4
4
[![Version][version-badge]][package]
5
5
[![MIT License][license-badge]][license]
6
6
7
-
A cross-platform Tab View component for React Native.
7
+
A cross-platform Tab View component for React Native. Implemented using [`react-native-pager-view`](https://github.com/callstack/react-native-view-pager) on Android & iOS, and [PanResponder](https://reactnative.dev/docs/panresponder) on Web.
8
8
9
9
-[Run the example app to see it in action](https://expo.io/@satya164/react-native-tab-view-demos).
10
10
- Checkout the [example/](https://github.com/satya164/react-native-tab-view/tree/main/example) folder for source code.
@@ -30,67 +30,40 @@ Open a Terminal in the project root and run:
30
30
yarn add react-native-tab-view
31
31
```
32
32
33
-
Now we need to install [`react-native-gesture-handler`](https://github.com/kmagiera/react-native-gesture-handler) and [`react-native-reanimated`](https://github.com/kmagiera/react-native-reanimated).
33
+
Now we need to install [`react-native-pager-view`](https://github.com/callstack/react-native-viewpager).
34
34
35
35
If you are using Expo, to ensure that you get the compatible versions of the libraries, run:
If you are using Expo, you are done. Otherwise, continue to the next steps.
48
-
49
-
Next, we need to link these libraries. The steps depends on your React Native version:
50
-
51
-
-**React Native 0.60 and higher**
52
-
53
-
On newer versions of React Native, [linking is automatic](https://github.com/react-native-community/cli/blob/main/docs/autolinking.md).
54
-
55
-
To complete the linking on iOS, make sure you have [Cocoapods](https://cocoapods.org/) installed. Then run:
56
-
57
-
```sh
58
-
cd ios
59
-
pod install
60
-
cd ..
61
-
```
62
-
63
-
-**React Native 0.59 and lower**
64
-
65
-
If you're on an older React Native version, you need to manually link the dependencies. To do that, run:
66
-
67
-
```sh
68
-
react-native link react-native-reanimated
69
-
react-native link react-native-gesture-handler
70
-
```
71
-
72
-
**IMPORTANT:** There are additional steps required for `react-native-gesture-handler` on Android after linking (for all React Native versions). Check the [this guide](https://docs.swmansion.com/react-native-gesture-handler/docs/) to complete the installation.
73
-
74
47
We're done! Now you can build and run the app on your device/simulator.
Position of the tab bar in the tab view. Possible values are `'top'` and `'bottom'`. Defaults to `'top'`.
@@ -368,10 +305,6 @@ String indicating whether the keyboard gets dismissed in response to a drag gest
368
305
369
306
Boolean indicating whether to enable swipe gestures. Swipe gestures are enabled by default. Passing `false` will disable swipe gestures, but the user can still switch tabs by pressing the tab bar.
370
307
371
-
##### `swipeVelocityImpact`
372
-
373
-
Determines how relevant is a velocity while calculating next position while swiping. Defaults to `0.2`.
374
-
375
308
##### `onSwipeStart`
376
309
377
310
Callback which is called when the swipe gesture starts, i.e. the user touches the screen and moves it.
@@ -380,26 +313,6 @@ Callback which is called when the swipe gesture starts, i.e. the user touches th
380
313
381
314
Callback which is called when the swipe gesture ends, i.e. the user lifts their finger from the screen after the swipe gesture.
382
315
383
-
##### `timingConfig`
384
-
385
-
Configuration object for the timing animation which occurs when tapping on tabs. Supported properties are:
386
-
387
-
-`duration` (`number`)
388
-
389
-
##### `springConfig`
390
-
391
-
Configuration object for the spring animation which occurs after swiping. Supported properties are:
392
-
393
-
-`damping` (`number`)
394
-
-`mass` (`number`)
395
-
-`stiffness` (`number`)
396
-
-`restSpeedThreshold` (`number`)
397
-
-`restDisplacementThreshold` (`number`)
398
-
399
-
##### `springVelocityScale`
400
-
401
-
Number for determining how meaningful is gesture velocity for calculating initial velocity of spring animation. Defaults to `0`.
402
-
403
316
##### `initialLayout`
404
317
405
318
Object containing the initial height and width of the screens. Passing this will improve the initial rendering performance. For most apps, this is a good default:
@@ -411,21 +324,6 @@ Object containing the initial height and width of the screens. Passing this will
411
324
/>
412
325
```
413
326
414
-
##### `position`
415
-
416
-
Animated value to listen to the position updates. The passed position value will be kept in sync with the current position of the tabs. It's useful for accessing the animated value outside the tab view.
Style to apply to the view wrapping each screen. You can pass this to override some default styles such as overflow clipping:
@@ -434,20 +332,6 @@ Style to apply to the view wrapping each screen. You can pass this to override s
434
332
435
333
Style to apply to the tab view container.
436
334
437
-
##### `gestureHandlerProps`
438
-
439
-
An object with props to be passed to underlying [`PanGestureHandler`](https://kmagiera.github.io/react-native-gesture-handler/docs/handler-pan.html#properties). For example:
440
-
441
-
```js
442
-
<TabView
443
-
gestureHandlerProps={{
444
-
maxPointers:1,
445
-
waitFor: [someRef]
446
-
}}
447
-
...
448
-
/>
449
-
```
450
-
451
335
### `TabBar`
452
336
453
337
Material design themed tab bar. To customize the tab bar, you'd need to use the `renderTabBar` prop of `TabView` to render the `TabBar` and pass additional props.
@@ -474,7 +358,7 @@ return (
474
358
);
475
359
```
476
360
477
-
#### Props
361
+
#### TabBar Props
478
362
479
363
##### `getLabelText`
480
364
@@ -631,77 +515,17 @@ Style to apply to the inner container for tabs.
631
515
632
516
Style to apply to the tab bar container.
633
517
634
-
### `ScrollPager`
635
-
Custom pager which can we used inside `renderPager` prop. It is based on ScrollView and might bring a slightly better experience on iOS.
636
-
637
-
#### Props
638
-
It accepts the same set of props as default pager extended with one addition:
639
-
640
-
##### ovescroll
641
-
When `true`, the scroll view bounces when it reaches the end of the content. The default value is `false`.
If you want to integrate the tab view with React Navigation's navigation system, e.g. want to be able to navigate to a tab using `navigation.navigate` etc, you can use the following official integrations:
649
523
650
-
-[@react-navigation/material-top-tabs](https://github.com/react-navigation/react-navigation/tree/main/packages/material-top-tabs) for React Navigation 5
524
+
-[@react-navigation/material-top-tabs](https://github.com/react-navigation/react-navigation/tree/main/packages/material-top-tabs) for React Navigation 5 & 6
651
525
-[react-navigation-tabs](https://github.com/react-navigation/react-navigation-tabs) for React Navigation 4
652
526
653
527
Note that some functionalities are not available with the React Navigation 4 integration because of the limitations in React Navigation. For example, it's possible to dynamically change the rendered tabs.
If you use React Native Navigation by Wix on Android, you need to wrap all your screens that uses `react-native-tab-view` with `gestureHandlerRootHOC` from `react-native-gesture-handler`. Refer [`react-native-gesture-handler`'s docs](https://kmagiera.github.io/react-native-gesture-handler/docs/getting-started.html#with-wix-react-native-navigation-https-githubcom-wix-react-native-navigation) for more details.
658
-
659
-
### [Mobx](https://mobx.js.org/)
660
-
661
-
Normally we recommend to use React's local state to manage the navigation state for the tabs. But if you need to use Mobx to manage the navigation state, there is a gotcha you need to be aware of.
662
-
663
-
Mobx relies on data being accessed in `render` to work properly. However, we don't use the `index` value inside `render` in the library, so Mobx fails to track any changes to the `index`. You might see that the tabs don't change on pressing on the tab bar if you have a state like this:
664
-
665
-
```js
666
-
@observable navigationState = {
667
-
index:0,
668
-
routes: [
669
-
{ key:'music', title:'Music' },
670
-
{ key:'albums', title:'Albums' },
671
-
],
672
-
};
673
-
```
674
-
675
-
To workaround this, we need to make sure that `index` is accessed in `render`. We can refactor our state to something like this for it to work:
0 commit comments