Skip to content
This repository was archived by the owner on Mar 17, 2025. It is now read-only.
This repository was archived by the owner on Mar 17, 2025. It is now read-only.

Using unstable_settings breaks deep linking in the app when it's in the foreground or background #818

@GibbyBox

Description

@GibbyBox

Which package manager are you using? (Yarn is recommended)

yarn

Summary

Exporting unstable_settings (even an empty object) prevents deep linking from working in an app that is in the foreground or the background. The app will be brought to the foreground, just not to the requested screen. Deep linking when the app is closed works fine.

A warning is thrown when this issue occurs.

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 tested this on both router v1.7.7 (repro's master branch) and v2.0.0 (repro's with-router-v2 branch) using the ios simulator. I haven't used android and I tried setting it up to test but uri-scheme wasn't opening up expo :/

Workaround

Currently, I'm using this as a workaround in my app since I need to use unstable_settings for the back button behavior.

	useEffect(function linkingWorkaround() {
		Linking.addEventListener('url', ({ url }) => {
			const match = url.match(new RegExp(`^${SCHEME}:\/\/(.*)`));
			if (match) router.push(match[1]);
		});
	}, []);

Minimal reproducible example

https://github.com/GibbyBox/expo-router-deeplink-repro

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions