Closed foloinfo closed 5 years ago
Hey @foloinfo , did you find a solution to process links for web on Expo SDK33?
@EAT-CODE-KITE-REPEAT Here is my current setup for SDK33 (non-alpha)
I used to use createAppContainer
and createStackNavigator
from react-navigation
but since sdk33 released it was not working anymore. So I switched to use @react-navigation/core
and @react-navigation/web
.
It doesn't have createStackNavigator
and Drawer support, so I'm using createSwitchNavigator
and wrote own Drawer component. It seems like there are some minor issues, but basic behavior and deeplink is working.
AppNavigator.js
import React from 'react'
import { createSwitchNavigator } from '@react-navigation/core'
import { createBrowserApp } from "@react-navigation/web"
import { Linking } from 'expo'
const prefix = Linking.makeUrl('/')
const AppNavigator = createBrowserApp(createSwitchNavigator({
Landing: {
screen: LandingScreen,
path: '/'
},
Login: {
screen: LoginScreen,
path: 'login'
}
}, {
initialRouteName: 'Landing',
backBehavior: 'history'
}))
export default () => <AppNavigator uriPrefix={prefix} />
package.json
"@react-navigation/core": "^3.4.2",
"@react-navigation/web": "1.0.0-alpha.9",
Hi.
I'm currently working on test project and found that deep link with
react-navigation
will fail becauseLinking.makeUrl('/')
is returningexp://192.168.1.../
and nothttp://192.168.1...
. Also,Linking.makeUrl('/')
will return the url with current path, so it become useless I think. ex: accessinghttp://192.168.1.116:19006/somepath
will return prefix ofexp://192.168.1.116:19006/somepath
.Because of these,
react-navigation
cannot retrieve path and always render root navigator.In other words, if I directly set prefix to
http://192.168.1.116:19006/
it is working.Not working (from Deep linking · React Navigation)
Working
I'm not sure if it's a right place to report, please let me know if there is a better repo for this matter.
By the way I was pretty surprised that expo with web configuration actually works well at this moment. I'm looking forward to use SDK33.