@@ -6,11 +6,24 @@ import FastImage from 'react-native-fast-image'
66import timeout from 'react-timeout'
77import uuid from 'uuid/v4'
88
9- const baseUrl = '192.168.2.11'
10- const image1 = `http://${ baseUrl } :8080/pictures/ahmed-saffu-235616.jpg`
11- const image2 = `http://${ baseUrl } :8080/pictures/alex-bertha-236361.jpg`
12- const image3 = `http://${ baseUrl } :8080/pictures/jaromir-kavan-233699.jpg`
9+ const getImageUrl = ( id , width , height ) =>
10+ `https://source.unsplash.com/${ id } /${ width } x${ height } `
11+ let IMAGE_1
12+ let IMAGE_2
13+ let IMAGE_3
14+ const IMAGE_SIZE = 150
15+ const USE_SERVER = false
1316const token = 'someToken'
17+ if ( USE_SERVER ) {
18+ const baseUrl = '192.168.2.11'
19+ IMAGE_1 = `http://${ baseUrl } :8080/pictures/ahmed-saffu-235616.jpg`
20+ IMAGE_2 = `http://${ baseUrl } :8080/pictures/alex-bertha-236361.jpg`
21+ IMAGE_3 = `http://${ baseUrl } :8080/pictures/jaromir-kavan-233699.jpg`
22+ } else {
23+ IMAGE_1 = getImageUrl ( 'x58soEovG_M' , IMAGE_SIZE , IMAGE_SIZE )
24+ IMAGE_2 = getImageUrl ( 'yPI7myL5eWY' , IMAGE_SIZE , IMAGE_SIZE )
25+ IMAGE_3 = getImageUrl ( 'S7VCcp6KCKE' , IMAGE_SIZE , IMAGE_SIZE )
26+ }
1427
1528class FastImageExample extends Component {
1629 componentDidMount ( ) {
@@ -44,7 +57,7 @@ class FastImageExample extends Component {
4457 < FastImage
4558 style = { styles . image }
4659 source = { {
47- uri : image1 + bust ,
60+ uri : IMAGE_1 + bust ,
4861 headers : {
4962 token,
5063 } ,
@@ -54,7 +67,7 @@ class FastImageExample extends Component {
5467 < FastImage
5568 style = { styles . image }
5669 source = { {
57- uri : image2 + bust ,
70+ uri : IMAGE_2 + bust ,
5871 headers : {
5972 token,
6073 } ,
@@ -64,7 +77,7 @@ class FastImageExample extends Component {
6477 < FastImage
6578 style = { styles . image }
6679 source = { {
67- uri : image3 + bust ,
80+ uri : IMAGE_3 + bust ,
6881 headers : {
6982 token,
7083 } ,
@@ -90,8 +103,6 @@ FastImageExample.navigationOptions = {
90103 } ,
91104}
92105
93- const IMAGE_SIZE = 150
94-
95106const styles = StyleSheet . create ( {
96107 bold : {
97108 fontWeight : '900' ,
0 commit comments