Tôi có danh sách người dùng, mỗi người dùng có hình ảnh hiển thị trong danh sách.sử dụng Custom Tabs với StackNavigator?
Điều tôi đang cố gắng là bất cứ khi nào người dùng nhấn vào hình ảnh hiển thị, được chuyển hướng đến tiểu sử của họ thông qua stackNavigation.
CustomTabView:
const CustomTabView = ({ router, navigation }) => {
const { routes, index } = navigation.state;
const ActiveScreen = router.getComponentForState(navigation.state);
const routeNav = addNavigationHelpers({
...navigation,
state: routes[index],
});
const routeOptions = router.getScreenOptions(routeNav, 'tabBar');
return (
<View style={styles.container}>
<CustomTabBar
navigation={navigation}
activeRouteName={routes[index].routeName}
icon={routeOptions.tabBarIcon}
/>
<ActiveScreen
navigation={addNavigationHelpers({
...navigation,
state: routes[index]
})}
/>
</View>
);
};
StackNavigator: // goToProfile.js // cũng đã cố gắng đặt trong index.anndroid.js nhưng didnt tìm thấy một cách để xuất khẩu
const goToProfile = StackNavigator({
Profile: {
screen: Profile,
navigationOptions: ({ navigation }) => ({
title: `${navigation.state.params.person.name.first} ${navigation.state.params.person.name.last}`
})
},
})
tab tùy chỉnh: //index.android.js
const CustomTabRouter = TabRouter(
{
Chat: {
screen: Chats,
path: ""
},
Status: {
screen: Contacts,
path: "notifications"
},
Camera: {
screen: Camera,
path: "settings"
}
},
{
initialRouteName: "Chat",
},
);
const CustomTabs = createNavigationContainer(
createNavigator(CustomTabRouter)(CustomTabView)
);
Ngoài ra thành phần của tôi:
<TouchableOpacity
onPress = {() => this.props.navigation.navigate('Profile', { item }) } >
<Avatar
source={{ uri: item.picture.thumbnail }}
/>
</TouchableOpacity>
vấn đề là gì? – Cruiser
@Cruiser làm thế nào để sử dụng stacknavigator trong màn hình trò chuyện của tôi để đạt được rằng –
SO không phải là một dịch vụ viết mã. Tôi đề nghị bạn thực hiện một nỗ lực và đặt câu hỏi khi bạn bị kẹt, gặp lỗi hoặc gặp sự cố – Cruiser