MyBlogShare

Proses dan tampilan animasi slide react native swiper

Jul 16th, 2021
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import React, { Component } from 'react'
  2. import { AppRegistry, StyleSheet, Text, View } from 'react-native'
  3.  
  4. import Swiper from 'react-native-swiper'
  5.  
  6. const styles = StyleSheet.create({
  7.   wrapper: {},
  8.   slide1: {
  9.     flex: 1,
  10.     justifyContent: 'center',
  11.     alignItems: 'center',
  12.     backgroundColor: '#9DD6EB'
  13.   },
  14.   slide2: {
  15.     flex: 1,
  16.     justifyContent: 'center',
  17.     alignItems: 'center',
  18.     backgroundColor: '#97CAE5'
  19.   },
  20.   slide3: {
  21.     flex: 1,
  22.     justifyContent: 'center',
  23.     alignItems: 'center',
  24.     backgroundColor: '#92BBD9'
  25.   },
  26.   text: {
  27.     color: '#fff',
  28.     fontSize: 30,
  29.     fontWeight: 'bold'
  30.   }
  31. })
  32.  
  33. export default class SwiperComponent extends Component {
  34.   render() {
  35.     return (
  36.       <Swiper style={styles.wrapper} showsButtons={true}>
  37.         <View style={styles.slide1}>
  38.           <Text style={styles.text}>Hello Swiper</Text>
  39.         </View>
  40.         <View style={styles.slide2}>
  41.           <Text style={styles.text}>Beautiful</Text>
  42.         </View>
  43.         <View style={styles.slide3}>
  44.           <Text style={styles.text}>And simple</Text>
  45.         </View>
  46.       </Swiper>
  47.     )
  48.   }
  49. }
  50.  
  51. AppRegistry.registerComponent('myproject', () => SwiperComponent)
Advertisement
Add Comment
Please, Sign In to add comment