I dont have any errors but I still cant open screen that I want. I find out and I think I need navigation but I dont know how to implement it. Here is my FlatList item:
let categories = [ { screenName : Player, name : "Category 1", img : require("../Assets/Slika.jpg"), },
Here is TouchableOpacity with onPress
return (<View style={styles.container}><FlatList data={categories} showsHorizontalScrollIndicator={false} numColumns={categories.length / 5} showsVerticalScrollIndicator={false} keyExtractor={(item, index) => index.toString()} renderItem = {({item, index}) => { return (<TouchableOpacity onPress={() => item.screenName}><Surface style={styles.surface}><ImageBackground source={item.img} style={styles.img} blurRadius={0.5}><Icon name="music" color="#fff" size={22}/><Text style={styles.name}>{item.name}</Text></ImageBackground></Surface></TouchableOpacity> ); }} /></View>
Here is some code for function I get:
import { useNavigation } from '@react-navigation/native';...export default function ClassName() {const navigation = useNavigation();function navigateTO(pageName) { navigation.navigate(pageName);}<TouchableOpacity onPress={navigateTO(item.screenName})>