@eohjsc/react-native-smart-city 0.4.88 → 0.4.90
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.
- package/package.json +1 -1
- package/src/commons/Sharing/WrapHeaderScrollable.js +3 -5
- package/src/screens/Automate/AddNewAction/SetupScriptDelay.js +22 -20
- package/src/screens/Automate/AddNewAction/SetupScriptNotify.js +28 -27
- package/src/screens/Automate/AddNewAction/Styles/SetupScriptNotifyStyles.js +1 -0
- package/src/screens/Automate/AddNewAction/__test__/SetupScriptDelay.test.js +5 -0
- package/src/screens/Automate/AddNewAction/__test__/SetupScriptNotify.test.js +7 -0
- package/src/screens/Automate/ScriptDetail/index.js +8 -6
- package/src/screens/Notification/components/NotificationItem.js +3 -2
- package/src/screens/Notification/index.js +0 -1
- package/src/screens/Notification/styles/NotificationItemStyles.js +8 -21
- package/src/screens/Notification/styles/indexStyles.js +0 -4
package/package.json
CHANGED
|
@@ -7,8 +7,6 @@ import {
|
|
|
7
7
|
View,
|
|
8
8
|
} from 'react-native';
|
|
9
9
|
import { ActivityIndicator } from '@ant-design/react-native';
|
|
10
|
-
import { isIphoneX } from 'react-native-iphone-x-helper';
|
|
11
|
-
|
|
12
10
|
import { Colors, Theme } from '../../configs';
|
|
13
11
|
import HeaderAni, { heightHeader } from '../../commons/HeaderAni';
|
|
14
12
|
import Text from '../../commons/Text';
|
|
@@ -83,7 +81,7 @@ const WrapHeaderScrollable = ({
|
|
|
83
81
|
/>
|
|
84
82
|
}
|
|
85
83
|
contentInset={{
|
|
86
|
-
top: heightHeader
|
|
84
|
+
top: heightHeader,
|
|
87
85
|
}}
|
|
88
86
|
contentOffset={{
|
|
89
87
|
y: -heightHeader,
|
|
@@ -116,8 +114,8 @@ const styles = StyleSheet.create({
|
|
|
116
114
|
scrollView: {
|
|
117
115
|
flex: 1,
|
|
118
116
|
paddingTop: Platform.select({
|
|
119
|
-
ios:
|
|
120
|
-
android: heightHeader
|
|
117
|
+
ios: 0,
|
|
118
|
+
android: heightHeader,
|
|
121
119
|
}),
|
|
122
120
|
},
|
|
123
121
|
contentContainerStyle: {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { useCallback, useMemo, useState } from 'react';
|
|
2
|
-
import { View } from 'react-native';
|
|
2
|
+
import { Keyboard, TouchableWithoutFeedback, View } from 'react-native';
|
|
3
3
|
import { useNavigation } from '@react-navigation/native';
|
|
4
4
|
import styles from './Styles/SetupScriptDelayStyles';
|
|
5
5
|
import { HeaderCustom } from '../../../commons';
|
|
@@ -55,25 +55,27 @@ const SetupScriptDelay = ({ route }) => {
|
|
|
55
55
|
return (
|
|
56
56
|
<View style={styles.wrap}>
|
|
57
57
|
<HeaderCustom isShowClose onClose={goBack} title={t('wait')} />
|
|
58
|
-
<
|
|
59
|
-
<
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
58
|
+
<TouchableWithoutFeedback onPress={Keyboard.dismiss} accessible={false}>
|
|
59
|
+
<View style={styles.container}>
|
|
60
|
+
<_TextInput
|
|
61
|
+
label={t('set_timeout_seconds')}
|
|
62
|
+
placeholder={t('maximum_3600_seconds')}
|
|
63
|
+
keyboardType="numeric"
|
|
64
|
+
textInputStyle={styles.inputNumber}
|
|
65
|
+
value={delay}
|
|
66
|
+
onChange={onChangeTitle}
|
|
67
|
+
maxLength={4}
|
|
68
|
+
accessibilityLabel={AccessibilityLabel.AUTOMATE_INPUT_DELAY}
|
|
69
|
+
autoFocus
|
|
70
|
+
/>
|
|
71
|
+
<BottomButtonView
|
|
72
|
+
style={styles.bottomButtonView}
|
|
73
|
+
mainTitle={t('save')}
|
|
74
|
+
onPressMain={onNext}
|
|
75
|
+
typeMain={canSave ? 'primary' : 'disabled'}
|
|
76
|
+
/>
|
|
77
|
+
</View>
|
|
78
|
+
</TouchableWithoutFeedback>
|
|
77
79
|
</View>
|
|
78
80
|
);
|
|
79
81
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { useCallback, useMemo, useState } from 'react';
|
|
2
|
-
import { View } from 'react-native';
|
|
2
|
+
import { Keyboard, TouchableWithoutFeedback, View } from 'react-native';
|
|
3
3
|
import { useNavigation } from '@react-navigation/native';
|
|
4
4
|
import styles from './Styles/SetupScriptNotifyStyles';
|
|
5
5
|
import { HeaderCustom } from '../../../commons';
|
|
@@ -59,32 +59,33 @@ const SetupScriptNotify = ({ route }) => {
|
|
|
59
59
|
return (
|
|
60
60
|
<View style={styles.wrap}>
|
|
61
61
|
<HeaderCustom isShowClose onClose={goBack} title={t('notification')} />
|
|
62
|
-
<
|
|
63
|
-
<
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
62
|
+
<TouchableWithoutFeedback onPress={Keyboard.dismiss} accessible={false}>
|
|
63
|
+
<View style={styles.container}>
|
|
64
|
+
<_TextInput
|
|
65
|
+
placeholder={t('title_notification')}
|
|
66
|
+
onChange={onChangeTitle}
|
|
67
|
+
textInputStyle={styles.textTitle}
|
|
68
|
+
value={notify?.title}
|
|
69
|
+
accessibilityLabel={AccessibilityLabel.AUTOMATE_TITLE_NOTIFY}
|
|
70
|
+
autoFocus
|
|
71
|
+
/>
|
|
72
|
+
<_TextInput
|
|
73
|
+
placeholder={t('message_notification')}
|
|
74
|
+
onChange={onChangeMessage}
|
|
75
|
+
textInputStyle={styles.textMessage}
|
|
76
|
+
value={notify?.message}
|
|
77
|
+
accessibilityLabel={AccessibilityLabel.AUTOMATE_MESSAGE_NOTIFY}
|
|
78
|
+
multiline={true}
|
|
79
|
+
maxLength={255}
|
|
80
|
+
/>
|
|
81
|
+
<BottomButtonView
|
|
82
|
+
style={styles.bottomButtonView}
|
|
83
|
+
mainTitle={t('save')}
|
|
84
|
+
onPressMain={onNext}
|
|
85
|
+
typeMain={canSave ? 'primary' : 'disabled'}
|
|
86
|
+
/>
|
|
87
|
+
</View>
|
|
88
|
+
</TouchableWithoutFeedback>
|
|
88
89
|
</View>
|
|
89
90
|
);
|
|
90
91
|
};
|
|
@@ -11,6 +11,7 @@ import _TextInput from '../../../../commons/Form/TextInput';
|
|
|
11
11
|
import BottomButtonView from '../../../../commons/BottomButtonView';
|
|
12
12
|
import { ToastBottomHelper } from '../../../../utils/Utils';
|
|
13
13
|
import SetupScriptDelay from '../SetupScriptDelay';
|
|
14
|
+
import { TouchableWithoutFeedback } from 'react-native';
|
|
14
15
|
|
|
15
16
|
const mock = new MockAdapter(api.axiosInstance);
|
|
16
17
|
|
|
@@ -55,6 +56,10 @@ describe('Test SetupScriptDelay', () => {
|
|
|
55
56
|
inputs[0].props.onChange('u');
|
|
56
57
|
});
|
|
57
58
|
expect(button.props.typeMain).toEqual('disabled');
|
|
59
|
+
const touchable = instance.findAllByType(TouchableWithoutFeedback);
|
|
60
|
+
await act(async () => {
|
|
61
|
+
touchable[0].props.onPress();
|
|
62
|
+
});
|
|
58
63
|
await act(async () => {
|
|
59
64
|
inputs[0].props.onChange('0');
|
|
60
65
|
});
|
|
@@ -11,6 +11,7 @@ import SetupScriptNotify from '../SetupScriptNotify';
|
|
|
11
11
|
import _TextInput from '../../../../commons/Form/TextInput';
|
|
12
12
|
import BottomButtonView from '../../../../commons/BottomButtonView';
|
|
13
13
|
import { ToastBottomHelper } from '../../../../utils/Utils';
|
|
14
|
+
import { TouchableWithoutFeedback } from 'react-native';
|
|
14
15
|
|
|
15
16
|
const mock = new MockAdapter(api.axiosInstance);
|
|
16
17
|
|
|
@@ -53,6 +54,12 @@ describe('Test SetupScriptNotify', () => {
|
|
|
53
54
|
|
|
54
55
|
await act(async () => {
|
|
55
56
|
inputs[0].props.onChange('Title');
|
|
57
|
+
});
|
|
58
|
+
const touchable = instance.findAllByType(TouchableWithoutFeedback);
|
|
59
|
+
await act(async () => {
|
|
60
|
+
touchable[0].props.onPress();
|
|
61
|
+
});
|
|
62
|
+
await act(async () => {
|
|
56
63
|
inputs[1].props.onChange('Message');
|
|
57
64
|
});
|
|
58
65
|
const button = instance.findByType(BottomButtonView);
|
|
@@ -218,12 +218,14 @@ const ScriptDetail = ({ route }) => {
|
|
|
218
218
|
onGoBack={goBack}
|
|
219
219
|
>
|
|
220
220
|
<View style={styles.wrapContent}>
|
|
221
|
-
|
|
222
|
-
<
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
221
|
+
{!!can_edit && !!enableScript && (
|
|
222
|
+
<View style={styles.row}>
|
|
223
|
+
<Text type="H3" semibold>
|
|
224
|
+
{t('enable_this_script')}
|
|
225
|
+
</Text>
|
|
226
|
+
<Switch checked={enableScript} onChange={onChangeSwitch} />
|
|
227
|
+
</View>
|
|
228
|
+
)}
|
|
227
229
|
<Text type="H3" semibold>
|
|
228
230
|
{t('how_to_start')}
|
|
229
231
|
</Text>
|
|
@@ -16,6 +16,7 @@ import { useTranslations } from '../../../hooks/Common/useTranslations';
|
|
|
16
16
|
import { axiosPost } from '../../../utils/Apis/axios';
|
|
17
17
|
import Routes from '../../../utils/Route';
|
|
18
18
|
import styles from '../styles/NotificationItemStyles';
|
|
19
|
+
import Notify from '../../../../assets/images/Notify.svg';
|
|
19
20
|
|
|
20
21
|
const NotificationItem = memo(({ item }) => {
|
|
21
22
|
const t = useTranslations();
|
|
@@ -442,7 +443,7 @@ const NotificationItem = memo(({ item }) => {
|
|
|
442
443
|
},
|
|
443
444
|
});
|
|
444
445
|
},
|
|
445
|
-
iconContent: <
|
|
446
|
+
iconContent: <Notify />,
|
|
446
447
|
};
|
|
447
448
|
default:
|
|
448
449
|
return null;
|
|
@@ -498,7 +499,7 @@ const NotificationItem = memo(({ item }) => {
|
|
|
498
499
|
{sub_content}
|
|
499
500
|
</Text>
|
|
500
501
|
)}
|
|
501
|
-
<Text color={Colors.Gray7} type="Label"
|
|
502
|
+
<Text color={Colors.Gray7} type="Label">
|
|
502
503
|
{timeFormat}
|
|
503
504
|
</Text>
|
|
504
505
|
</View>
|
|
@@ -99,7 +99,6 @@ const Notification = memo(() => {
|
|
|
99
99
|
onLoadMore={handleOnLoadMore}
|
|
100
100
|
onRefresh={onRefresh}
|
|
101
101
|
disableLoadMore={page >= maxPageNotification}
|
|
102
|
-
styleScrollView={styles.styleScrollView}
|
|
103
102
|
>
|
|
104
103
|
{notifications.map((item, index) => (
|
|
105
104
|
<NotificationItem item={item} key={index} />
|
|
@@ -3,9 +3,9 @@ import { Colors } from '../../../configs';
|
|
|
3
3
|
|
|
4
4
|
export default StyleSheet.create({
|
|
5
5
|
container: {
|
|
6
|
-
paddingHorizontal:
|
|
7
|
-
paddingTop:
|
|
8
|
-
paddingBottom:
|
|
6
|
+
paddingHorizontal: 10,
|
|
7
|
+
paddingTop: 10,
|
|
8
|
+
paddingBottom: 10,
|
|
9
9
|
flexDirection: 'row',
|
|
10
10
|
backgroundColor: Colors.White,
|
|
11
11
|
},
|
|
@@ -21,35 +21,22 @@ export default StyleSheet.create({
|
|
|
21
21
|
justifyContent: 'center',
|
|
22
22
|
alignItems: 'center',
|
|
23
23
|
},
|
|
24
|
+
iconNotification: {
|
|
25
|
+
width: '46%',
|
|
26
|
+
},
|
|
24
27
|
viewRight: {
|
|
25
28
|
flexShrink: 1,
|
|
26
29
|
},
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
},
|
|
30
|
-
iconNotification: {
|
|
31
|
-
width: '46%',
|
|
30
|
+
textNotification: {
|
|
31
|
+
lineHeight: 23,
|
|
32
32
|
},
|
|
33
33
|
backgroundSummer: {
|
|
34
34
|
width: '46%',
|
|
35
35
|
color: Colors.Summer,
|
|
36
36
|
},
|
|
37
|
-
border: {
|
|
38
|
-
color: Colors.Primary,
|
|
39
|
-
paddingTop: 8,
|
|
40
|
-
paddingBottom: 8,
|
|
41
|
-
paddingHorizontal: 16,
|
|
42
|
-
borderColor: Colors.Primary,
|
|
43
|
-
borderWidth: 1,
|
|
44
|
-
borderRadius: 50,
|
|
45
|
-
width: 120,
|
|
46
|
-
},
|
|
47
37
|
logo: {
|
|
48
38
|
width: 20,
|
|
49
39
|
height: 20,
|
|
50
40
|
resizeMode: 'contain',
|
|
51
41
|
},
|
|
52
|
-
textNotification: {
|
|
53
|
-
lineHeight: 23,
|
|
54
|
-
},
|
|
55
42
|
});
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { StyleSheet } from 'react-native';
|
|
2
2
|
|
|
3
3
|
import { Colors } from '../../../configs';
|
|
4
|
-
import { getStatusBarHeight } from '../../../configs/Constants';
|
|
5
4
|
|
|
6
5
|
export default StyleSheet.create({
|
|
7
6
|
wrap: {
|
|
@@ -17,7 +16,4 @@ export default StyleSheet.create({
|
|
|
17
16
|
iconPlus: {
|
|
18
17
|
marginRight: 22,
|
|
19
18
|
},
|
|
20
|
-
styleScrollView: {
|
|
21
|
-
marginTop: getStatusBarHeight(),
|
|
22
|
-
},
|
|
23
19
|
});
|