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
This component allows the user to swipe left and right through pages of data. Under the hood it is using the native [Android ViewPager](https://developer.android.com/reference/android/support/v4/view/ViewPager) and the [iOS UIPageViewController](https://developer.apple.com/documentation/uikit/uipageviewcontroller) implementations. [See it in action!](https://github.com/react-native-community/react-native-viewpager#preview)
|| iOS support | iOS support | iOS support | iOS support |
17
-
| Android support | Android support | AndroidX support | ViewPager2 support |[Reverted to 3.3.0](https://github.com/callstack/react-native-viewpager/issues/233#issue-711000654)|
[ViewPager2](https://developer.android.com/jetpack/androidx/releases/viewpager2) for Android uses another implementation than ViewPager1, hence it caused lots of issues. You can try experimental version using below command
| iOS support | Deprecated | iOS support | iOS support |
22
+
| ViewPager1 support | Deprecated |[Reverted to 3.3.0](https://github.com/callstack/react-native-viewpager/issues/233#issue-711000654)| ViewPager2 support |
25
23
26
24
## Getting started
27
25
28
26
`yarn add @react-native-community/viewpager`
29
27
30
-
## Linking
28
+
## Linking
31
29
32
30
### >= 0.60
33
31
@@ -50,6 +48,7 @@ Follow the [instructions in the React Native documentation](https://facebook.git
50
48
```ruby
51
49
pod 'react-native-viewpager', :path => '../node_modules/@react-native-community/viewpager'
52
50
```
51
+
53
52
</details>
54
53
55
54
<details>
@@ -58,12 +57,14 @@ pod 'react-native-viewpager', :path => '../node_modules/@react-native-community/
58
57
Make the following changes:
59
58
60
59
#### `android/settings.gradle`
60
+
61
61
```groovy
62
62
include ':@react-native-community_viewpager'
63
63
project(':@react-native-community_viewpager').projectDir = new File(rootProject.projectDir, '../node_modules/@react-native-community/viewpager/android')
**Attention:** Note that you can only use `View` components as children of `ViewPager` (cf. folder */example*)
122
-
. For Android if `View` has own children, set prop `collapsable` to false https://reactnative.dev/docs/view#collapsable, otherwise react-native might remove those children views and and it's children will be rendered as separate pages
125
+
. For Android if `View` has own children, set prop `collapsable` to false <https://reactnative.dev/docs/view#collapsable>, otherwise react-native might remove those children views and and it's children will be rendered as separate pages
123
126
124
127
## Advanced usage
125
-
For advanced usage please take a look into our [example project](https://github.com/callstack/react-native-viewpager/blob/master/example/src/BasicViewPagerExample.tsx)
128
+
129
+
For advanced usage please take a look into our [example project](https://github.com/callstack/react-native-viewpager/blob/master/example/src/BasicViewPagerExample.tsx)
126
130
127
131
## API
128
132
@@ -139,6 +143,37 @@ For advanced usage please take a look into our [example project](https://github.
139
143
|`transitionStyle: TransitionStyle`|Use `scroll` or `curl` to change transition style (it does **not** work dynamically)|iOS
140
144
|`showPageIndicator: boolean`|Shows the dots indicator at the bottom of the view|iOS
141
145
|`overScrollMode: OverScollMode`|Used to override default value of overScroll mode. Can be `auto`, `always` or `never`. Defaults to `auto`|Android
146
+
|`offscreenPageLimit: number`|Set the number of pages that should be retained to either side of the currently visible page(s). Pages beyond this limit will be recreated from the adapter when needed. Defaults to RecyclerView's caching strategy. The given value must either be larger than 0.|Android
147
+
|`overdrag: boolean`|Allows for overscrolling after reaching the end or very beginning or pages|iOS
148
+
149
+
## Development workflow
150
+
151
+
To get started with the project, run `yarn bootstrap` in the root directory to install the required dependencies.
152
+
153
+
```sh
154
+
yarn bootstrap
155
+
```
156
+
157
+
While developing, you can run the example to check your changes
158
+
159
+
```sh
160
+
cd example
161
+
yarn android
162
+
yarn ios
163
+
```
164
+
165
+
Before sending a pull rquest, make sure your code passes TypeScript and ESLint. Run the following to verify:
0 commit comments