mirror of
https://github.com/status-im/react-native-fast-image.git
synced 2026-08-31 13:51:10 +00:00
Add resizeMode examples and refactor.
This commit is contained in:
@@ -8,6 +8,7 @@ import BorderRadiusExample from './BorderRadiusExample'
|
||||
import FeatureText from './FeatureText'
|
||||
import ProgressExample from './ProgressExample'
|
||||
import PreloadExample from './PreloadExample'
|
||||
import ResizeModeExample from './ResizeModeExample'
|
||||
import StatusBarUnderlay, { STATUS_BAR_HEIGHT } from './StatusBarUnderlay'
|
||||
|
||||
const FastImageExample = () => (
|
||||
@@ -31,6 +32,7 @@ const FastImageExample = () => (
|
||||
<BorderRadiusExample />
|
||||
<ProgressExample />
|
||||
<PreloadExample />
|
||||
<ResizeModeExample />
|
||||
</View>
|
||||
</ScrollView>
|
||||
<StatusBarUnderlay />
|
||||
|
||||
@@ -0,0 +1,51 @@
|
||||
import React from 'react'
|
||||
import { StyleSheet, View } from 'react-native'
|
||||
import withCacheBust from './withCacheBust'
|
||||
import SectionFlex from './SectionFlex'
|
||||
import FastImage from 'react-native-fast-image'
|
||||
import Section from './Section'
|
||||
import FeatureText from './FeatureText'
|
||||
|
||||
const IMAGE_URL = 'https://media.giphy.com/media/GEsoqZDGVoisw/giphy.gif'
|
||||
|
||||
const BorderRadiusExample = ({ onPressReload, bust }) => (
|
||||
<View>
|
||||
<Section>
|
||||
<FeatureText text="• resizeMode." />
|
||||
</Section>
|
||||
<SectionFlex onPress={onPressReload}>
|
||||
<FastImage
|
||||
style={styles.image}
|
||||
resizeMode={FastImage.resizeMode.contain}
|
||||
source={{ uri: IMAGE_URL }}
|
||||
/>
|
||||
<FastImage
|
||||
style={styles.image}
|
||||
resizeMode={FastImage.resizeMode.center}
|
||||
source={{ uri: IMAGE_URL }}
|
||||
/>
|
||||
<FastImage
|
||||
style={styles.image}
|
||||
resizeMode={FastImage.resizeMode.stretch}
|
||||
source={{ uri: IMAGE_URL }}
|
||||
/>
|
||||
<FastImage
|
||||
style={styles.image}
|
||||
resizeMode={FastImage.resizeMode.cover}
|
||||
source={{ uri: IMAGE_URL }}
|
||||
/>
|
||||
</SectionFlex>
|
||||
</View>
|
||||
)
|
||||
|
||||
const styles = StyleSheet.create({
|
||||
image: {
|
||||
height: 100,
|
||||
width: 50,
|
||||
backgroundColor: '#ddd',
|
||||
margin: 5,
|
||||
flex: 0,
|
||||
},
|
||||
})
|
||||
|
||||
export default withCacheBust(BorderRadiusExample)
|
||||
Reference in New Issue
Block a user