Swipe View in react native
Using library react-native-swiper we can implement react native swipe view.
To install react-native-swiper library use bellow command
npm install react-native-swiper --save
SwipView.js component
import React,{Component} from 'react';
import {
StyleSheet,
Text,
View
} from 'react-native';
import Swiper from 'react-native-swiper';
class SwipeView extends Component{
render(){
return(
<Swiper>
<View style={styles.screen1}>
<Text style={styles.text}>Screen 1</Text>
</View>
<View style={styles.screen2}>
<Text style={styles.text}>Screen 2</Text>
</View>
<View style={styles.screen3}>
<Text style={styles.text}>Screen 3</Text>
</View>
</Swiper>
)
}
}
export default SwipeView;
const styles = StyleSheet.create({
screen1: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
backgroundColor: '#17fc03',
},
screen2: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
backgroundColor: '#038cfc',
},
screen3: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
backgroundColor: '#fc03ba',
},
text: {
color: '#fff',
fontSize: 35,
fontWeight: 'bold',
}
})


0 Comments
Leave a reply
Your email address will be private. Required fields are marked with *
Name *
Email *
Website