Reactjs 无法删除react导航中的现有参数
我正在为我的expo应用程序使用react navigation v4。对于我的应用程序,我正在使用Reactjs 无法删除react导航中的现有参数,reactjs,react-native,react-navigation,react-native-web,react-navigation-drawer,Reactjs,React Native,React Navigation,React Native Web,React Navigation Drawer,我正在为我的expo应用程序使用react navigation v4。对于我的应用程序,我正在使用createDrawerNavigator和createSwitchNavigator与createAppContainer和createBrowserApp用于web。 我的问题是,当我导航到一个不需要参数的路径时,它也会向我传递参数。像 http://localhost:19006/App/SkyView (首先,我参观了这条路线,但没有参观 参数) http://localhost:1900
createDrawerNavigator
和createSwitchNavigator
与createAppContainer和createBrowserApp用于web。我的问题是,当我导航到一个不需要参数的路径时,它也会向我传递参数。像 http://localhost:19006/App/SkyView (首先,我参观了这条路线,但没有参观 参数) http://localhost:19006/App/CasesList (我参观了另一条路线,从 在那里,我将参数传递到SkyView路由)
它把我引向http://localhost:19006/App/SkyView?caseId=HYDE200627-00064&tripIndex=0
之后如果我想参观http://localhost:19006/App/SkyView 它导航到http://localhost:19006/App/SkyView?caseId=HYDE200627-00064&tripIndex=0 我的抽屉管理员代码
const DrawerNavigation = createDrawerNavigator({
CasesList: {
screen: MainAuth(CasesList),
navigationOptions: {
drawerIcon: ({ tintColor }) => (<FontAwesome5 name='map-marked-alt' size={18} style={{color:tintColor}}/>)
}
},
SkyView: {
screen: MainAuth(SkyView),
navigationOptions: {
drawerIcon: ({ tintColor }) => (<FontAwesome5 name='map-marked-alt' size={18} style={{color:tintColor}}/>)
}
},
},{contentComponent: props => <CustomDrawerContentComponent {...props}/>,contentOptions: {
activeTintColor: baseColor,
itemsContainerStyle: {
marginVertical: 0,
},
iconContainerStyle: {
opacity: 1
}
}})
const CustomDrawerContentComponent = props => {
const signOutAsync = async () => {
try {
store.dispatch(logoutHandler())
props.navigation.navigate('Auth');
}
catch(exception) {
console.log(exception)
}
};
return (
<ScrollView contentContainerStyle={styles.container}>
<SafeAreaView
forceInset={{ top: 'always', horizontal: 'never' }}
>
<View style={styles.header}>
<View style={styles.avatar}>
<FontAwesome5 name="user-alt" size={24} style={{color:white}}/>
</View>
<View style={styles.userInfo}>
<Text style={{}}>Abdulla Zulqarnain</Text>
</View>
</View>
<DrawerItems {...props} />
</SafeAreaView>
<TouchableOpacity onPress={()=>signOutAsync()}>
<View style={styles.item}>
<View style={styles.iconContainer}>
<FontAwesome5 name='sign-out-alt' size={18} style={{color:red_dark}}/>
</View>
<Text style={styles.label}>Logout</Text>
</View>
</TouchableOpacity>
</ScrollView>
);
}
const routes = createSwitchNavigator(
{
AuthLoading: {
screen: AuthLoadingScreen,
navigationOptions: {
header: null,
}
},
App: {
screen: DrawerNavigation,//MainAuth(CasesList),
navigationOptions: {
header: null,
}
},
Auth:{
screen: Login,
navigationOptions: {
tabBarVisible: false,
header: null,
},
},
HospitalList: {
screen: HospitalList,
navigationOptions: {
header: null,
}
},
},
{
initialRouteName: 'AuthLoading',
defaultNavigationOptions: {
}
}
);
const container = isWeb ? createBrowserApp(routes): createAppContainer(routes);
我被困了两天,谁能帮我解决这个问题