React native 物料顶部选项卡导航器中的异步存储访问
我想在用户登录系统时更改用户配置文件pic。用户avator位于“材质”选项卡导航器的左侧角。当用户登录到系统时,我将图像url存储在AsyncStorage中为profilePic 我想访问AsyncStorage并在这里获取配置文件图片React native 物料顶部选项卡导航器中的异步存储访问,react-native,react-native-navigation,asyncstorage,react-native-tabnavigator,React Native,React Native Navigation,Asyncstorage,React Native Tabnavigator,我想在用户登录系统时更改用户配置文件pic。用户avator位于“材质”选项卡导航器的左侧角。当用户登录到系统时,我将图像url存储在AsyncStorage中为profilePic 我想访问AsyncStorage并在这里获取配置文件图片 <Image source={{ uri: 'https://cdn.apparelconnects.com/users_2_a34456c8-6d69-4b80-9
<Image
source={{
uri:
'https://cdn.apparelconnects.com/users_2_a34456c8-6d69-4b80-98f2-d184ff9f504d_img.png',
}}
(
),
},
},
主页:{
屏幕:主页,
导航选项:{
标题:"家",,
tabBarIcon:({tintColor})=>(
),
},
},
{
initialRouteName:“主页”,
activeColor:“#f0edf6”,
不活动颜色:“#3e2465”,
barStyle:{背景色:'#694fad'},
Tabbar位置:“顶部”,
是的,
懒惰:是的,
选项卡选项:{
showIcon:没错,
showLabel:false,
activeTintColor:colors.orange,
InactiveIntColor:“#a1a1a1”,
风格:{
背景颜色:“#ffffff”,
高度:马力(10%),
},
标签样式:{
textAlign:'中心',
fontWeight:'粗体',
},
指标类型:{
背景色:“透明”,
},
},
defaultNavigationOptions:({navigation})=>({
tabBarOnPress:({navigation,defaultHandler})=>{
如果(
navigation.state.routeName==='Profile'||
navigation.state.routeName===“更多”
) {
返回null;
}
defaultHandler();
},
}),
},
);
导出默认createAppContainer(TabNavigator);
const TabNavigator = createMaterialTopTabNavigator(
{
Profile: {
screen: Logout,
navigationOptions: {
title: 'Home',
tabBarIcon: ({tintColor}) => (
<Image
source={{
uri:
'https://cdn.apparelconnects.com/users_2_a34456c8-6d69-4b80-98f2-d184ff9f504d_img.png',
}}
style={{
width: tabBarConfiguration.icon_size,
height: tabBarConfiguration.icon_size,
borderRadius: 40 / 2,
overflow: 'hidden',
borderWidth: tintColor == colors.orange ? 2 : 0,
borderColor: tintColor,
}}
/>
),
},
},
Home: {
screen: Home,
navigationOptions: {
title: 'Home',
tabBarIcon: ({tintColor}) => (
<Image
source={require('../asserts/images/home_icon.png')}
style={{
width: tabBarConfiguration.icon_size,
height: tabBarConfiguration.icon_size,
tintColor: tintColor,
}}
/>
),
},
},
{
initialRouteName: 'Home',
activeColor: '#f0edf6',
inactiveColor: '#3e2465',
barStyle: {backgroundColor: '#694fad'},
tabBarPosition: 'top',
swipeEnabled: true,
lazy: true,
tabBarOptions: {
showIcon: true,
showLabel: false,
activeTintColor: colors.orange,
inactiveTintColor: '#a1a1a1',
style: {
backgroundColor: '#ffffff',
height: hp('10%'),
},
labelStyle: {
textAlign: 'center',
fontWeight: 'bold',
},
indicatorStyle: {
backgroundColor: 'transparent',
},
},
defaultNavigationOptions: ({navigation}) => ({
tabBarOnPress: ({navigation, defaultHandler}) => {
if (
navigation.state.routeName === 'Profile' ||
navigation.state.routeName === 'More'
) {
return null;
}
defaultHandler();
},
}),
},
);
export default createAppContainer(TabNavigator);