android - Linking.getInitialURL constantly being executed and app being duplicated -
sorry long winded title.
here's componentdidmount()
function
componentdidmount() { linking.getinitialurl().then(data => { console.log(data); }); }
when boot app, data
rightfully set null
.
a user logs in via google chrome opened via
linking.open('https://...);
when user gets redirected app, can see data
has been populated. , good.
however, when redirected back, see duplicate components. here's screenshot react native debugger. have <appcontainer root=1..>
, <appcontainer root=11..>
because of duplication, app calls componentdidmount()
twice , linking.getinitialurl()
called multiple times.
furthermore, if refresh app via developer menu, data
returned linking.getinitialurl
's promise still populated when should null
.
the solution problem add android:launchmode="singletask"
.mainactivity
activity.
solution found on this github thread.
Comments
Post a Comment