qiuxiang / react-native-amap3d

react-native 高德地图组件,使用最新 3D SDK,支持 Android + iOS
https://qiuxiang.github.io/react-native-amap3d/api/
MIT License
1.28k stars 328 forks source link

android平台 react-navigation tab之内的导航没问题,tab之外使用MapView导航返回,直接返回到桌面了 #831

Open Astronomy-fhh opened 1 month ago

Astronomy-fhh commented 1 month ago

以下是个简化后的例子,Map2里有MapView

从Feed里跳转到Map2,正常

重点:从Map2返回,直接返回到桌面了,不会返回到Feed

如果删除掉Map2里的MapView,从Map2返回到Feed就正常了

求解答,困扰很久了,实在不知道从哪入手


function Feed({ navigation }) {
  return (
    <View style={styles.container}>
      <Text>Feed Screen</Text>
      <Button
        title="Go to Map2"
        onPress={() => navigation.navigate('Map2')}
      />
    </View>
  );
}

function Home() {
  return (
    <Tab.Navigator>
      <Tab.Screen name="Feed" component={Feed} />
      <Tab.Screen name="Search" component={Search} />
    </Tab.Navigator>
  );
}

function Route() {
  return (
    <NavigationContainer>
      <Stack.Navigator>
        <Stack.Screen
          name="Home"
          component={Home}
          options={{headerShown: false}}
        />
        <Stack.Screen name="Map2" component={Map2} />
        <Stack.Screen name="Settings" component={Settings} />
      </Stack.Navigator>
    </NavigationContainer>
  );
}
Keizai commented 1 month ago

可能是crash了

Keizai commented 1 month ago

try this https://github.com/qiuxiang/react-native-amap3d/issues/821#issuecomment-2118813968