简体   繁体   中英

Issueswith React-Navigation and Fetch()

Essentially: I am using react-navigation to navigate between two screens in my app. This in principle works fine, I can use the navigation buttons to navigate between screens.

However, I am running in to a problem I am completely unable to troubleshoot because no useful error information is generated.

Basically, each page of the app needs to use fetch() to pull data when it is mounted, and upon first mount of the component it works as expected. The issues arises after moving between pages.

Essentially it seems to me that fetch() simply stops working after I navigate between screens. Basically I need to be able to make some POST and GET requests, however this simply does not work. Far as I can tell the calls to fetch() don't even fire.

If I look at what data is communicated by my app and my server in Wireshark, I can can see that when the components first mount, they communicate just fine over TLS1.2. Then when navigate to one page and navigate back, NO data is sent or received.

So my question is, why does switching between app pages seem to make React-native not want to execute fetch() commands any more?

Code will be provided upon request, but I don't think seeing it will help much since the issue seems unrelated to my specific code. The code works fine, just as long as I never switch between app pages.

Despite changing no lines of code. The code now seems to work.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM