forked from atef-najar/react-native-shop-ui
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathImageGallery.js
54 lines (48 loc) · 1.17 KB
/
ImageGallery.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
/**
* This is the Main file
**/
// React native and others libraries imports
import React, { Component } from 'react';
import { View, Icon } from 'native-base';
import Gallery from 'react-native-image-gallery';
import { Actions } from 'react-native-router-flux';
// Our custom files and classes import
import Text from '../component/Text';
export default class ImageGallery extends Component {
constructor(props) {
super(props);
this.state = {
images: []
};
}
componentWillMount() {
let imgs = [];
this.props.images.map((img) => {
imgs.push({source: {uri: img}})
});
this.setState({images: imgs});
}
render() {
return (
<View style={{flex: 1, backgroundColor: 'black'}}>
<Gallery
initialPage={this.props.position ? this.props.position : 0}
style={{flex: 1, backgroundColor: 'black'}}
images={this.state.images}
/>
<Icon name="ios-close" style={styles.icon} onPress={() => Actions.pop()} />
</View>
);
}
}
const styles = {
icon: {
color: 'white',
fontSize: 46,
position: 'absolute',
top: 15,
left: 15,
width: 40,
height: 40
}
};