React Native deeplink into Android app shows warning (iOS works perfectly)

43 views Asked by At

I have an auth flow using react-navigation for react native and react-native-inappbrowser-reborn. I have the redirect deeplink set up and working for both Android and iOS, and they do both technically work. However, on android I get this warning:

The navigation state parsed from the URL contains routes not present in the root navigator. This usually means that the linking configuration doesn't match the navigation structure. See https://reactnavigation.org/docs/configuring-links for more details on how to specify a linking configuration.

I have analyzed the link being passed in, and it is correct, and it does do what I want it to do, which is why I'm confused as to why I'm getting the error.

My scheme (for example) is foo://

My linking config is this:

const linking: LinkingOptions<RootStackParamList> & LinkingOptions<DrawerParamsList> = {
      prefixes: ['foo://', 'https://fooexample.com', 'https://*.fooexample.com'],
      config: {
        screens: {
          AuthRedirect: {
            path: 'redirect',
            parse: {
              token: (token: String) => token,
            }
          }
        }
      },
    }

the redirect deeplink is foo://redirect?token=abc

It works for both iOS and Android, but gives and error. I looked at the params and they're coming through, and setting accordingly. So why am I getting a warning? Can I safely ignore it?

Manifest.xml:

<manifest xmlns:android="http://schemas.android.com/apk/res/android">
    <!-- Queries added to allow Android 11+ to use browser for React Native Linking -->
  <uses-permission android:name="android.permission.INTERNET"/>
  <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
  <uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
  <queries>
    <intent>
      <action android:name="android.intent.action.VIEW"/>
      <data android:scheme="https"/>
    </intent>
  </queries>
  <application android:name=".MainApplication" android:largeHeap="true" android:hardwareAccelerated="true" android:label="@string/app_name" android:icon="@mipmap/ic_launcher" android:allowBackup="false" android:theme="@style/AppTheme">
    <activity android:screenOrientation="portrait" android:name=".MainActivity" android:theme="@style/AppTheme" android:configChanges="keyboard|keyboardHidden|orientation|screenSize|uiMode" android:launchMode="singleTask" android:windowSoftInputMode="adjustResize" android:exported="true">
      <intent-filter android:autoVerify="true">
        <action android:name="android.intent.action.MAIN"/>
        <category android:name="android.intent.category.LAUNCHER"/>
      </intent-filter>
      <!-- Intent filter for custom scheme -->
      <intent-filter>
        <action android:name="android.intent.action.VIEW" />

        <category android:name="android.intent.category.DEFAULT" />
        <category android:name="android.intent.category.BROWSABLE" />

        <data android:scheme="foo" />
      </intent-filter>
      <!-- Intent filters for HTTP/HTTPS URLs -->
      <intent-filter android:autoVerify="true">
        <action android:name="android.intent.action.VIEW"/>
        <category android:name="android.intent.category.DEFAULT"/>
        <category android:name="android.intent.category.BROWSABLE"/>
        <data android:scheme="https" android:host="fooexample.net" />
      </intent-filter>
      <intent-filter android:autoVerify="true">
        <action android:name="android.intent.action.VIEW"/>
        <category android:name="android.intent.category.DEFAULT"/>
        <category android:name="android.intent.category.BROWSABLE"/>
        <data android:scheme="https" android:host="foodevexample.net" />
      </intent-filter>
    </activity>
  </application>
</manifest>
0

There are 0 answers