Phecda

feat: add RNCode and RNImageCropPicker/RNSVG

@@ -137,6 +137,7 @@ android { @@ -137,6 +137,7 @@ android {
137 versionName "1.0" 137 versionName "1.0"
138 missingDimensionStrategy 'react-native-camera', 'general' 138 missingDimensionStrategy 'react-native-camera', 'general'
139 multiDexEnabled true 139 multiDexEnabled true
  140 + vectorDrawables.useSupportLibrary true
140 } 141 }
141 splits { 142 splits {
142 abi { 143 abi {
@@ -30,7 +30,7 @@ allprojects { @@ -30,7 +30,7 @@ allprojects {
30 // Android JSC is installed from npm 30 // Android JSC is installed from npm
31 url("$rootDir/../node_modules/jsc-android/dist") 31 url("$rootDir/../node_modules/jsc-android/dist")
32 } 32 }
33 - 33 + maven { url 'https://maven.google.com' }
34 google() 34 google()
35 jcenter() 35 jcenter()
36 maven { url 'https://www.jitpack.io' } 36 maven { url 'https://www.jitpack.io' }
@@ -427,6 +427,7 @@ @@ -427,6 +427,7 @@
427 ); 427 );
428 inputPaths = ( 428 inputPaths = (
429 "${PODS_ROOT}/Target Support Files/Pods-NGPlay-NGPlayTests/Pods-NGPlay-NGPlayTests-resources.sh", 429 "${PODS_ROOT}/Target Support Files/Pods-NGPlay-NGPlayTests/Pods-NGPlay-NGPlayTests-resources.sh",
  430 + "${PODS_CONFIGURATION_BUILD_DIR}/RNImageCropPicker/QBImagePicker.bundle",
430 "${PODS_ROOT}/../../node_modules/react-native-vector-icons/Fonts/AntDesign.ttf", 431 "${PODS_ROOT}/../../node_modules/react-native-vector-icons/Fonts/AntDesign.ttf",
431 "${PODS_ROOT}/../../node_modules/react-native-vector-icons/Fonts/Entypo.ttf", 432 "${PODS_ROOT}/../../node_modules/react-native-vector-icons/Fonts/Entypo.ttf",
432 "${PODS_ROOT}/../../node_modules/react-native-vector-icons/Fonts/EvilIcons.ttf", 433 "${PODS_ROOT}/../../node_modules/react-native-vector-icons/Fonts/EvilIcons.ttf",
@@ -443,9 +444,11 @@ @@ -443,9 +444,11 @@
443 "${PODS_ROOT}/../../node_modules/react-native-vector-icons/Fonts/Octicons.ttf", 444 "${PODS_ROOT}/../../node_modules/react-native-vector-icons/Fonts/Octicons.ttf",
444 "${PODS_ROOT}/../../node_modules/react-native-vector-icons/Fonts/SimpleLineIcons.ttf", 445 "${PODS_ROOT}/../../node_modules/react-native-vector-icons/Fonts/SimpleLineIcons.ttf",
445 "${PODS_ROOT}/../../node_modules/react-native-vector-icons/Fonts/Zocial.ttf", 446 "${PODS_ROOT}/../../node_modules/react-native-vector-icons/Fonts/Zocial.ttf",
  447 + "${PODS_ROOT}/RSKImageCropper/RSKImageCropper/RSKImageCropperStrings.bundle",
446 ); 448 );
447 name = "[CP] Copy Pods Resources"; 449 name = "[CP] Copy Pods Resources";
448 outputPaths = ( 450 outputPaths = (
  451 + "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/QBImagePicker.bundle",
449 "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/AntDesign.ttf", 452 "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/AntDesign.ttf",
450 "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/Entypo.ttf", 453 "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/Entypo.ttf",
451 "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/EvilIcons.ttf", 454 "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/EvilIcons.ttf",
@@ -462,6 +465,7 @@ @@ -462,6 +465,7 @@
462 "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/Octicons.ttf", 465 "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/Octicons.ttf",
463 "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/SimpleLineIcons.ttf", 466 "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/SimpleLineIcons.ttf",
464 "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/Zocial.ttf", 467 "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/Zocial.ttf",
  468 + "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/RSKImageCropperStrings.bundle",
465 ); 469 );
466 runOnlyForDeploymentPostprocessing = 0; 470 runOnlyForDeploymentPostprocessing = 0;
467 shellPath = /bin/sh; 471 shellPath = /bin/sh;
@@ -541,6 +545,7 @@ @@ -541,6 +545,7 @@
541 ); 545 );
542 inputPaths = ( 546 inputPaths = (
543 "${PODS_ROOT}/Target Support Files/Pods-NGPlay/Pods-NGPlay-resources.sh", 547 "${PODS_ROOT}/Target Support Files/Pods-NGPlay/Pods-NGPlay-resources.sh",
  548 + "${PODS_CONFIGURATION_BUILD_DIR}/RNImageCropPicker/QBImagePicker.bundle",
544 "${PODS_ROOT}/../../node_modules/react-native-vector-icons/Fonts/AntDesign.ttf", 549 "${PODS_ROOT}/../../node_modules/react-native-vector-icons/Fonts/AntDesign.ttf",
545 "${PODS_ROOT}/../../node_modules/react-native-vector-icons/Fonts/Entypo.ttf", 550 "${PODS_ROOT}/../../node_modules/react-native-vector-icons/Fonts/Entypo.ttf",
546 "${PODS_ROOT}/../../node_modules/react-native-vector-icons/Fonts/EvilIcons.ttf", 551 "${PODS_ROOT}/../../node_modules/react-native-vector-icons/Fonts/EvilIcons.ttf",
@@ -557,9 +562,11 @@ @@ -557,9 +562,11 @@
557 "${PODS_ROOT}/../../node_modules/react-native-vector-icons/Fonts/Octicons.ttf", 562 "${PODS_ROOT}/../../node_modules/react-native-vector-icons/Fonts/Octicons.ttf",
558 "${PODS_ROOT}/../../node_modules/react-native-vector-icons/Fonts/SimpleLineIcons.ttf", 563 "${PODS_ROOT}/../../node_modules/react-native-vector-icons/Fonts/SimpleLineIcons.ttf",
559 "${PODS_ROOT}/../../node_modules/react-native-vector-icons/Fonts/Zocial.ttf", 564 "${PODS_ROOT}/../../node_modules/react-native-vector-icons/Fonts/Zocial.ttf",
  565 + "${PODS_ROOT}/RSKImageCropper/RSKImageCropper/RSKImageCropperStrings.bundle",
560 ); 566 );
561 name = "[CP] Copy Pods Resources"; 567 name = "[CP] Copy Pods Resources";
562 outputPaths = ( 568 outputPaths = (
  569 + "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/QBImagePicker.bundle",
563 "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/AntDesign.ttf", 570 "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/AntDesign.ttf",
564 "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/Entypo.ttf", 571 "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/Entypo.ttf",
565 "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/EvilIcons.ttf", 572 "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/EvilIcons.ttf",
@@ -576,6 +583,7 @@ @@ -576,6 +583,7 @@
576 "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/Octicons.ttf", 583 "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/Octicons.ttf",
577 "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/SimpleLineIcons.ttf", 584 "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/SimpleLineIcons.ttf",
578 "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/Zocial.ttf", 585 "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/Zocial.ttf",
  586 + "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/RSKImageCropperStrings.bundle",
579 ); 587 );
580 runOnlyForDeploymentPostprocessing = 0; 588 runOnlyForDeploymentPostprocessing = 0;
581 shellPath = /bin/sh; 589 shellPath = /bin/sh;
@@ -247,6 +247,8 @@ PODS: @@ -247,6 +247,8 @@ PODS:
247 - React 247 - React
248 - react-native-camera/RN (3.23.1): 248 - react-native-camera/RN (3.23.1):
249 - React 249 - React
  250 + - react-native-code (1.0.0-0):
  251 + - React
250 - react-native-netinfo (5.7.1): 252 - react-native-netinfo (5.7.1):
251 - React 253 - React
252 - react-native-safe-area-context (0.7.3): 254 - react-native-safe-area-context (0.7.3):
@@ -322,6 +324,15 @@ PODS: @@ -322,6 +324,15 @@ PODS:
322 - React 324 - React
323 - RNGestureHandler (1.6.1): 325 - RNGestureHandler (1.6.1):
324 - React 326 - React
  327 + - RNImageCropPicker (0.28.0):
  328 + - React-Core
  329 + - React-RCTImage
  330 + - RNImageCropPicker/QBImagePickerController (= 0.28.0)
  331 + - RSKImageCropper
  332 + - RNImageCropPicker/QBImagePickerController (0.28.0):
  333 + - React-Core
  334 + - React-RCTImage
  335 + - RSKImageCropper
325 - RNLocalize (1.4.0): 336 - RNLocalize (1.4.0):
326 - React 337 - React
327 - RNPermissions (2.1.2): 338 - RNPermissions (2.1.2):
@@ -330,8 +341,11 @@ PODS: @@ -330,8 +341,11 @@ PODS:
330 - React 341 - React
331 - RNScreens (2.4.0): 342 - RNScreens (2.4.0):
332 - React 343 - React
  344 + - RNSVG (12.1.0):
  345 + - React
333 - RNVectorIcons (6.6.0): 346 - RNVectorIcons (6.6.0):
334 - React 347 - React
  348 + - RSKImageCropper (2.2.3)
335 - Yoga (1.14.0) 349 - Yoga (1.14.0)
336 - YogaKit (1.18.1): 350 - YogaKit (1.18.1):
337 - Yoga (~> 1.14) 351 - Yoga (~> 1.14)
@@ -362,6 +376,7 @@ DEPENDENCIES: @@ -362,6 +376,7 @@ DEPENDENCIES:
362 - React-jsiexecutor (from `../node_modules/react-native/ReactCommon/jsiexecutor`) 376 - React-jsiexecutor (from `../node_modules/react-native/ReactCommon/jsiexecutor`)
363 - React-jsinspector (from `../node_modules/react-native/ReactCommon/jsinspector`) 377 - React-jsinspector (from `../node_modules/react-native/ReactCommon/jsinspector`)
364 - react-native-camera (from `../node_modules/react-native-camera`) 378 - react-native-camera (from `../node_modules/react-native-camera`)
  379 + - "react-native-code (from `../node_modules/@phecdas/react-native-code`)"
365 - "react-native-netinfo (from `../node_modules/@react-native-community/netinfo`)" 380 - "react-native-netinfo (from `../node_modules/@react-native-community/netinfo`)"
366 - react-native-safe-area-context (from `../node_modules/react-native-safe-area-context`) 381 - react-native-safe-area-context (from `../node_modules/react-native-safe-area-context`)
367 - react-native-webview (from `../node_modules/react-native-webview`) 382 - react-native-webview (from `../node_modules/react-native-webview`)
@@ -381,10 +396,12 @@ DEPENDENCIES: @@ -381,10 +396,12 @@ DEPENDENCIES:
381 - "RNCMaskedView (from `../node_modules/@react-native-community/masked-view`)" 396 - "RNCMaskedView (from `../node_modules/@react-native-community/masked-view`)"
382 - RNDeviceInfo (from `../node_modules/react-native-device-info`) 397 - RNDeviceInfo (from `../node_modules/react-native-device-info`)
383 - RNGestureHandler (from `../node_modules/react-native-gesture-handler`) 398 - RNGestureHandler (from `../node_modules/react-native-gesture-handler`)
  399 + - RNImageCropPicker (from `../node_modules/react-native-image-crop-picker`)
384 - RNLocalize (from `../node_modules/react-native-localize`) 400 - RNLocalize (from `../node_modules/react-native-localize`)
385 - RNPermissions (from `../node_modules/react-native-permissions`) 401 - RNPermissions (from `../node_modules/react-native-permissions`)
386 - RNReanimated (from `../node_modules/react-native-reanimated`) 402 - RNReanimated (from `../node_modules/react-native-reanimated`)
387 - RNScreens (from `../node_modules/react-native-screens`) 403 - RNScreens (from `../node_modules/react-native-screens`)
  404 + - RNSVG (from `../node_modules/react-native-svg`)
388 - RNVectorIcons (from `../node_modules/react-native-vector-icons`) 405 - RNVectorIcons (from `../node_modules/react-native-vector-icons`)
389 - Yoga (from `../node_modules/react-native/ReactCommon/yoga`) 406 - Yoga (from `../node_modules/react-native/ReactCommon/yoga`)
390 407
@@ -401,6 +418,7 @@ SPEC REPOS: @@ -401,6 +418,7 @@ SPEC REPOS:
401 - Flipper-RSocket 418 - Flipper-RSocket
402 - FlipperKit 419 - FlipperKit
403 - OpenSSL-Universal 420 - OpenSSL-Universal
  421 + - RSKImageCropper
404 - YogaKit 422 - YogaKit
405 423
406 EXTERNAL SOURCES: 424 EXTERNAL SOURCES:
@@ -440,6 +458,8 @@ EXTERNAL SOURCES: @@ -440,6 +458,8 @@ EXTERNAL SOURCES:
440 :path: "../node_modules/react-native/ReactCommon/jsinspector" 458 :path: "../node_modules/react-native/ReactCommon/jsinspector"
441 react-native-camera: 459 react-native-camera:
442 :path: "../node_modules/react-native-camera" 460 :path: "../node_modules/react-native-camera"
  461 + react-native-code:
  462 + :path: "../node_modules/@phecdas/react-native-code"
443 react-native-netinfo: 463 react-native-netinfo:
444 :path: "../node_modules/@react-native-community/netinfo" 464 :path: "../node_modules/@react-native-community/netinfo"
445 react-native-safe-area-context: 465 react-native-safe-area-context:
@@ -476,6 +496,8 @@ EXTERNAL SOURCES: @@ -476,6 +496,8 @@ EXTERNAL SOURCES:
476 :path: "../node_modules/react-native-device-info" 496 :path: "../node_modules/react-native-device-info"
477 RNGestureHandler: 497 RNGestureHandler:
478 :path: "../node_modules/react-native-gesture-handler" 498 :path: "../node_modules/react-native-gesture-handler"
  499 + RNImageCropPicker:
  500 + :path: "../node_modules/react-native-image-crop-picker"
479 RNLocalize: 501 RNLocalize:
480 :path: "../node_modules/react-native-localize" 502 :path: "../node_modules/react-native-localize"
481 RNPermissions: 503 RNPermissions:
@@ -484,6 +506,8 @@ EXTERNAL SOURCES: @@ -484,6 +506,8 @@ EXTERNAL SOURCES:
484 :path: "../node_modules/react-native-reanimated" 506 :path: "../node_modules/react-native-reanimated"
485 RNScreens: 507 RNScreens:
486 :path: "../node_modules/react-native-screens" 508 :path: "../node_modules/react-native-screens"
  509 + RNSVG:
  510 + :path: "../node_modules/react-native-svg"
487 RNVectorIcons: 511 RNVectorIcons:
488 :path: "../node_modules/react-native-vector-icons" 512 :path: "../node_modules/react-native-vector-icons"
489 Yoga: 513 Yoga:
@@ -519,6 +543,7 @@ SPEC CHECKSUMS: @@ -519,6 +543,7 @@ SPEC CHECKSUMS:
519 React-jsiexecutor: e9698dee4fd43ceb44832baf15d5745f455b0157 543 React-jsiexecutor: e9698dee4fd43ceb44832baf15d5745f455b0157
520 React-jsinspector: f74a62727e5604119abd4a1eda52c0a12144bcd5 544 React-jsinspector: f74a62727e5604119abd4a1eda52c0a12144bcd5
521 react-native-camera: 1b52abea404d04e040edb3e74b7c5523c01a3089 545 react-native-camera: 1b52abea404d04e040edb3e74b7c5523c01a3089
  546 + react-native-code: 8a278a6a05c9f039be48c01957f6902027bd5180
522 react-native-netinfo: 4fa023c153d582aeae8435df95c9a975c5986449 547 react-native-netinfo: 4fa023c153d582aeae8435df95c9a975c5986449
523 react-native-safe-area-context: e200d4433aba6b7e60b52da5f37af11f7a0b0392 548 react-native-safe-area-context: e200d4433aba6b7e60b52da5f37af11f7a0b0392
524 react-native-webview: 0633fd7861a9bd7a80bacaee7da763c3afc248fa 549 react-native-webview: 0633fd7861a9bd7a80bacaee7da763c3afc248fa
@@ -537,11 +562,14 @@ SPEC CHECKSUMS: @@ -537,11 +562,14 @@ SPEC CHECKSUMS:
537 RNCMaskedView: 76c40a1d41c3e2535df09246a2b5487f04de0814 562 RNCMaskedView: 76c40a1d41c3e2535df09246a2b5487f04de0814
538 RNDeviceInfo: 6a3d16fce033f6979c4a6a41e62244d183e8c765 563 RNDeviceInfo: 6a3d16fce033f6979c4a6a41e62244d183e8c765
539 RNGestureHandler: 8f09cd560f8d533eb36da5a6c5a843af9f056b38 564 RNGestureHandler: 8f09cd560f8d533eb36da5a6c5a843af9f056b38
  565 + RNImageCropPicker: cf129d17e042ce3e96fb9ada967c28f21f977c82
540 RNLocalize: b6df30cc25ae736d37874f9bce13351db2f56796 566 RNLocalize: b6df30cc25ae736d37874f9bce13351db2f56796
541 RNPermissions: a96580116f7894146552e92b000ac30bf1661947 567 RNPermissions: a96580116f7894146552e92b000ac30bf1661947
542 RNReanimated: 4e102df74a9674fa943e05f97f3362b6e44d0b48 568 RNReanimated: 4e102df74a9674fa943e05f97f3362b6e44d0b48
543 RNScreens: b5c0e1b2b04512919e78bd3898e144a157ce2363 569 RNScreens: b5c0e1b2b04512919e78bd3898e144a157ce2363
  570 + RNSVG: ce9d996113475209013317e48b05c21ee988d42e
544 RNVectorIcons: 0bb4def82230be1333ddaeee9fcba45f0b288ed4 571 RNVectorIcons: 0bb4def82230be1333ddaeee9fcba45f0b288ed4
  572 + RSKImageCropper: a446db0e8444a036b34f3c43db01b2373baa4b2a
545 Yoga: 50fb6eb13d2152e7363293ff603385db380815b1 573 Yoga: 50fb6eb13d2152e7363293ff603385db380815b1
546 YogaKit: f782866e155069a2cca2517aafea43200b01fd5a 574 YogaKit: f782866e155069a2cca2517aafea43200b01fd5a
547 575
@@ -14,6 +14,7 @@ @@ -14,6 +14,7 @@
14 "@huse/boolean": "^1.0.2", 14 "@huse/boolean": "^1.0.2",
15 "@huse/immer": "^1.0.2", 15 "@huse/immer": "^1.0.2",
16 "@huse/previous-value": "^1.0.1", 16 "@huse/previous-value": "^1.0.1",
  17 + "@phecdas/react-native-code": "^1.0.0-1",
17 "@react-native-community/art": "^1.2.0", 18 "@react-native-community/art": "^1.2.0",
18 "@react-native-community/masked-view": "^0.1.7", 19 "@react-native-community/masked-view": "^0.1.7",
19 "@react-native-community/netinfo": "^5.7.1", 20 "@react-native-community/netinfo": "^5.7.1",
@@ -30,12 +31,14 @@ @@ -30,12 +31,14 @@
30 "react-native-device-info": "^5.5.4", 31 "react-native-device-info": "^5.5.4",
31 "react-native-elements": "^1.2.7", 32 "react-native-elements": "^1.2.7",
32 "react-native-gesture-handler": "^1.6.1", 33 "react-native-gesture-handler": "^1.6.1",
  34 + "react-native-image-crop-picker": "^0.28.0",
33 "react-native-localize": "^1.4.0", 35 "react-native-localize": "^1.4.0",
34 "react-native-permissions": "^2.1.2", 36 "react-native-permissions": "^2.1.2",
35 "react-native-progress": "^4.1.2", 37 "react-native-progress": "^4.1.2",
36 "react-native-reanimated": "^1.7.1", 38 "react-native-reanimated": "^1.7.1",
37 "react-native-safe-area-context": "^0.7.3", 39 "react-native-safe-area-context": "^0.7.3",
38 "react-native-screens": "^2.4.0", 40 "react-native-screens": "^2.4.0",
  41 + "react-native-svg": "^12.1.0",
39 "react-native-tab-view": "^2.13.0", 42 "react-native-tab-view": "^2.13.0",
40 "react-native-vector-icons": "^6.6.0", 43 "react-native-vector-icons": "^6.6.0",
41 "react-native-webview": "9.1.1", 44 "react-native-webview": "9.1.1",
@@ -22,6 +22,7 @@ import RNLocalize from './RNLocalize'; @@ -22,6 +22,7 @@ import RNLocalize from './RNLocalize';
22 import { useI18nStrings } from '../i18n'; 22 import { useI18nStrings } from '../i18n';
23 import CameraScreen from './CameraScreen'; 23 import CameraScreen from './CameraScreen';
24 import Library from './Library'; 24 import Library from './Library';
  25 +import ReadableCode from './ReadableCode';
25 26
26 const MainTab = createBottomTabNavigator<MainTabParamList>(); 27 const MainTab = createBottomTabNavigator<MainTabParamList>();
27 28
@@ -123,6 +124,7 @@ const Container = () => { @@ -123,6 +124,7 @@ const Container = () => {
123 /> 124 />
124 <MainStack.Screen name="RNLocalize" component={RNLocalize} /> 125 <MainStack.Screen name="RNLocalize" component={RNLocalize} />
125 <MainStack.Screen name="RNCamera" component={CameraScreen} /> 126 <MainStack.Screen name="RNCamera" component={CameraScreen} />
  127 + <MainStack.Screen name="RNCode" component={ReadableCode} />
126 </MainStack.Navigator> 128 </MainStack.Navigator>
127 </NavigationContainer> 129 </NavigationContainer>
128 ); 130 );
@@ -35,6 +35,12 @@ const Library = ({ navigation }: MainTabScreenProps<'Library'>) => { @@ -35,6 +35,12 @@ const Library = ({ navigation }: MainTabScreenProps<'Library'>) => {
35 onPress={() => navigation.navigate('RNCamera')} 35 onPress={() => navigation.navigate('RNCamera')}
36 chevron 36 chevron
37 /> 37 />
  38 + <Divider />
  39 + <ListItem
  40 + title={'Readable Code'}
  41 + onPress={() => navigation.navigate('RNCode')}
  42 + chevron
  43 + />
38 </BGScroll> 44 </BGScroll>
39 ); 45 );
40 }; 46 };
  1 +import React, { useState } from 'react';
  2 +import { QRCode, BarCode, readCodeFromUri } from '@phecdas/react-native-code';
  3 +import ImagePicker from 'react-native-image-crop-picker';
  4 +import { BGScroll, Card, ListItem } from '../component/View';
  5 +import { Input } from 'react-native-elements';
  6 +import { View, StyleSheet, Platform } from 'react-native';
  7 +
  8 +const styles = StyleSheet.create({
  9 + codeWrapper: { alignItems: 'center', padding: 20 },
  10 +});
  11 +
  12 +const ReadableCode = () => {
  13 + const [qrValue, setQRValue] = useState('A brave new world');
  14 + const [barValue, setBarValue] = useState('1234567890');
  15 + const [readResult, setResult] = useState('');
  16 + return (
  17 + <BGScroll>
  18 + <Card round>
  19 + <Input
  20 + defaultValue={qrValue}
  21 + onSubmitEditing={(e) => setQRValue(e.nativeEvent.text)}
  22 + placeholder="QR Code"
  23 + />
  24 + {!!qrValue && (
  25 + <View style={styles.codeWrapper}>
  26 + <QRCode value={qrValue} size={200} />
  27 + </View>
  28 + )}
  29 + </Card>
  30 + <Card round>
  31 + <Input
  32 + defaultValue={barValue}
  33 + onSubmitEditing={(e) => setBarValue(e.nativeEvent.text)}
  34 + placeholder="Bar Code"
  35 + keyboardType="number-pad"
  36 + />
  37 + {!!barValue && (
  38 + <View style={styles.codeWrapper}>
  39 + <BarCode value={barValue} width={200} height={100} />
  40 + </View>
  41 + )}
  42 + </Card>
  43 + <Card round>
  44 + <ListItem
  45 + title="Read from image..."
  46 + rightTitle={readResult}
  47 + onPress={async () => {
  48 + try {
  49 + const result = await ImagePicker.openPicker({
  50 + mediaType: 'photo',
  51 + });
  52 + const path = Array.isArray(result) ? result[0].path : result.path;
  53 + const value = await readCodeFromUri(
  54 + Platform.OS === 'ios' ? 'file://' : '' + path
  55 + );
  56 + setResult(value);
  57 + } catch (err) {
  58 + setResult('error: ' + err.message);
  59 + }
  60 + }}
  61 + />
  62 + </Card>
  63 + </BGScroll>
  64 + );
  65 +};
  66 +
  67 +export default ReadableCode;
@@ -14,6 +14,7 @@ export type MainStackParamList = { @@ -14,6 +14,7 @@ export type MainStackParamList = {
14 WebviewScreen: { uri: string } | undefined; 14 WebviewScreen: { uri: string } | undefined;
15 RNLocalize: undefined; 15 RNLocalize: undefined;
16 RNCamera: undefined; 16 RNCamera: undefined;
  17 + RNCode: undefined;
17 }; 18 };
18 19
19 export type MainTabScreenProps<RouteName extends keyof MainTabParamList> = { 20 export type MainTabScreenProps<RouteName extends keyof MainTabParamList> = {
This diff is collapsed. Click to expand it.