@eohjsc/react-native-smart-city 0.4.89 → 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/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/package.json
CHANGED
|
@@ -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>
|