add emoji list

This commit is contained in:
Hailey
2024-02-13 11:30:11 -08:00
parent ef83101418
commit f553377e94
+34 -2
View File
@@ -68,6 +68,7 @@ export function StepProfile() {
<View style={[a.pt_5xl, a.gap_3xl]}> <View style={[a.pt_5xl, a.gap_3xl]}>
<Items type="colors" /> <Items type="colors" />
<Items type="emojis" />
</View> </View>
<OnboardingControls.Portal> <OnboardingControls.Portal>
@@ -117,6 +118,14 @@ function AvatarCircle({
const colors = ['image', 'red', 'blue', 'green', 'orange'] as const const colors = ['image', 'red', 'blue', 'green', 'orange'] as const
type Color = (typeof colors)[number] type Color = (typeof colors)[number]
const emojis = ['smile', 'frown', 'eyes'] as const
type Emoji = (typeof emojis)[number]
const emojiItems: Record<Emoji, string> = {
smile: '😊',
frown: '☹️',
eyes: '👀',
}
function ColorItem({color}: {color: Color}) { function ColorItem({color}: {color: Color}) {
if (color === 'image') return null if (color === 'image') return null
@@ -134,9 +143,22 @@ function colorRenderItem({item}: ListRenderItemInfo<Color>) {
return <ColorItem color={item} /> return <ColorItem color={item} />
} }
function Items({type}: {type: 'icons' | 'colors'}) { function EmojiItem({emoji}: {emoji: Emoji}) {
return ( return (
<FlatList <View style={[styles.imageContainer, styles.paletteContainer]}>
<Text>{emojiItems[emoji]}</Text>
</View>
)
}
function emojiRenderItem({item}: ListRenderItemInfo<Emoji>) {
return <EmojiItem emoji={item} />
}
function Items({type}: {type: 'emojis' | 'colors'}) {
if (type === 'colors') {
return (
<FlatList<Color>
style={{height: 100}}
data={colors} data={colors}
renderItem={colorRenderItem} renderItem={colorRenderItem}
horizontal horizontal
@@ -145,6 +167,16 @@ function Items({type}: {type: 'icons' | 'colors'}) {
) )
} }
return (
<FlatList<Emoji>
data={emojis}
renderItem={emojiRenderItem}
horizontal
contentContainerStyle={styles.flatListContainer}
/>
)
}
const styles = StyleSheet.create({ const styles = StyleSheet.create({
imageContainer: { imageContainer: {
borderRadius: 100, borderRadius: 100,