mirror of
https://gitea.tendokyu.moe/ppc/amnet.git
synced 2026-10-11 17:08:10 +03:00
add deep linking support
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import {useCallback, useLayoutEffect, useState} from "react";
|
||||
import {useCallback, useEffect, useLayoutEffect, useState} from "react";
|
||||
import {Card, Paragraph, useTheme} from "react-native-paper";
|
||||
import {TextInput, TouchableOpacity, View} from "react-native";
|
||||
import {useModalStyles} from "../utils/ModalStyles";
|
||||
@@ -8,12 +8,18 @@ import {AMServer} from "../models/AMServer";
|
||||
|
||||
const {useRealm} = RealmContext;
|
||||
|
||||
export default function ServerAddModal({navigation}) {
|
||||
export default function ServerAddModal({route, navigation}) {
|
||||
const realm = useRealm();
|
||||
const theme = useTheme();
|
||||
const modalStyles = useModalStyles();
|
||||
|
||||
const [serverAddress, setServerAddress] = useState('');
|
||||
|
||||
// add option to add server address when loading a share link
|
||||
const {address} = route.params;
|
||||
useEffect(() => {
|
||||
setServerAddress(address || '');
|
||||
}, [address]);
|
||||
|
||||
useLayoutEffect(() => {
|
||||
navigation.setOptions({
|
||||
@@ -51,7 +57,7 @@ export default function ServerAddModal({navigation}) {
|
||||
}
|
||||
|
||||
navigation.goBack();
|
||||
setTimeout(() => navigation.navigate('server-card-in', {
|
||||
setTimeout(() => navigation.navigate('server', {
|
||||
serverId: serverObject._id.toHexString()
|
||||
}), 500);
|
||||
}, [serverAddress, realm]);
|
||||
|
||||
Reference in New Issue
Block a user