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..>

enter image description here

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

Popular posts from this blog

Is there a better way to structure post methods in Class Based Views -

performance - Why is XCHG reg, reg a 3 micro-op instruction on modern Intel architectures? -

jquery - Responsive Navbar with Sub Navbar -