Компонент монтируется, но ничто не визуально < /p>
Эта проблема происходит только тогда, когда Scrollview - горизонтальный < /p>
import React, { useEffect } from "react";
import { View, Text, SafeAreaView, StyleSheet, TextStyle, ScrollView, TouchableOpacity } from "react-native";
import emojiList from 'emoji.json';
const emojiMap: Record = {
Birthday: 'party popper',
Bridal: 'bouquet',
Halloween: 'jack-o-lantern',
'Book Day': 'open book',
Engaged: 'ring',
'Dad': 'necktie',
Graduate: 'graduation cap',
'Mum': 'red heart',
'New Born': 'baby bottle',
Religious: 'crescent moon',
Wedding: 'love letter',
};
type EmojiItem = { name: string; char: string };
function getEmoji(label: string) {
const name = emojiMap[label];
if (!name) return '
const found = (emojiList as EmojiItem[]).find(e => e.name.toLowerCase() === name.toLowerCase());
return found ? found.char : '
}
export default function Categories(){
useEffect(() => {
categories.forEach(label => {
console.log(`${label}:`, getEmoji(label));
});
}, [])
const categories = Object.keys(emojiMap);
return (
Explore by Theme
{/* View All */}
{categories.map((label: string) => (
{getEmoji(label)}
{label}
))}
)
}
const styles = StyleSheet.create({
subTitleContainer: {
flexDirection: "row",
justifyContent: "space-between",
marginTop: 20,
marginLeft: 15,
marginRight: 25,
alignItems: "center",
},
categoryContainer: {
alignItems: "center",
marginTop: 25,
marginHorizontal: 4,
width: 85,
},
categoryPill: {
flexDirection: 'row',
alignItems: 'center',
backgroundColor: '#f65c3b',
borderRadius: 25,
paddingVertical: 6,
paddingHorizontal: 12,
marginTop: 25,
marginHorizontal: 6,
minWidth: 120,
},
categoryIconContainer: {
width: 40,
height: 40,
borderRadius: 20,
backgroundColor: '#fff',
alignItems: 'center',
justifyContent: 'center',
marginRight: 8,
},
emoji: {
fontSize: 20,
textAlign: 'center',
},
categoryLabel: {
fontSize: 14,
fontFamily: 'Lexend-SemiBold',
color: '#FFFFFF',
flex: 1,
}
});
Подробнее здесь: https://stackoverflow.com/questions/797 ... isappeared