constructor(props) {
super(props);
this.state = {
isModalVisible: false,
name: ''
};
}
render() {
const renderVideoPic = ({ item, index }) => {
return (
<TouchableOpacity onPress={() => this.setState({ isModalVisible: !this.state.isModalVisible, name: item.first_name })}>
<View
style={[
{ width: Dimensions.get('window').width / 2.2 },
{ height: 250,
margin: 8
}]}
>
<Image
square
source={{ uri: item.image }}
key={index}
style={{
flex: 1,
height: undefined,
width: undefined,
borderRadius: 10,
borderWidth: 0.5,
borderColor: '#dddddd'
}}
/>
</View>
</TouchableOpacity>
);
};
if (this.props.game.isLoading) {
return (
<Loading />
);
}
else if (this.props.game.errMess) {
return (
<View>
<Text>{this.props.game.errMess}</Text>
</View>
);
}
else {
return (
<View style={{ flex: 1 }}>
<FlatList
data={this.props.events.events}
renderItem={renderVideoPic}
keyExtractor={item => item.id.toString()}
showsVerticalScrollIndicator={false}
contentContainerStyle={styles.container}
numColumns={2}
/>
<TouchableOpacity>
<Modal
isVisible={this.state.isModalVisible}
//animationOut='slideOutDown'
//onBackdropPress={() => this.setState({ isVisible: false })}
backdropOpacity={1}
backdropColor='white'
style={{
justifyContent: 'center',
alignItems: 'center',
paddingTop: 15
}}
onSwipe={() => this.setState({ isModalVisible: false })}
swipeDirection="down"
swipeThreshold={200}
>
<VideoPlayer
videoProps={{
shouldPlay: true,
resizeMode: Video.RESIZE_MODE_CONTAIN,
isMuted: false,
source: {
uri: 'http://d23dyxeqlo5psv.cloudfront.net/big_buck_bunny.mp4',
},
}}
isPortrait
playFromPositionMillis={0}
showFullscreenButton
//switchToLandscape={() => ScreenOrientation.allow(ScreenOrientation.Orientation.LANDSCAPE)}
//switchToPortrait={() => ScreenOrientation.allow(ScreenOrientation.Orientation.PORTRAIT)}
/>
<Text>{this.state.name}</Text>
</Modal>
</TouchableOpacity>
</View>
);
}
}
}