Skip to content

Commit ce1334c

Browse files
committed
feat: add flashlist
chore: format code
1 parent f160889 commit ce1334c

3 files changed

Lines changed: 8 additions & 22 deletions

File tree

bun.lockb

1.87 KB
Binary file not shown.

components/EmojiList.tsx

Lines changed: 5 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1+
import { FlashList } from "@shopify/flash-list";
12
import { useState } from "react";
2-
import { FlatList, Image, Platform, Pressable, StyleSheet } from "react-native";
3+
import { Image, Platform, Pressable } from "react-native";
34

45
export default function EmojiList({ onSelect, onCloseModal }) {
56
const [emoji] = useState([
@@ -12,11 +13,11 @@ export default function EmojiList({ onSelect, onCloseModal }) {
1213
]);
1314

1415
return (
15-
<FlatList
16+
<FlashList
1617
horizontal
18+
estimatedItemSize={112}
1719
showsHorizontalScrollIndicator={Platform.OS === "web"}
1820
data={emoji}
19-
contentContainerStyle={styles.listContainer}
2021
renderItem={({ item, index }) => {
2122
return (
2223
<Pressable
@@ -25,26 +26,10 @@ export default function EmojiList({ onSelect, onCloseModal }) {
2526
onCloseModal();
2627
}}
2728
>
28-
<Image source={item} key={index} style={styles.image} />
29+
<Image source={item} key={index} className="mr-5 w-28 h-28" />
2930
</Pressable>
3031
);
3132
}}
3233
/>
3334
);
3435
}
35-
36-
const styles = StyleSheet.create({
37-
listContainer: {
38-
borderTopRightRadius: 10,
39-
borderTopLeftRadius: 10,
40-
paddingHorizontal: 20,
41-
flexDirection: "row",
42-
alignItems: "center",
43-
justifyContent: "space-between",
44-
},
45-
image: {
46-
width: 100,
47-
height: 100,
48-
marginRight: 20,
49-
},
50-
});

package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
"dependencies": {
1919
"@expo/vector-icons": "^13.0.0",
2020
"@expo/webpack-config": "^19.0.0",
21+
"@shopify/flash-list": "1.6.3",
2122
"@types/react": "~18.2.46",
2223
"dom-to-image": "^2.6.0",
2324
"expo": "next",
@@ -33,11 +34,11 @@
3334
"react-dom": "18.2.0",
3435
"react-native": "0.73.1",
3536
"react-native-gesture-handler": "~2.14.0",
36-
"react-native-reanimated": "~3.6.0",
37+
"react-native-reanimated": "~3.6.1",
3738
"react-native-safe-area-context": "4.7.4",
3839
"react-native-screens": "~3.27.0",
3940
"react-native-view-shot": "3.8.0",
40-
"react-native-web": "~0.19.6"
41+
"react-native-web": "~0.19.10"
4142
},
4243
"devDependencies": {
4344
"@babel/core": "^7.23.7",

0 commit comments

Comments
 (0)