From c972eb8937623e0708f5e576f6a0b17ba6eade3c Mon Sep 17 00:00:00 2001 From: moonrailgun Date: Thu, 9 Feb 2023 15:00:37 +0800 Subject: [PATCH] =?UTF-8?q?feat(rn):=20=E6=B7=BB=E5=8A=A0=E6=9C=8D?= =?UTF-8?q?=E5=8A=A1=E5=99=A8=E6=97=B6=E5=A2=9E=E5=8A=A0=E5=9F=BA=E6=9C=AC?= =?UTF-8?q?=E4=BF=A1=E6=81=AF=E7=9A=84=E8=8E=B7=E5=8F=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- client/mobile/package.json | 3 ++ client/mobile/src/Entry.tsx | 26 ++++++++++++--- client/mobile/src/components/ServerCard.tsx | 10 ++++++ client/mobile/src/lib/utils/index.ts | 35 +++++++++++++++++++++ client/mobile/src/store/server.ts | 33 +++++++++++++++---- client/mobile/yarn.lock | 23 ++++++++++++++ 6 files changed, 120 insertions(+), 10 deletions(-) create mode 100644 client/mobile/src/lib/utils/index.ts diff --git a/client/mobile/package.json b/client/mobile/package.json index 02fd66a2..e1ca7fc0 100644 --- a/client/mobile/package.json +++ b/client/mobile/package.json @@ -13,6 +13,7 @@ "dependencies": { "@notifee/react-native": "^7.4.0", "immer": "^9.0.19", + "lodash": "^4.17.21", "mini-star": "^2.0.8", "react": "18.2.0", "react-native": "0.71.2", @@ -20,6 +21,7 @@ "react-native-reanimated": "^2.14.4", "react-native-ui-lib": "^6.29.1", "react-native-webview": "^11.26.1", + "url-regex": "^5.0.0", "zustand": "^4.3.2" }, "devDependencies": { @@ -29,6 +31,7 @@ "@react-native-community/eslint-config": "^3.2.0", "@tsconfig/react-native": "^2.0.2", "@types/jest": "^29.2.1", + "@types/lodash": "^4.14.191", "@types/react": "^18.0.24", "@types/react-test-renderer": "^18.0.0", "babel-jest": "^29.2.1", diff --git a/client/mobile/src/Entry.tsx b/client/mobile/src/Entry.tsx index 2fb59d2b..277f8b96 100644 --- a/client/mobile/src/Entry.tsx +++ b/client/mobile/src/Entry.tsx @@ -1,14 +1,16 @@ import React, { useState } from 'react'; -import { ScrollView, StyleSheet, TextInput } from 'react-native'; +import { Alert, ScrollView, StyleSheet, TextInput } from 'react-native'; import { ServerCard } from './components/ServerCard'; import { useServerStore } from './store/server'; import Dialog from 'react-native-ui-lib/dialog'; import { Button, PanningProvider, Text, View } from 'react-native-ui-lib'; +import { isValidUrl } from './lib/utils'; export const Entry: React.FC = React.memo(() => { const { serverList, selectServer, addServer } = useServerStore(); const [dialogVisible, setDialogVisible] = useState(false); const [serverUrl, setServerUrl] = useState(''); + const [loading, setLoading] = useState(false); return ( @@ -19,6 +21,7 @@ export const Entry: React.FC = React.memo(() => { style={styles.item} name={serverInfo.name ?? serverInfo.url} url={serverInfo.url} + version={serverInfo.version} onPress={() => selectServer(serverInfo)} /> ); @@ -43,9 +46,24 @@ export const Entry: React.FC = React.memo(() => {