react-native-timacare 3.1.17-beta → 3.1.18-beta
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/lib/commonjs/screens/toan-trinh-so/OCR.js +1 -1
- package/lib/commonjs/screens/toan-trinh-so/OCR.js.flow +69 -14
- package/lib/commonjs/screens/toan-trinh-so/OCR.js.map +1 -1
- package/lib/commonjs/screens/toan-trinh-so/RegisterCamera.js +1 -1
- package/lib/commonjs/screens/toan-trinh-so/RegisterCamera.js.flow +51 -5
- package/lib/commonjs/screens/toan-trinh-so/RegisterCamera.js.map +1 -1
- package/lib/commonjs/screens/toan-trinh-so/TTSSelfie.js +1 -1
- package/lib/commonjs/screens/toan-trinh-so/TTSSelfie.js.flow +26 -4
- package/lib/commonjs/screens/toan-trinh-so/TTSSelfie.js.map +1 -1
- package/lib/commonjs/screens/toan-trinh-so/VehicleCamera.js +1 -1
- package/lib/commonjs/screens/toan-trinh-so/VehicleCamera.js.flow +53 -5
- package/lib/commonjs/screens/toan-trinh-so/VehicleCamera.js.map +1 -1
- package/lib/module/screens/toan-trinh-so/OCR.js +1 -1
- package/lib/module/screens/toan-trinh-so/OCR.js.map +1 -1
- package/lib/module/screens/toan-trinh-so/RegisterCamera.js +1 -1
- package/lib/module/screens/toan-trinh-so/RegisterCamera.js.map +1 -1
- package/lib/module/screens/toan-trinh-so/TTSSelfie.js +1 -1
- package/lib/module/screens/toan-trinh-so/TTSSelfie.js.map +1 -1
- package/lib/module/screens/toan-trinh-so/VehicleCamera.js +1 -1
- package/lib/module/screens/toan-trinh-so/VehicleCamera.js.map +1 -1
- package/lib/typescript/screens/toan-trinh-so/OCR.d.ts.map +1 -1
- package/lib/typescript/screens/toan-trinh-so/RegisterCamera.d.ts.map +1 -1
- package/lib/typescript/screens/toan-trinh-so/TTSSelfie.d.ts.map +1 -1
- package/lib/typescript/screens/toan-trinh-so/VehicleCamera.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/screens/toan-trinh-so/OCR.tsx +69 -14
- package/src/screens/toan-trinh-so/RegisterCamera.tsx +51 -5
- package/src/screens/toan-trinh-so/TTSSelfie.tsx +26 -4
- package/src/screens/toan-trinh-so/VehicleCamera.tsx +53 -5
- /package/lib/commonjs/assets/tts/{Frame 1000011947.png → Frame1000011947.png} +0 -0
- /package/lib/module/assets/tts/{Frame 1000011947.png → Frame1000011947.png} +0 -0
- /package/src/assets/tts/{Frame 1000011947.png → Frame1000011947.png} +0 -0
|
@@ -5,6 +5,7 @@ import {
|
|
|
5
5
|
Dimensions,
|
|
6
6
|
Image,
|
|
7
7
|
ImageStyle,
|
|
8
|
+
PermissionsAndroid,
|
|
8
9
|
Platform,
|
|
9
10
|
SafeAreaView,
|
|
10
11
|
TextStyle,
|
|
@@ -12,7 +13,11 @@ import {
|
|
|
12
13
|
View,
|
|
13
14
|
ViewStyle,
|
|
14
15
|
} from 'react-native';
|
|
15
|
-
import {
|
|
16
|
+
import {
|
|
17
|
+
CommonActions,
|
|
18
|
+
useNavigation,
|
|
19
|
+
useIsFocused,
|
|
20
|
+
} from '@react-navigation/native';
|
|
16
21
|
import Modal from 'react-native-modal';
|
|
17
22
|
import { MText } from '../../components/MText';
|
|
18
23
|
import LinearGradient from 'react-native-linear-gradient';
|
|
@@ -37,6 +42,8 @@ import { IconUpload } from '../../assets/svgs';
|
|
|
37
42
|
import ImagePicker from 'react-native-image-crop-picker';
|
|
38
43
|
|
|
39
44
|
export default function VehicleCamera(props: any) {
|
|
45
|
+
const isFocused = useIsFocused();
|
|
46
|
+
const [shouldRenderCamera, setShouldRenderCamera] = useState(false);
|
|
40
47
|
const navigation = useNavigation();
|
|
41
48
|
const [showModal, setShowModal] = useState(false);
|
|
42
49
|
const [title, setTitle] = useState(
|
|
@@ -175,19 +182,58 @@ export default function VehicleCamera(props: any) {
|
|
|
175
182
|
loadIntro();
|
|
176
183
|
}, []);
|
|
177
184
|
|
|
185
|
+
useEffect(() => {
|
|
186
|
+
let timeout: NodeJS.Timeout;
|
|
187
|
+
|
|
188
|
+
if (isFocused) {
|
|
189
|
+
// Delay mounting camera to give Android time to release the previous one
|
|
190
|
+
timeout = setTimeout(() => {
|
|
191
|
+
setShouldRenderCamera(true);
|
|
192
|
+
}, 500); // thử 300ms–500ms nếu cần
|
|
193
|
+
} else {
|
|
194
|
+
setShouldRenderCamera(false);
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
return () => clearTimeout(timeout);
|
|
198
|
+
}, [isFocused]);
|
|
199
|
+
|
|
178
200
|
const pickImageFromGallery = async () => {
|
|
201
|
+
if (Platform.OS === 'android') {
|
|
202
|
+
const granted = await PermissionsAndroid.request(
|
|
203
|
+
PermissionsAndroid.PERMISSIONS.READ_MEDIA_IMAGES ||
|
|
204
|
+
PermissionsAndroid.PERMISSIONS.READ_EXTERNAL_STORAGE,
|
|
205
|
+
{
|
|
206
|
+
title: 'Permission to access photos',
|
|
207
|
+
message: 'App needs access to your photos to pick images.',
|
|
208
|
+
buttonNeutral: 'Ask Me Later',
|
|
209
|
+
buttonNegative: 'Cancel',
|
|
210
|
+
buttonPositive: 'OK',
|
|
211
|
+
}
|
|
212
|
+
);
|
|
213
|
+
|
|
214
|
+
if (granted !== PermissionsAndroid.RESULTS.GRANTED) {
|
|
215
|
+
console.log('Permission denied');
|
|
216
|
+
return;
|
|
217
|
+
}
|
|
218
|
+
}
|
|
179
219
|
ImagePicker.openPicker({}).then((image) => {
|
|
220
|
+
console.log(image);
|
|
221
|
+
|
|
180
222
|
if (props?.route?.params?.front) {
|
|
181
223
|
navigation.push(ScreenNames.VehicleRegistrationFront, {
|
|
182
|
-
uri:
|
|
224
|
+
uri:
|
|
225
|
+
Platform.OS === 'android' ? image?.path : 'file://' + image?.path,
|
|
183
226
|
loan: props?.route?.params?.loan,
|
|
184
227
|
});
|
|
185
228
|
} else if (props.route?.params?.callback) {
|
|
186
229
|
navigation.goBack();
|
|
187
|
-
props.route?.params?.callback(
|
|
230
|
+
props.route?.params?.callback(
|
|
231
|
+
Platform.OS === 'android' ? image?.path : 'file://' + image?.path
|
|
232
|
+
);
|
|
188
233
|
} else {
|
|
189
234
|
navigation.push(ScreenNames.VehicleRegistrationBack, {
|
|
190
|
-
uri:
|
|
235
|
+
uri:
|
|
236
|
+
Platform.OS === 'android' ? image?.path : 'file://' + image?.path,
|
|
191
237
|
loan: props?.route?.params?.loan,
|
|
192
238
|
});
|
|
193
239
|
}
|
|
@@ -199,7 +245,7 @@ export default function VehicleCamera(props: any) {
|
|
|
199
245
|
style={[$flex, { backgroundColor: 'black' }]}
|
|
200
246
|
pointerEvents={'box-none'}
|
|
201
247
|
>
|
|
202
|
-
{passPermission && (
|
|
248
|
+
{passPermission && shouldRenderCamera ? (
|
|
203
249
|
<View
|
|
204
250
|
style={[
|
|
205
251
|
commonStyles.alignCenter,
|
|
@@ -339,6 +385,8 @@ export default function VehicleCamera(props: any) {
|
|
|
339
385
|
</MText>
|
|
340
386
|
</SafeAreaView>
|
|
341
387
|
</View>
|
|
388
|
+
) : (
|
|
389
|
+
<></>
|
|
342
390
|
)}
|
|
343
391
|
<Modal
|
|
344
392
|
isVisible={showModal}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|