Skip to content

Commit

Permalink
refactor: example (#98)
Browse files Browse the repository at this point in the history
  • Loading branch information
duguyihou authored Apr 7, 2024
1 parent 7b763ec commit 10e3b1b
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions example/src/screens/CacheScreen.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { FlatList } from 'react-native';
import { Dimensions, FlatList } from 'react-native';
import React from 'react';
import { type CachePolicy } from 'react-native-turbo-image';
import Card from '../components/Card';

const images = [
{
title: 'shared',
title: 'memory',
url: 'https://placedog.net/300/300?id=235',
cachePolicy: 'dataCache',
cachePolicy: 'memory',
},
{
title: 'dataCache',
Expand All @@ -21,15 +21,18 @@ const images = [
},
];

const size = Dimensions.get('window').width / 2 - 2;

const CacheScreen = () => {
return (
<FlatList
data={images}
numColumns={2}
renderItem={({ item }) => (
<Card
title={item.title}
url={item.url}
size={200}
size={size}
cachePolicy={item.cachePolicy as CachePolicy}
/>
)}
Expand Down

0 comments on commit 10e3b1b

Please sign in to comment.