Enable deep linking for authenticate.js

This commit is contained in:
Nat 2021-04-19 11:55:17 -03:00
parent 468381207f
commit 4bc1c71a7f
5 changed files with 8999 additions and 13 deletions

View File

@ -3,6 +3,7 @@
"entryPoint": "./src/App.js", "entryPoint": "./src/App.js",
"name": "Resin", "name": "Resin",
"slug": "Resin", "slug": "Resin",
"scheme": "resin",
"version": "1.0.0", "version": "1.0.0",
"orientation": "portrait", "orientation": "portrait",
"icon": "./assets/icon.png", "icon": "./assets/icon.png",

8996
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -14,6 +14,7 @@
"@react-navigation/native": "5.1.1", "@react-navigation/native": "5.1.1",
"@react-navigation/stack": "5.2.3", "@react-navigation/stack": "5.2.3",
"expo": "^38.0.9", "expo": "^38.0.9",
"expo-linking": "^1.0.3",
"expo-status-bar": "^1.0.2", "expo-status-bar": "^1.0.2",
"react": "~16.11.0", "react": "~16.11.0",
"react-dom": "~16.11.0", "react-dom": "~16.11.0",

View File

@ -6,6 +6,7 @@ import { createStackNavigator } from "react-navigation-stack";
import { MenuProvider } from "react-native-popup-menu"; import { MenuProvider } from "react-native-popup-menu";
import { registerRootComponent } from 'expo'; import { registerRootComponent } from 'expo';
import * as Linking from "expo-linking";
import ViewPostJsx from "src/components/pages/view-post"; import ViewPostJsx from "src/components/pages/view-post";
import ViewCommentsJsx from "src/components/pages/view-comments.js"; import ViewCommentsJsx from "src/components/pages/view-comments.js";
@ -23,7 +24,10 @@ import UserListJsx from "src/components/pages/user-list.js";
import SettingsJsx from "src/components/pages/profile/settings.js"; import SettingsJsx from "src/components/pages/profile/settings.js";
const Stack = createStackNavigator({ const Stack = createStackNavigator({
Authenticate: { screen: AuthenticateJsx }, Authenticate: {
screen: AuthenticateJsx,
path: "authenticate",
},
Feed: { screen: FeedJsx, }, Feed: { screen: FeedJsx, },
Discover: { screen: DiscoverJsx }, Discover: { screen: DiscoverJsx },
Direct: { screen: DirectJsx }, Direct: { screen: DirectJsx },
@ -48,6 +52,8 @@ const Stack = createStackNavigator({
const AppContainer = createAppContainer(Stack); const AppContainer = createAppContainer(Stack);
const prefix = Linking.makeUrl("/");
const App = (props) => { const App = (props) => {
const providerStyles = { const providerStyles = {
backdrop: { backdrop: {
@ -57,7 +63,7 @@ const App = (props) => {
}; };
return <MenuProvider customStyles = { providerStyles }> return <MenuProvider customStyles = { providerStyles }>
<AppContainer /> <AppContainer uriPrefix = { prefix }/>
</MenuProvider>; </MenuProvider>;
}; };

View File

@ -47,9 +47,9 @@ const AuthenticateJsx = ({navigation}) => {
AsyncStorage.getItem("@user_profile").then((profile) => { AsyncStorage.getItem("@user_profile").then((profile) => {
if (profile) { if (profile) {
navigation.navigate("Feed"); navigation.navigate("Feed");
} } else {
setState({...state, authChecked: true}); setState({...state, authChecked: true});
}
}); });
}, []); }, []);