/react-native-viewpager

React Native wrapper for the Android ViewPager.

Primary LanguageJavaScriptMIT LicenseMIT

react-native-viewpager

CircleCI branch

Note: This module has been extracted from react-native as a part of the Lean Core effort.

For now, this module only works for Android. Under the hood it is using the native Android ViewPager.

Getting started

yarn add @react-native-community/viewpager

Mostly automatic installation

react-native link @react-native-community/viewpager

Usage

import ViewPager from "@react-native-community/viewpager";

class MyPager extends React.Component { 
  render() {
    return (
      <ViewPager
        style={styles.viewPager}
        initialPage={0}>
        <View key="1">
          <Text>First page</Text>
        </View>
        <View key="2">
          <Text>Second page</Text>
        </View>
      </ViewPager>
    );
  }
}

const styles = StyleSheet.create({
  viewPager: {
    flex: 1
  },
})