Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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;
},
{}
),
},
});
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
},
},
},