React Native Router Flux Freezing Without {type:reset}

淺唱寂寞╮ 提交于 2019-12-24 10:49:24

问题


I'm using React Native Router Flux on my mobile app for routing.

Page structure is like;

Login.js Get user password and username validation and store user-token in AsyncStorage If app has user-token redirect user to MainPage.js

( redirection in ComponentWillMount() method )

MainPage.js Make API call to my back-end server for listing some data

DetailPage.js Make API call to my back-end server for some detailed data.

--

My Router structure;

<Roter>
    <Scene key="root">
        <Scene initial component={Login} key="login" />
        <Scene component={MainPage} key="mainpage" />
        <Scene component={DetailPage} key="detailpage" />
    </Scene>
</Router>

--

Problem is;

When I want to navigate from MainPage to DetailPage, I cannot use Actions.detailpage() without Actions.detailpage({type:"reset"})

If I try to use only Actions.detailpage() app is freezing on MainPage. But I console.log("this is detail page") I can see the output. Actually I can navigate with Actions.detailpage() but my DetailPage can not load to screen.

I have network calls. Does not navigation stack handle this heavy process?

If i use Actions.detailpage({type:"reset"}) , navigation history is missing. So I can not use back buttons on top navbar.

What I'm missing here?

Actions reset property: Clears the routing stack and pushes the scene into the first index. No transition will occur.

https://github.com/aksonov/react-native-router-flux/blob/master/docs/API.md#actions


Edit:

When I delete all my routing config and add two empty scene like PageA.js and PageB.js, still it is freezing when I try to jump from PageA to PageB

<Roter>
        <Scene key="root>
            <Scene initial component={PageA} key="page_a" />
            <Scene component={PageB} key="page_b" />
        </Scene>
    </Router>

Still I get same error. Something on my app blocking page rendering and Scene loading. How I inspect this issue?

Also my dependencies are;

"dependencies": {
    "@react-native-community/async-storage": "^1.4.2",
    "react": "16.8.3",
    "react-native": "0.59.8",
    "react-native-elements": "^1.1.0",
    "react-native-facebook-account-kit": "^1.1.0",
    "react-native-fbsdk": "^0.8.0",
    "react-native-iap": "^2.5.5",
    "react-native-router-flux": "^4.0.6",
    "react-native-vector-icons": "^6.5.0"
  },

回答1:


have you used Actions.push('scene key')? i'm having trouble moving to specific scene directly but this one might helps you. i thinking about using react navigation



来源:https://stackoverflow.com/questions/56733215/react-native-router-flux-freezing-without-typereset

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!