i18n-chain icon indicating copy to clipboard operation
i18n-chain copied to clipboard

在 react navigation 中使用时报错:Should have a queue

Open xyxc0673 opened this issue 3 years ago • 1 comments

WechatIMG10.jpeg

代码片段

const ApplicationNavigations = () => {
  const chain = i18n.use();

  return (
    <SafeAreaView style={styles.container}>
      <NavigationContainer theme={defaultTheme} ref={navigationRef}>
        <Stack.Navigator
          initialRouteName={ROUTES.TABS}
          screenOptions={{
            cardStyleInterpolator: CardStyleInterpolators.forHorizontalIOS,
          }}>
          <Stack.Screen
            name={ROUTES.HISTORY}
            component={History}
            options={{
              title: chain.routes.HISTORY,
            }}
          />
        </Stack.Navigator>
      </NavigationContainer>
    </SafeAreaView>
  );
};

如果直接导入的话就不会出现上面的错误,但是就无法动态更新了。

    "react": "16.13.1",
    "react-native": "0.63.4",
    "@react-navigation/bottom-tabs": "^5.11.7",
    "@react-navigation/material-top-tabs": "^5.3.15",
    "@react-navigation/native": "^5.9.2",
    "@react-navigation/stack": "^5.14.2",

xyxc0673 avatar May 08 '21 01:05 xyxc0673

看起来更像是hooks被嵌套使用,然后re-render时部分hooks没有被执行到 https://stackoverflow.com/questions/65548028/error-should-have-a-queue-this-is-likely-a-bug-in-react-please-file-an-issue

fwh1990 avatar May 08 '21 01:05 fwh1990