I've been trying to write React Native apps on Expo's Snack Web interface.

Here's the code I've been playing with [2].

It runs smoothly on its Web incarnation but as I choose its Android or iOS variants, the same error is given by Expo Go app startup time:

**0,a.usePreventRemoveContext is not a function (it is undefined)**

TypeError: 0,a.usePreventRemoveContext is not a function (it is undefined)

  at anonymous (@react-navigation/native.stack:12:14200)
  at S (@react-navigation/native.stack:3:14943)

Some hours of Internet search have severely contributed to my confusion, and by this point, I would guess there is something wrong with my dependencies' versions.

I have tried to combine dependencies versions, and I have also tried to import components from different navigation libraries.

Additionally, I've built different navigation structures. All of them went smoothly on Snack's Web variant, but as I switched to Android or iOS, the very same error was thrown.

Probably, as I import NavigationContainer from @react-navigation/native in order to play with the navigable stack of View components, something loads wrongly on app startup.

Well, the code and the package.json dependencies file can all be seen on [2], and the latter is also available next, for the sake of convenience.


{
  "dependencies": {
    "@expo/vector-icons": "^14.0.0",
    "react-native-paper": "4.9.2",
    "react-native-screens": "~3.29.0",
    "@react-navigation/stack": "^5.14.4",
    "@react-navigation/native": "6.0.0",
    "react-native-gesture-handler": "~2.14.0",
    "react-native-safe-area-context": "4.8.2",
    "@react-navigation/native-stack": "^6.5.0",
    "@react-native-community/masked-view": "^0.1.0"
  }
}

Anyway, I'm not even sure if this is a version compatibility issue. But on [2] you can test it, it's public code.

So, what's wrong there? Please, help?

REFERENCES

[1] Snack https://snack.expo.dev/

[2] Projeto_RH_em_Acao https://snack.expo.dev/@marcio.barbado/projeto_rh_em_acao

2

There are 2 best solutions below

0
Michael Bahl On

Change your dependencies to:

    "@react-navigation/native": "^6.0.6",
    "@react-navigation/native-stack": "^6.2.5"
0
yakupozbaydar On

When i reviewed your code there is some missing elements On your RegisterView page you used a style called btnText but there isn't any style named that. I can recommend for you to use some linter and try again