@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 CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@eohjsc/react-native-smart-city",
3
3
  "title": "React Native Smart Home",
4
- "version": "0.4.88",
4
+ "version": "0.4.90",
5
5
  "description": "TODO",
6
6
  "main": "index.js",
7
7
  "files": [
@@ -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 - (isIphoneX() ? 32 : 0),
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: 15,
120
- android: heightHeader + 16,
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
- <View style={styles.container}>
59
- <_TextInput
60
- label={t('set_timeout_seconds')}
61
- placeholder={t('maximum_3600_seconds')}
62
- keyboardType="numeric"
63
- textInputStyle={styles.inputNumber}
64
- value={delay}
65
- onChange={onChangeTitle}
66
- maxLength={4}
67
- accessibilityLabel={AccessibilityLabel.AUTOMATE_INPUT_DELAY}
68
- autoFocus
69
- />
70
- <BottomButtonView
71
- style={styles.bottomButtonView}
72
- mainTitle={t('save')}
73
- onPressMain={onNext}
74
- typeMain={canSave ? 'primary' : 'disabled'}
75
- />
76
- </View>
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
- <View style={styles.container}>
63
- <_TextInput
64
- placeholder={t('title_notification')}
65
- onChange={onChangeTitle}
66
- textInputStyle={styles.textTitle}
67
- value={notify?.title}
68
- accessibilityLabel={AccessibilityLabel.AUTOMATE_TITLE_NOTIFY}
69
- autoFocus
70
- />
71
- <_TextInput
72
- placeholder={t('message_notification')}
73
- onChange={onChangeMessage}
74
- textInputStyle={styles.textMessage}
75
- value={notify?.message}
76
- accessibilityLabel={AccessibilityLabel.AUTOMATE_MESSAGE_NOTIFY}
77
- multiline={true}
78
- maxLength={255}
79
- />
80
-
81
- <BottomButtonView
82
- style={styles.bottomButtonView}
83
- mainTitle={t('save')}
84
- onPressMain={onNext}
85
- typeMain={canSave ? 'primary' : 'disabled'}
86
- />
87
- </View>
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
  };
@@ -21,6 +21,7 @@ export default StyleSheet.create({
21
21
  },
22
22
  textMessage: {
23
23
  height: 500,
24
+ textAlignVertical: 'top',
24
25
  borderWidth: 1,
25
26
  borderColor: Colors.Gray4,
26
27
  borderStyle: 'solid',
@@ -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
- <View style={styles.row}>
222
- <Text type="H3" semibold>
223
- {t('enable_this_script')}
224
- </Text>
225
- <Switch checked={enableScript} onChange={onChangeSwitch} />
226
- </View>
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: <Image source={logo} style={styles.logo} />,
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" style={[styles.time]}>
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: 16,
7
- paddingTop: 16,
8
- paddingBottom: 16,
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
- time: {
28
- marginTop: 12,
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
  });