首次导航后的 Expo 路由器导航问题

Expo Router Navigation problem after first navigation

提问人:Berkay Doğukan Urhan 提问时间:11/17/2023 最后编辑:Berkay Doğukan Urhan 更新时间:11/17/2023 访问量:27

问:

我有一个世博会应用程序,有和路线。打开应用程序时,我可以导航其中一个,但之后导航出现问题。profileprofile/[id]

当我尝试再次导航其中一条路线时,它不起作用并且没有错误。

(tabs)/_layout.jsx

   <Tabs
      initialRouteName="index"
    >
      <Tabs.Screen
        name="index"
      />

      <Tabs.Screen
        name="post"
        options={{
          unmountOnBlur: true,
        }}
      />

      <Tabs.Screen
        name="profile"
        listeners={() => ({
          tabPress: (e) => {
            e.preventDefault();
            navigation.navigate("profile", {
              screen: "index",
              initial: false,
            });
          },
        })}
      />
      
    </Tabs>

(tabs)/profile/_layout.jsx

 <Stack
      screenOptions={{
        headerShown: false,
        contentStyle: {
          backgroundColor: themeColors.backgroundColor,
        },
      }}
      initialRouteName="index"
    />
  <Link
        href={
          user?.id === userId
            ? {
                pathname: "/profile",
              }
            : {
                pathname: "/profile/[id]",
                params: { id: userId },
              }
        }
        asChild
      >

应用结构

我尝试使用 useNavigation、useRouter 进行导航并将 unMountOnBlur 设置为 true。然后我发现导航到已经挂载了一次页面的问题

JavaScript React-Native 博览会

评论


答: 暂无答案