You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi,
If the user is offline when the app starts and then later comes online, am I correct that this will not check the app version once the user goes online?
2. Handle the network connection on your app side:
importReact,{useState,useEffect}from'react';import{View,Text,Platform}from'react-native';importNetInfofrom'@react-native-community/netinfo';importDeviceInfofrom'react-native-device-info';import{ForceUpdate}from'reactnative-forceupdate';constApp=()=>{const[isConnected,setIsConnected]=useState<boolean|null>(null);useEffect(()=>{constunsubscribe=NetInfo.addEventListener((state)=>{setIsConnected(state.isConnected);});return()=>unsubscribe();},[]);constversion=DeviceInfo.getVersion();constlanguage='en';constplatform=Platform.OS==='ios' ? 'IOS' : 'ANDROID';constapiKey='YOUR_API_KEY_HERE';if(isConnected===false){return(<View><Text> Your app flow will go here </Text></View>);}return(<ForceUpdateapi_key={apiKey}language={language}platform={platform}version={version}><View><Text> Your app flow will go here </Text></View></ForceUpdate>);};exportdefaultApp;
I could easily add the handle above on the code, but the component has a premise to be zero dependencies. I'll think a way to implement that behavior on the main package.
Activity
joaomantovani commentedon Oct 29, 2024
@deelo55 Yes, you’re correct. With this package, this behavior occurs.
Thank you for pointing it out; I’ll add a handler for this situation.
PS: It’s also possible to use the API directly and create your custom force-update flow.
joaomantovani commentedon Oct 29, 2024
As a temporary solution, you could handle the offline on your app in two ways:
1. Integrate directly with API and do your flow 100% customized
https://docs.forceupdate.app/#/api-integration
2. Handle the network connection on your app side:
I could easily add the handle above on the code, but the component has a premise to be zero dependencies. I'll think a way to implement that behavior on the main package.