Skip to content

Commit 59f559d

Browse files
committed
feat: 增加react-native-ui-lib,增加添加服务器功能
1 parent f8a4055 commit 59f559d

File tree

6 files changed

+886
-453
lines changed

6 files changed

+886
-453
lines changed

client/mobile/android/app/proguard-rules.pro

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,6 @@
88
# http://developer.android.com/guide/developing/tools/proguard.html
99

1010
# Add any project specific keep options here:
11+
12+
-keep class com.swmansion.reanimated.** { *; }
13+
-keep class com.facebook.react.turbomodule.** { *; }

client/mobile/babel.config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
module.exports = {
22
presets: ['module:metro-react-native-babel-preset'],
3+
plugins: ['react-native-reanimated/plugin'],
34
};

client/mobile/ios/Podfile.lock

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -415,6 +415,37 @@ PODS:
415415
- React-jsi (= 0.71.2)
416416
- React-logger (= 0.71.2)
417417
- React-perflogger (= 0.71.2)
418+
- ReactNativeUiLib (3.0.9):
419+
- React
420+
- RNGestureHandler (2.9.0):
421+
- React-Core
422+
- RNReanimated (2.14.4):
423+
- DoubleConversion
424+
- FBLazyVector
425+
- FBReactNativeSpec
426+
- glog
427+
- RCT-Folly
428+
- RCTRequired
429+
- RCTTypeSafety
430+
- React-callinvoker
431+
- React-Core
432+
- React-Core/DevSupport
433+
- React-Core/RCTWebSocket
434+
- React-CoreModules
435+
- React-cxxreact
436+
- React-jsi
437+
- React-jsiexecutor
438+
- React-jsinspector
439+
- React-RCTActionSheet
440+
- React-RCTAnimation
441+
- React-RCTBlob
442+
- React-RCTImage
443+
- React-RCTLinking
444+
- React-RCTNetwork
445+
- React-RCTSettings
446+
- React-RCTText
447+
- ReactCommon/turbomodule/core
448+
- Yoga
418449
- SocketRocket (0.6.0)
419450
- Yoga (1.14.0)
420451
- YogaKit (1.18.1):
@@ -480,6 +511,9 @@ DEPENDENCIES:
480511
- React-RCTVibration (from `../node_modules/react-native/Libraries/Vibration`)
481512
- React-runtimeexecutor (from `../node_modules/react-native/ReactCommon/runtimeexecutor`)
482513
- ReactCommon/turbomodule/core (from `../node_modules/react-native/ReactCommon`)
514+
- ReactNativeUiLib (from `../node_modules/react-native-ui-lib`)
515+
- RNGestureHandler (from `../node_modules/react-native-gesture-handler`)
516+
- RNReanimated (from `../node_modules/react-native-reanimated`)
483517
- Yoga (from `../node_modules/react-native/ReactCommon/yoga`)
484518

485519
SPEC REPOS:
@@ -569,6 +603,12 @@ EXTERNAL SOURCES:
569603
:path: "../node_modules/react-native/ReactCommon/runtimeexecutor"
570604
ReactCommon:
571605
:path: "../node_modules/react-native/ReactCommon"
606+
ReactNativeUiLib:
607+
:path: "../node_modules/react-native-ui-lib"
608+
RNGestureHandler:
609+
:path: "../node_modules/react-native-gesture-handler"
610+
RNReanimated:
611+
:path: "../node_modules/react-native-reanimated"
572612
Yoga:
573613
:path: "../node_modules/react-native/ReactCommon/yoga"
574614

@@ -620,6 +660,9 @@ SPEC CHECKSUMS:
620660
React-RCTVibration: 0af3babdeee1b2d052811a2f86977d1e1c81ebd1
621661
React-runtimeexecutor: 4bf9a9086d27f74065fce1dddac274aa95216952
622662
ReactCommon: f697c0ac52e999aa818e43e2b6f277787c735e2d
663+
ReactNativeUiLib: 8d3804947431a465a69f09c5e785c988314612a9
664+
RNGestureHandler: 071d7a9ad81e8b83fe7663b303d132406a7d8f39
665+
RNReanimated: cc5e3aa479cb9170bcccf8204291a6950a3be128
623666
SocketRocket: fccef3f9c5cedea1353a9ef6ada904fde10d6608
624667
Yoga: 5b0304b3dbef2b52e078052138e23a19c7dacaef
625668
YogaKit: f782866e155069a2cca2517aafea43200b01fd5a

client/mobile/package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@
1313
"immer": "^9.0.19",
1414
"react": "18.2.0",
1515
"react-native": "0.71.2",
16+
"react-native-gesture-handler": "^2.9.0",
17+
"react-native-reanimated": "^2.14.4",
18+
"react-native-ui-lib": "^6.29.1",
1619
"react-native-webview": "^11.26.1",
1720
"zustand": "^4.3.2"
1821
},

client/mobile/src/Entry.tsx

Lines changed: 46 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
1-
import React from 'react';
2-
import { Alert, ScrollView, StyleSheet } from 'react-native';
1+
import React, { useState } from 'react';
2+
import { ScrollView, StyleSheet, TextInput } from 'react-native';
33
import { ServerCard } from './components/ServerCard';
44
import { useServerStore } from './store/server';
5+
import Dialog from 'react-native-ui-lib/dialog';
6+
import { Button, PanningProvider, Text, View } from 'react-native-ui-lib';
57

68
export const Entry: React.FC = React.memo(() => {
7-
const { serverList, selectServer } = useServerStore();
9+
const { serverList, selectServer, addServer } = useServerStore();
10+
const [dialogVisible, setDialogVisible] = useState(false);
11+
const [serverUrl, setServerUrl] = useState('');
812

913
return (
1014
<ScrollView style={styles.root}>
@@ -20,7 +24,32 @@ export const Entry: React.FC = React.memo(() => {
2024
);
2125
})}
2226

23-
<ServerCard name={'添加服务器'} onPress={() => Alert.alert('暂不支持')} />
27+
<ServerCard name={'添加服务器'} onPress={() => setDialogVisible(true)} />
28+
29+
<Dialog
30+
visible={dialogVisible}
31+
panDirection={PanningProvider.Directions.DOWN}
32+
onDismiss={() => setDialogVisible(false)}
33+
>
34+
<View backgroundColor="white" style={styles.dialog}>
35+
<Text>输入服务器地址:</Text>
36+
37+
<TextInput
38+
style={styles.textInput}
39+
inputMode="url"
40+
value={serverUrl}
41+
onChangeText={setServerUrl}
42+
/>
43+
44+
<Button
45+
label={'确认'}
46+
onPress={() => {
47+
addServer(serverUrl);
48+
setDialogVisible(false);
49+
}}
50+
/>
51+
</View>
52+
</Dialog>
2453
</ScrollView>
2554
);
2655
});
@@ -34,4 +63,17 @@ const styles = StyleSheet.create({
3463
item: {
3564
marginBottom: 8,
3665
},
66+
dialog: {
67+
borderRadius: 8,
68+
padding: 10,
69+
},
70+
textInput: {
71+
fontSize: 20,
72+
borderColor: '#ccc',
73+
borderWidth: 1,
74+
marginTop: 4,
75+
marginBottom: 10,
76+
paddingHorizontal: 8,
77+
paddingVertical: 4,
78+
},
3779
});

0 commit comments

Comments
 (0)