import React, { Component } from 'react' import { Text, View, Image, TouchableOpacity, TouchableWithoutFeedback, Dimensions } from 'react-native' import Swiper from 'react-native-swiper' import PhotoView from 'react-native-photo-view' const { width, height } = Dimensions.get('window') var styles = { wrapper: { backgroundColor: '#000', top: 0, right: 0, bottom: 0, left: 0 }, slide: { flex: 1, justifyContent: 'center', alignItems: 'center' }, photo: { width, height, flex: 1 }, text: { color: '#fff', fontSize: 30, fontWeight: 'bold' }, thumbWrap: { marginTop: 100, borderWidth: 5, borderColor: '#000', flexDirection: 'row' }, thumb: { width: 50, height: 50 } } const renderPagination = (index, total, context) => { return ( {index + 1} / {total} ) } const Viewer = props => ( {props.imgList.map((item, i) => ( props.pressHandle()}> ))} ) export default class extends Component { constructor(props) { super(props) this.state = { imgList: [ 'https://avatars3.githubusercontent.com/u/533360?v=3&s=466', 'https://assets-cdn.github.com/images/modules/site/business-hero.jpg', 'https://placeholdit.imgix.net/~text?txtsize=29&txt=350%C3%971150&w=350&h=1150' ], showViewer: true, showIndex: 0 } this.viewerPressHandle = this.viewerPressHandle.bind(this) this.thumbPressHandle = this.thumbPressHandle.bind(this) } viewerPressHandle() { this.setState({ showViewer: false }) } thumbPressHandle(i) { this.setState({ showIndex: i, showViewer: true }) } render() { return ( {this.state.showViewer && ( )} {this.state.imgList.map((item, i) => ( this.thumbPressHandle(i)}> ))} ) } }