-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(placeholder): add memoryCacheKey (#325)
* feat(placeholder): add memoryCacheKey for Android * feat(placeholder): add memoryCacheKey for iOS
- Loading branch information
Showing
9 changed files
with
114 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
import { Linking, Pressable, StyleSheet, Text, View } from 'react-native'; | ||
import React from 'react'; | ||
import TurboImage from 'react-native-turbo-image'; | ||
import { useRoute } from '@react-navigation/native'; | ||
import type { HomeRouteType, RouteName } from './routes.type'; | ||
|
||
const DetailScreen = () => { | ||
const { | ||
params: { memoryCacheKey }, | ||
} = useRoute<HomeRouteType<RouteName.Detail>>(); | ||
|
||
const handlePress = () => { | ||
Linking.openURL( | ||
'https://coil-kt.github.io/coil/recipes/#using-a-memory-cache-key-as-a-placeholder' | ||
); | ||
}; | ||
return ( | ||
<View style={styles.container}> | ||
<TurboImage | ||
source={{ uri: 'https://placedog.net/400/400?id=121' }} | ||
placeholder={{ memoryCacheKey }} | ||
style={styles.image} | ||
/> | ||
<Text style={styles.text}> | ||
use the image which is cached in memory as placholder | ||
</Text> | ||
<Pressable onPress={handlePress}> | ||
<Text style={styles.link}>reference</Text> | ||
</Pressable> | ||
</View> | ||
); | ||
}; | ||
|
||
export default DetailScreen; | ||
|
||
const styles = StyleSheet.create({ | ||
container: { | ||
justifyContent: 'center', | ||
alignItems: 'center', | ||
}, | ||
image: { | ||
width: 400, | ||
height: 400, | ||
}, | ||
text: { | ||
fontSize: 18, | ||
}, | ||
link: { | ||
fontSize: 18, | ||
color: 'blue', | ||
}, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters