Don’t know why NAVIGATE can’t find screen named ‘ChatList’. See code:
NewChatScreen.js
const userPressed = (userId) => {
props.navigation.navigate("ChatList", {
selectedUserId: userId,
});
};
{!isLoading && !noResultsFound && users && (
<FlatList
data={Object.keys(users)}
renderItem={(itemData) => {
const userId = itemData.item;
const userData = users[userId];
return (
<DataItem
title={`${userData.firstName} ${userData.lastName}`}
subTitle={userData.about}
image={userData.profilePicture}
onPress={() => userPressed(userId)}
/>
);
}}
/>
)}
MainNavigator.js
const Tab = createBottomTabNavigator();
const TabNavigator = () => {
return (
<Tab.Navigator
screenOptions={{
headerTitle: "",
headerShadowVisible: false,
}}
>
<Tab.Screen
name="ChatList"
component={ChatListScreen}
options={{
tabBarLabel: "Czaty",
tabBarIcon: ({ color, size }) => (
<Ionicons name="chatbubble-outline" size={size} color={color} />
),
}}
/>
</Tab.Navigator>
);
};
DataItem.js
<TouchableWithoutFeedback onPress={props.onPress}>
This should move me to new chat screen user I clicked. Why it can’t see ‘ChatList’ screen? Function ‘userPressed’ is needed as I want to have ‘userId’ on this press.
New contributor
Obibok is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
2