How to use the @react-navigation/native.useLinking function in @react-navigation/native

To help you get started, we’ve selected a few @react-navigation/native examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github react-navigation / navigation-ex / example / src / index.tsx View on Github external
export default function App() {
  const containerRef = React.useRef();

  // To test deep linking on, run the following in the Terminal:
  // Android: adb shell am start -a android.intent.action.VIEW -d "exp://127.0.0.1:19000/--/simple-stack"
  // iOS: xcrun simctl openurl booted exp://127.0.0.1:19000/--/simple-stack
  // The first segment of the link is the the scheme + host (returned by `Linking.makeUrl`)
  const { getInitialState } = useLinking(containerRef, {
    prefixes: LinkingPrefixes,
    config: {
      Root: Object.keys(SCREENS).reduce<{ [key: string]: string }>(
        (acc, name) => {
          // Convert screen names such as SimpleStack to kebab case (simple-stack)
          acc[name] = name
            .replace(/([A-Z]+)/g, '-$1')
            .replace(/^-/, '')
            .toLowerCase();

          return acc;
        },
        {}
      ),
    },
  });
github berty / berty / js / packages / navigation / container.tsx View on Github external
export const NavigationContainer: React.FC = ({ children }) => {
	const ref: any = useRef()
	// const handleDeepLink = Messenger.useHandleDeepLink()
	const handleDeepLink = (_: any) => {}
	const { getInitialState } = useLinking(ref, {
		prefixes: [PREFIX, HTTPS_PREFIX],
		config: {
			initialRouteName: 'Tabs',
			screens: {
				['Modals']: {
					screens: {
						[Routes.Modals.ManageDeepLink]: {
							path: ':link',
							parse: {
								link: (data) => {
									const link = `${PREFIX}${data}`
									handleDeepLink(link)
									return link
								},
							},
						},