jihuaqiang 2 年之前
父节点
当前提交
5e991ed854
共有 4 个文件被更改,包括 97 次插入16 次删除
  1. 8 8
      ios/Podfile.lock
  2. 57 0
      src/components/loginView.tsx
  3. 32 8
      src/pages/navigations/message.tsx
  4. 二进制
      src/static/img/login/transform.png

+ 8 - 8
ios/Podfile.lock

@@ -290,11 +290,11 @@ PODS:
     - React
   - react-native-cookies (6.2.1):
     - React-Core
-  - react-native-safe-area-context (4.3.1):
+  - react-native-safe-area-context (4.3.3):
     - RCT-Folly
     - RCTRequired
     - RCTTypeSafety
-    - React
+    - React-Core
     - ReactCommon/turbomodule/core
   - react-native-webview (11.23.0):
     - React-Core
@@ -364,9 +364,9 @@ PODS:
     - React-jsi (= 0.69.2)
     - React-logger (= 0.69.2)
     - React-perflogger (= 0.69.2)
-  - RNCAsyncStorage (1.17.9):
+  - RNCAsyncStorage (1.17.10):
     - React-Core
-  - RNScreens (3.15.0):
+  - RNScreens (3.17.0):
     - React-Core
     - React-RCTImage
   - RNSVG (13.0.0):
@@ -578,8 +578,8 @@ SPEC CHECKSUMS:
   React-logger: 9a6c684d5cd56c4129e0c2842dba75c4bfb1e981
   react-native-cookie: dfde9cd819c42c538abc19dc476c9c7ac53cb530
   react-native-cookies: f54fcded06bb0cda05c11d86788020b43528a26c
-  react-native-safe-area-context: 6c12e3859b6f27b25de4fee8201cfb858432d8de
-  react-native-webview: e771bc375f789ebfa02a26939a57dbc6fa897336
+  react-native-safe-area-context: deca3b734e6ad82df91bd6e68f3eb48bbb96b758
+  react-native-webview: c09ea739796b91286ae1f581d2db536b48c33911
   React-perflogger: 281c34e42f13245c7a4d6932364d9182f8655e1a
   React-RCTActionSheet: 92f4292754a1b4a0e42bf9b1489206a06f878929
   React-RCTAnimation: 2a5bb5549758e4e594481633f3db649d11519f75
@@ -592,8 +592,8 @@ SPEC CHECKSUMS:
   React-RCTVibration: 0d07f00705b5f11e88aaaaf9131f5e1785d4bd6e
   React-runtimeexecutor: 8030b9cf9b9e87b878d92da680b55b5e74c58e70
   ReactCommon: a9414b91f0d19de002b55d9f4f6cb176d6dd8452
-  RNCAsyncStorage: b2489b49e38c85e10ed45a888d13a2a4c7b32ea1
-  RNScreens: 4a1af06327774490d97342c00aee0c2bafb497b7
+  RNCAsyncStorage: 73b194e58ded504eee17b9a3c125651e2507ddde
+  RNScreens: 0df01424e9e0ed7827200d6ed1087ddd06c493f9
   RNSVG: 42a0c731b11179ebbd27a3eeeafa7201ebb476ff
   SocketRocket: fccef3f9c5cedea1353a9ef6ada904fde10d6608
   Yoga: 236056dd74cda4d9d76c20306fd8c20bb087614d

+ 57 - 0
src/components/loginView.tsx

@@ -0,0 +1,57 @@
+/**
+ * 通用 loginView 封装
+ */
+import React from 'react';
+import { View, Text, Image, Pressable, StyleSheet } from 'react-native';
+
+interface Props {
+    goLogin: any;
+}
+
+export const LoginView = (props: Props) => {
+    return (
+        <View style={styles.login}>
+            <Image
+                style={styles.image}
+                source={ require('../static/img/login/transform.png') }
+            />
+            <Text style={styles.welcome}>使用推特登录 DeNet</Text>
+            <Pressable style={styles.button} onPress={props.goLogin}>
+                <Text style={styles.buttonText}>Login</Text>
+            </Pressable>
+        </View>
+    );
+};
+
+const styles = StyleSheet.create({
+    image: {
+        width: 264,
+        height: 100,
+        marginBottom: 39,
+    },
+    welcome: {
+        fontSize: 18,
+        marginBottom: 12,
+        fontWeight: 'bold',
+    },
+    login: {
+        flex: 1,
+        alignItems: 'center',
+        justifyContent: 'center',
+        backgroundColor: '#fff',
+    },
+	button: {
+        display: 'flex',
+        width: 335,
+        height: 46,
+		alignItems: 'center',
+		justifyContent: 'center',
+        backgroundColor: '#000',
+        borderRadius: 56,
+	},
+    buttonText: {
+        color: '#fff',
+        fontSize: 20,
+        fontWeight: 'bold',
+    }
+});

+ 32 - 8
src/pages/navigations/message.tsx

@@ -1,12 +1,36 @@
 import React from 'react';
-import { Text, View } from 'react-native';
-
-const Message = () => {
-	return (
-		<View style={{ flex: 1 }}>
-			<Text>Message page</Text>
-		</View>
-	);
+import { LoginView } from '@/components/loginView';
+import { DenetWebview } from '@/components/webview';
+import { useLoginCom } from '@/components/useLogin';
+
+interface Props {
+	navigation: any;
+}
+
+const onMessage = async (event: any) => {
+	let { info, data } = (event.nativeEvent.data && JSON.parse(event.nativeEvent.data)) || {};
+	switch (info.actionType) {
+		case 'IFRAME_GET_EXTENSION_STORGE_DATA':
+			
+			break;
+	}
+}
+
+const Message = (props: Props) => {
+	const { isLogin, goTwitterAuthorize } = useLoginCom(props);
+
+	if (isLogin === false) {
+		return (
+			<LoginView goLogin={goTwitterAuthorize}></LoginView>
+		);
+	} else {
+		return (
+			<DenetWebview
+				onMessageHandle={onMessage}
+				uri="http://localhost:3000/nav-message?iframeID=de-nav-message-page&appVersionCode=23">
+			</DenetWebview>
+		);
+	}
 };
 
 export default Message;

二进制
src/static/img/login/transform.png