Açıklama Yok

App.js 1.5KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. import React, {Component} from 'react';
  2. import { StyleSheet, Text, View, Dimensions } from 'react-native';
  3. import RNSwiper from 'rnezswiper'
  4. const { width, height } = Dimensions.get("window")
  5. let data = 'HelloWord'.toUpperCase().split('')
  6. export default class App extends Component{
  7. state = {
  8. autoPlay: true
  9. }
  10. componentDidMount () {
  11. // setTimeout(() => {
  12. // this.setState({
  13. // autoPlay: false
  14. // })
  15. // }, 4000)
  16. }
  17. render() {
  18. let { autoPlay } = this.state
  19. return (
  20. <View style={styles.container}>
  21. <View style={{ height: 200 }}>
  22. <RNSwiper
  23. loop
  24. autoPlay
  25. initIndex={0}
  26. onChangeIndex={(index) => { }}
  27. slideStyle={styles.slideStyle}
  28. renderPagination={(index) => { // customize pagination
  29. return (
  30. <View style={[{ position: 'absolute', bottom: 0, height: 30, width, left: 0,zIndex: 1 }]}>
  31. <Text style={{ color: '#fff',textAlign: 'center' }}>{`${index + 1}/${data.length}`}</Text>
  32. </View>
  33. )
  34. }}
  35. >
  36. {
  37. data.map(item => <Text key={item} style={styles.font}>{item}</Text>)
  38. }
  39. </RNSwiper>
  40. </View>
  41. <Text>other content</Text>
  42. </View>
  43. );
  44. }
  45. }
  46. const styles = StyleSheet.create({
  47. container: {
  48. flex: 1,
  49. },
  50. font: {
  51. color: '#fff',
  52. fontSize: 30
  53. },
  54. slideStyle: { height: 200, width, backgroundColor: '#7e57c2' },
  55. });