Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Native and function GoBack not working in Android and IOS #10182

Closed
4 of 11 tasks
matheusmirandaferreira opened this issue Dec 6, 2021 · 6 comments
Closed
4 of 11 tasks

Comments

@matheusmirandaferreira
Copy link

matheusmirandaferreira commented Dec 6, 2021

Current behavior

"dependencies": {
"@expo-google-fonts/open-sans": "^0.2.0",
"@expo/vector-icons": "^12.0.0",
"@motify/interactions": "^0.16.1",
"@react-native-async-storage/async-storage": "~1.15.0",
"@react-navigation/bottom-tabs": "^6.0.9",
"@react-navigation/drawer": "^6.1.8",
"@react-navigation/native": "^6.0.6",
"@react-navigation/stack": "^6.0.11",
"axios": "^0.24.0",
"date-fns": "^2.27.0",
"expo": "~43.0.2",
"expo-app-loading": "~1.2.1",
"expo-font": "~10.0.3",
"expo-linear-gradient": "~10.0.3",
"expo-linking": "~2.4.2",
"expo-location": "~13.0.4",
"expo-status-bar": "~1.1.0",
"moti": "^0.16.1",
"react": "17.0.1",
"react-dom": "17.0.1",
"react-hook-form": "^7.20.1",
"react-is": "^17.0.2",
"react-native": "0.64.3",
"react-native-dotenv": "^3.2.0",
"react-native-gesture-handler": "~1.10.2",
"react-native-modal": "^13.0.0",
"react-native-reanimated": "~2.2.0",
"react-native-render-html": "^6.3.1",
"react-native-safe-area-context": "3.3.2",
"react-native-screens": "~3.8.0",
"react-native-svg": "12.1.1",
"react-native-toast-message": "^2.0.2",
"react-native-web": "0.17.1",
"styled-components": "^5.3.3"
},

Expected behavior

When I try use navigation.goBack() from @react-navigation/core or @react-navigation/native, I'm redirect to Home page, the routes is make with @react-navigation/bottom-tabs and a custom Header.

Expected

when backHendler action is active or navigation.goBack() is used, back one page in stack

Reproduction

https://snack.expo.dev/@matheusferreira/calm-edamame

Platform

  • Android
  • iOS
  • Web
  • Windows
  • MacOS

Packages

  • @react-navigation/bottom-tabs
  • @react-navigation/drawer
  • @react-navigation/material-bottom-tabs
  • @react-navigation/material-top-tabs
  • @react-navigation/stack
  • @react-navigation/native-stack

Environment

package version
@react-navigation/native ^6.0.6
@react-navigation/bottom-tabs ^6.0.9
@react-navigation/stack ^6.0.11
@react-navigation/material-bottom-tabs ^6.0.9
@react-navigation/material-top-tabs ^6.0.6
react-native 0.64.3
expo ~43.0.2
@github-actions
Copy link

github-actions bot commented Dec 6, 2021

Couldn't find version numbers for the following packages in the issue:

  • @react-navigation/material-bottom-tabs
  • @react-navigation/material-top-tabs

Can you update the issue to include version numbers for those packages? The version numbers must match the format 1.2.3.

@matheusmirandaferreira
Copy link
Author

matheusmirandaferreira commented Dec 6, 2021

Couldn't find version numbers for the following packages in the issue:

  • @react-navigation/material-bottom-tabs
  • @react-navigation/material-top-tabs

Can you update the issue to include version numbers for those packages? The version numbers must match the format 1.2.3.

I updated issue, can you reverify pleace

@matheusmirandaferreira matheusmirandaferreira changed the title Native and function GoBack not working in Android Native and function GoBack not working in Android and IOS Dec 6, 2021
@shelzTimesignature
Copy link

i had the same issue and was caused by reanimated@next

@matheusmirandaferreira
Copy link
Author

Thanks @shelzTimesignature, I didn't realize

@matheusmirandaferreira
Copy link
Author

matheusmirandaferreira commented Dec 17, 2021

I solved with backBehavior="history"

<Tab.Navigator backBehavior="history"

@react-one
Copy link
Contributor

react-one commented Dec 22, 2021

packages/routers/src/TabRouter.tsx:142

export default function TabRouter({
  initialRouteName,
  backBehavior = 'firstRoute',
}: TabRouterOptions) {

the backBehavior is set by default to firstRoute.

This issue should be closed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants