11import React , { useEffect } from 'react' ;
2- import { ActivityIndicator , StyleSheet , View } from 'react-native' ;
2+ import { ActivityIndicator , StyleSheet } from 'react-native' ;
33import { createNativeStackNavigator } from '@react-navigation/native-stack' ;
44import { NavigationContainer } from '@react-navigation/native' ;
55import {
@@ -10,18 +10,17 @@ import {
1010 useBarcodeFormats ,
1111 useLoading ,
1212} from '@context' ;
13+ import { SafeAreaProvider } from 'react-native-safe-area-context' ;
1314import { COLORS , NavigationTheme } from '@theme' ;
1415import { FILE_ENCRYPTION_ENABLED , Screens , ScreenTitles } from '@utils' ;
16+
1517import { BarcodeDocumentFormatsScreen } from './src/screens/BarcodeDocumentFormatsScreen' ;
1618import { BarcodeCameraViewScreen } from './src/screens/BarcodeCameraViewScreen' ;
1719import { BarcodeFormatsScreen } from './src/screens/BarcodeFormatsScreen' ;
1820import { HomeScreen } from './src/screens/HomeScreen' ;
19- import { ImageResultsScreen } from './src/screens/ImageResultsScreen' ;
2021import { BarcodeResultsScreen } from './src/screens/BarcodeResultsScreen' ;
2122
22- import ScanbotBarcodeSDK , {
23- ScanbotBarcodeSdkConfiguration ,
24- } from 'react-native-scanbot-barcode-scanner-sdk' ;
23+ import ScanbotBarcodeSDK , { SdkConfiguration } from 'react-native-scanbot-barcode-scanner-sdk' ;
2524
2625const Stack = createNativeStackNavigator ( ) ;
2726
@@ -41,38 +40,32 @@ export default function App() {
4140 const [ loading , setLoading ] = useLoading ( ) ;
4241
4342 useEffect ( ( ) => {
44- const configuration : ScanbotBarcodeSdkConfiguration = {
43+ const configuration = new SdkConfiguration ( {
4544 // Consider switching logging OFF in production builds for security and performance reasons!
4645 loggingEnabled : true ,
4746 enableNativeLogging : false ,
4847 licenseKey : LICENSE_KEY ,
4948 // Optional custom storage directory
50- // storageBaseDirectory: Platform.select({
51- // ios: DocumentDirectoryPath + '/my-custom-storage',
52- // android: ExternalDirectoryPath + '/my-custom-storage',
53- // default: undefined,
54- // }),
55- } ;
49+ // storageBaseDirectory: DocumentDirectoryPath + '/my-custom-storage',
50+ } ) ;
5651
5752 // Set the following properties to enable encryption.
5853 if ( FILE_ENCRYPTION_ENABLED ) {
5954 configuration . fileEncryptionMode = 'AES256' ;
6055 configuration . fileEncryptionPassword = 'SomeSecretPa$$w0rdForFileEncryption' ;
6156 }
6257
63- ScanbotBarcodeSDK . initializeSdk ( configuration )
58+ ScanbotBarcodeSDK . initialize ( configuration )
6459 . then ( result => {
6560 console . log ( result ) ;
6661 } )
6762 . catch ( error => {
6863 console . error ( 'Initialization error: ' , error . message ) ;
6964 } ) ;
70-
71- console . log ( `Using ${ ( global as any ) ?. nativeFabricUIManager ? 'New' : 'Old' } Architecture` ) ;
7265 } , [ ] ) ;
7366
7467 return (
75- < View style = { styles . container } >
68+ < SafeAreaProvider >
7669 < BarcodeDocumentFormatContext . Provider value = { barcodeDocumentFormatsValues } >
7770 < BarcodeFormatsContext . Provider value = { barcodeFormatsValues } >
7871 < ActivityIndicatorContext . Provider value = { { setLoading } } >
@@ -93,7 +86,6 @@ export default function App() {
9386 name = { Screens . BARCODE_CAMERA_VIEW }
9487 component = { BarcodeCameraViewScreen }
9588 />
96- < Stack . Screen name = { Screens . IMAGE_RESULTS } component = { ImageResultsScreen } />
9789 < Stack . Screen name = { Screens . BARCODE_RESULTS } component = { BarcodeResultsScreen } />
9890 </ Stack . Navigator >
9991 </ NavigationContainer >
@@ -106,14 +98,11 @@ export default function App() {
10698 </ ActivityIndicatorContext . Provider >
10799 </ BarcodeFormatsContext . Provider >
108100 </ BarcodeDocumentFormatContext . Provider >
109- </ View >
101+ </ SafeAreaProvider >
110102 ) ;
111103}
112104
113105const styles = StyleSheet . create ( {
114- container : {
115- flex : 1 ,
116- } ,
117106 loadingIndicator : {
118107 elevation : 6 ,
119108 position : 'absolute' ,
0 commit comments