import React, { Component } from 'react'; import { View, Text, StyleSheet, Image, TouchableWithoutFeedback } from 'react-native'; import SwipeToClose from '../src/index'; export default class App extends Component { constructor(props) { super(props); this.state = { imageSource: '' }; } onPressImage = () => { this.swipeToCloseRef.onOpen(this.imageRef); this.setState({ imageSource: 'https://facebook.github.io/react-native/docs/assets/favicon.png' }); }; render() { return ( { this.imageRef = c; }} source={{ uri: 'https://facebook.github.io/react-native/docs/assets/favicon.png' }} resizeMode="contain" style={styles.imageStyle} /> (this.swipeToCloseRef = c)} imageSource={this.state.imageSource} /> ); } } const styles = StyleSheet.create({ container: { flex: 1, justifyContent: 'center', alignItems: 'center' }, imageStyle: { width: 250, height: 200 } });