Skip to content

Commit 60511af

Browse files
committed
Fix example margins and add labels to resizeMode example.
1 parent bb1f329 commit 60511af

File tree

5 files changed

+52
-28
lines changed

5 files changed

+52
-28
lines changed

ReactNativeFastImageExample/src/Button.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ const Button = ({ text, onPress }) => (
1212
const styles = StyleSheet.create({
1313
button: {
1414
backgroundColor: 'black',
15-
margin: 5,
15+
margin: 10,
1616
height: 44,
1717
paddingLeft: 10,
1818
paddingRight: 10,

ReactNativeFastImageExample/src/GifExample.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ const GifExample = ({ onPressReload, bust }) => (
2323
const styles = StyleSheet.create({
2424
image: {
2525
backgroundColor: '#ddd',
26-
margin: 10,
26+
margin: 20,
2727
height: 100,
2828
width: 100,
2929
flex: 0,

ReactNativeFastImageExample/src/PreloadExample.js

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,7 @@ class PreloadExample extends Component {
5757
) : (
5858
<View style={styles.image} />
5959
)}
60-
<View
61-
style={{ flexDirection: 'row', marginHorizontal: 10 }}
62-
>
60+
<View style={styles.buttons}>
6361
<View style={{ flex: 1 }}>
6462
<Button text="Bust" onPress={this.bustCache} />
6563
</View>
@@ -81,9 +79,15 @@ const styles = StyleSheet.create({
8179
flexDirection: 'column',
8280
alignItems: 'center',
8381
},
82+
buttons: {
83+
flexDirection: 'row',
84+
marginHorizontal: 20,
85+
marginBottom: 10,
86+
},
8487
image: {
8588
backgroundColor: '#ddd',
86-
margin: 10,
89+
margin: 20,
90+
marginBottom: 10,
8791
height: 100,
8892
width: 100,
8993
},

ReactNativeFastImageExample/src/PriorityExample.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ const styles = StyleSheet.create({
5353
height: 100,
5454
backgroundColor: '#ddd',
5555
margin: 10,
56+
marginVertical: 20,
5657
},
5758
})
5859

Lines changed: 41 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import React from 'react'
2-
import { StyleSheet, View } from 'react-native'
2+
import { StyleSheet, View, Text } from 'react-native'
33
import withCacheBust from './withCacheBust'
44
import SectionFlex from './SectionFlex'
55
import FastImage from 'react-native-fast-image'
@@ -8,32 +8,46 @@ import FeatureText from './FeatureText'
88

99
const IMAGE_URL = 'https://media.giphy.com/media/GEsoqZDGVoisw/giphy.gif'
1010

11+
const Label = ({ children }) => <Text style={styles.text}>{children}</Text>
12+
1113
const BorderRadiusExample = ({ onPressReload, bust }) => (
1214
<View>
1315
<Section>
1416
<FeatureText text="• resizeMode." />
1517
</Section>
1618
<SectionFlex onPress={onPressReload}>
17-
<FastImage
18-
style={styles.image}
19-
resizeMode={FastImage.resizeMode.contain}
20-
source={{ uri: IMAGE_URL }}
21-
/>
22-
<FastImage
23-
style={styles.image}
24-
resizeMode={FastImage.resizeMode.center}
25-
source={{ uri: IMAGE_URL }}
26-
/>
27-
<FastImage
28-
style={styles.image}
29-
resizeMode={FastImage.resizeMode.stretch}
30-
source={{ uri: IMAGE_URL }}
31-
/>
32-
<FastImage
33-
style={styles.image}
34-
resizeMode={FastImage.resizeMode.cover}
35-
source={{ uri: IMAGE_URL }}
36-
/>
19+
<View>
20+
<FastImage
21+
style={styles.image}
22+
resizeMode={FastImage.resizeMode.contain}
23+
source={{ uri: IMAGE_URL }}
24+
/>
25+
<Label>contain</Label>
26+
</View>
27+
<View>
28+
<FastImage
29+
style={styles.image}
30+
resizeMode={FastImage.resizeMode.center}
31+
source={{ uri: IMAGE_URL }}
32+
/>
33+
<Label>center</Label>
34+
</View>
35+
<View>
36+
<FastImage
37+
style={styles.image}
38+
resizeMode={FastImage.resizeMode.stretch}
39+
source={{ uri: IMAGE_URL }}
40+
/>
41+
<Label>stretch</Label>
42+
</View>
43+
<View>
44+
<FastImage
45+
style={styles.image}
46+
resizeMode={FastImage.resizeMode.cover}
47+
source={{ uri: IMAGE_URL }}
48+
/>
49+
<Label>cover</Label>
50+
</View>
3751
</SectionFlex>
3852
</View>
3953
)
@@ -43,9 +57,14 @@ const styles = StyleSheet.create({
4357
height: 100,
4458
width: 50,
4559
backgroundColor: '#ddd',
46-
margin: 5,
60+
margin: 20,
61+
marginBottom: 10,
4762
flex: 0,
4863
},
64+
text: {
65+
textAlign: 'center',
66+
marginBottom: 20,
67+
},
4968
})
5069

5170
export default withCacheBust(BorderRadiusExample)

0 commit comments

Comments
 (0)