I'm writing a react native app that is super simple: it have 2 screens.
import { authorize } from 'react-native-app-auth';class HomeScreen extends Component { _handleOpenURL() { console.log('_handleOpenURL 1'); } componentDidMount() { authorize(config); } render() { return (<View style={{ flex: 1, alignItems: 'center', justifyContent: 'center' }}><Text>Home Screen</Text></View> ); }class LoginScreen extends Component { _handleOpenURL() { console.log('_handleOpenURL'); } componentDidMount() { Linking.addEventListener('url', this._handleOpenURL); } render() { return (<View style={{ flex: 1, alignItems: 'center', justifyContent: 'center' }}><Text>Login Screen</Text> </View> ); }}const AppNavigator = createSwitchNavigator( { Home: { screen: HomeScreen }, Login: { screen: LoginScreen, path: 'login' } });const prefix = 'myapp://'const App = createAppContainer(AppNavigator);const MainApp = () => <App uriPrefix={prefix} />;export default MainApp;
My idea is to call authorize()
(this function is a promise that returns a 302 with a deep linking like myapp://login/?login_challenge=007728866a60408a85c711aebe346574) and it should open LoginScreen.
My problem: when authorize() is called, it opens and close a view and HomeScreen is displayed.
If I try to open same url from browser, it works.
What can I do to solve it?