ipanel-rnapp-ajb-base 1.0.7 → 1.0.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,9 +1,20 @@
1
- import React from 'react';
2
- import {StyleSheet, View, Text, Button} from 'react-native';
1
+ import React, {useState, useEffect} from 'react';
2
+ import {StyleSheet, View, Text} from 'react-native';
3
+ import {Icon, Button} from '@rneui/themed';
4
+ import LinearGradient from 'react-native-linear-gradient';
3
5
 
4
6
  const {storage, replace} = global.base;
5
7
 
6
8
  const TestPage = ({navigation}) => {
9
+ const [viewVisible, setViewVisible] = useState(false);
10
+
11
+ useEffect(() => {
12
+ // 让视图晚一点渲染,先显示空白,避免默认进入独立页面时,有闪烁感
13
+ setTimeout(() => {
14
+ setViewVisible(true);
15
+ }, 500);
16
+ }, []);
17
+
7
18
  const onPress = () => {
8
19
  global.base.navigateModule({
9
20
  operatorId: 'ipanel',
@@ -13,13 +24,8 @@ const TestPage = ({navigation}) => {
13
24
 
14
25
  const handleLogout = async () => {
15
26
  await storage.set('accessToken', null);
27
+ await storage.set('refreshToken', null);
16
28
  await storage.set('homedAccessToken', null);
17
- await storage.set('accountType', null);
18
- await storage.set('addressRoomMap', null);
19
- await storage.set('roomDeviceMap', null);
20
- await storage.set('roomDeviceStatusMap', null);
21
- await storage.set('roomDeviceGroupMap', null);
22
- await storage.set('roomDeviceSceneMap', null);
23
29
  // 如果是在tab页的路由,当前栈路由历史只有首页Home调用会报错,如果是从智能客服进入“我的”,退出登录需要置顶
24
30
  if (navigation.getState().type === 'stack') {
25
31
  popToTop();
@@ -30,17 +36,71 @@ const TestPage = ({navigation}) => {
30
36
  };
31
37
 
32
38
  return (
33
- <View>
34
- <View>
35
- <Text>退出登录</Text>
36
- </View>
37
- <Text>TestPage</Text>
38
- <Button onPress={onPress} title="点击预览app全屏"></Button>
39
- <Button onPress={handleLogout} title="退出登录"></Button>
39
+ <View style={styles.container}>
40
+ {viewVisible ? (
41
+ <>
42
+ <View style={styles.container}>
43
+ {viewVisible && (
44
+ <Button
45
+ buttonStyle={styles.previewBtn}
46
+ titleStyle={styles.previewBtnStyle}
47
+ size="lg"
48
+ ViewComponent={LinearGradient} // Don't forget this!
49
+ linearGradientProps={{
50
+ colors: ['#FF9800', '#F44336'],
51
+ start: {x: 0, y: 0.5},
52
+ end: {x: 1, y: 0.5},
53
+ }}
54
+ radius="10"
55
+ onPress={onPress}
56
+ title="点击预览app作为独立页面的效果"
57
+ />
58
+ )}
59
+ </View>
60
+ <View style={styles.welcomeTextBox}>
61
+ <Text style={styles.welcomeText}>欢迎你,开发者!</Text>
62
+ </View>
63
+ <Icon
64
+ containerStyle={styles.exitBtn}
65
+ type="ionicon"
66
+ name="exit-outline"
67
+ color="#00aced"
68
+ size={30}
69
+ onPress={handleLogout}
70
+ />
71
+ </>
72
+ ) : null}
40
73
  </View>
41
74
  );
42
75
  };
43
76
 
44
- const styles = StyleSheet.create({});
77
+ const styles = StyleSheet.create({
78
+ container: {
79
+ flex: 1,
80
+ alignItems: 'center',
81
+ justifyContent: 'center',
82
+ backgroundColor: '#F2F2F2',
83
+ },
84
+ previewBtn: {
85
+ height: 70,
86
+ },
87
+ previewBtnStyle: {
88
+ fontSize: 18,
89
+ },
90
+ welcomeTextBox: {
91
+ position: 'absolute',
92
+ top: 200,
93
+ alignItems: 'center',
94
+ justifyContent: 'center',
95
+ },
96
+ welcomeText: {
97
+ fontSize: 24,
98
+ },
99
+ exitBtn: {
100
+ position: 'absolute',
101
+ top: 40,
102
+ right: 20,
103
+ },
104
+ });
45
105
 
46
106
  export default TestPage;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ipanel-rnapp-ajb-base",
3
- "version": "1.0.7",
3
+ "version": "1.0.8",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "bin": {