@eohjsc/react-native-smart-city 0.7.48 → 0.7.50

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.7.48",
4
+ "version": "0.7.50",
5
5
  "description": "TODO",
6
6
  "main": "index.js",
7
7
  "files": [
@@ -1,4 +1,5 @@
1
1
  import React, { memo, useCallback } from 'react';
2
+ import { Platform } from 'react-native';
2
3
  import ImagePickerCrop from 'react-native-image-crop-picker';
3
4
  import { RESULTS } from 'react-native-permissions';
4
5
 
@@ -28,25 +29,24 @@ const ImagePicker = ({
28
29
  compressImageMaxHeight: 720,
29
30
  compressImageQuality: 0.8,
30
31
  };
31
- permitPermissionFunction(keyPermission.CAMERA, async (result) => {
32
- if (result === RESULTS.GRANTED) {
33
- await ImagePickerCrop.openCamera(options)
34
- .then((response) => {
35
- setImageUrl(response);
36
- setShowImagePicker(false);
37
- })
38
- .catch((e) => {
39
- /* eslint-disable no-console */
40
- console.log('ERROR ' + e);
41
- });
42
- }
43
- if (result === RESULTS.BLOCKED) {
44
- OpenSetting(
45
- t('camera_request_permission'),
46
- t('camera_request_permission_des')
47
- );
48
- }
49
- });
32
+ const result = await permitPermissionFunction(keyPermission.CAMERA);
33
+ if (result === RESULTS.GRANTED) {
34
+ await ImagePickerCrop.openCamera(options)
35
+ .then((response) => {
36
+ setImageUrl(response);
37
+ setShowImagePicker(false);
38
+ })
39
+ .catch((e) => {
40
+ /* eslint-disable no-console */
41
+ console.log('ERROR ' + e);
42
+ });
43
+ }
44
+ if (result === RESULTS.BLOCKED) {
45
+ OpenSetting(
46
+ t('camera_request_permission'),
47
+ t('camera_request_permission_des')
48
+ );
49
+ }
50
50
  },
51
51
  [optionsCapture, setImageUrl, setShowImagePicker, t]
52
52
  );
@@ -61,25 +61,27 @@ const ImagePicker = ({
61
61
  compressImageMaxHeight: 720,
62
62
  compressImageQuality: 0.8,
63
63
  };
64
- permitPermissionFunction(keyPermission.SELECT_PHOTO, async (result) => {
65
- if (result === RESULTS.GRANTED || result === RESULTS.LIMITED) {
66
- await ImagePickerCrop.openPicker(options)
67
- .then((response) => {
68
- setImageUrl(response);
69
- setShowImagePicker(false);
70
- })
71
- .catch((e) => {
72
- /* eslint-disable no-console */
73
- console.log('ERROR ' + e);
74
- });
75
- }
76
- if (result === RESULTS.BLOCKED) {
77
- OpenSetting(
78
- t('photo_request_permission'),
79
- t('photo_request_permission_des')
80
- );
81
- }
82
- });
64
+ let result = RESULTS.GRANTED;
65
+ if (Platform.OS === 'ios') {
66
+ result = await permitPermissionFunction(keyPermission.SELECT_PHOTO);
67
+ }
68
+ if (result === RESULTS.GRANTED || result === RESULTS.LIMITED) {
69
+ await ImagePickerCrop.openPicker(options)
70
+ .then((response) => {
71
+ setImageUrl(response);
72
+ setShowImagePicker(false);
73
+ })
74
+ .catch((e) => {
75
+ /* eslint-disable no-console */
76
+ console.log('ERROR ' + e);
77
+ });
78
+ }
79
+ if (result === RESULTS.BLOCKED) {
80
+ OpenSetting(
81
+ t('photo_request_permission'),
82
+ t('photo_request_permission_des')
83
+ );
84
+ }
83
85
  },
84
86
  [optionsSelect, setImageUrl, setShowImagePicker, t]
85
87
  );
@@ -39,6 +39,7 @@ const IFrame = memo(({ item = {} }) => {
39
39
  ref={ref}
40
40
  title={title}
41
41
  javaScriptEnabled
42
+ nestedScrollEnabled
42
43
  />
43
44
  </View>
44
45
  );
@@ -186,6 +186,8 @@ const IFrameWithConfig = memo(
186
186
  ref={ref}
187
187
  title={item?.title}
188
188
  onMessage={onMessage}
189
+ javaScriptEnabled
190
+ nestedScrollEnabled
189
191
  />
190
192
  </View>
191
193
  );
@@ -30,22 +30,18 @@ export const OpenSetting = async (alertTitle, alertMessage) => {
30
30
  ]);
31
31
  };
32
32
 
33
- export const permitPermissionFunction = (keyPermission, callback) => {
33
+ export const permitPermissionFunction = async (keyPermission) => {
34
34
  if (keyPermission) {
35
- check(keyPermission).then((result) => {
36
- switch (result) {
37
- case RESULTS.DENIED:
38
- case RESULTS.LIMITED:
39
- request(keyPermission).then((res) => callback(res));
40
- break;
41
- case RESULTS.BLOCKED:
42
- case RESULTS.GRANTED:
43
- callback(result);
44
- break;
45
- default:
46
- break;
47
- }
48
- });
35
+ const result = await check(keyPermission);
36
+ switch (result) {
37
+ case RESULTS.DENIED:
38
+ case RESULTS.LIMITED:
39
+ return await request(keyPermission);
40
+ case RESULTS.UNAVAILABLE:
41
+ case RESULTS.BLOCKED:
42
+ case RESULTS.GRANTED:
43
+ return result;
44
+ }
49
45
  }
50
46
  };
51
47