Skip to content

Commit

Permalink
fix(useinternalbarcoderead.ts): fix platform selection
Browse files Browse the repository at this point in the history
  • Loading branch information
nartc committed Jan 27, 2020
1 parent f2b6350 commit c9e9b8e
Show file tree
Hide file tree
Showing 11 changed files with 394 additions and 312 deletions.
62 changes: 40 additions & 22 deletions example/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,44 +21,59 @@ import {
import {RNCamera} from 'react-native-camera';
import {
BarcodeMaskWithOuterLayout,
useCustomBarcodeRead,
useBarcodeRead,
} from './@nartc/react-native-barcode-mask/react-native-barcode-mask.esm';

const App = () => {
const rnCamera = useRef(null);
const [barcodeReadCount, setBarcodeReadCount] = useState(0);
const [barcodeReadAware, setBarcodeReadAware] = useState(false);
const [barcodeRead, setBarcodeRead] = useState(false);
const {onBarcodeFinderLayoutChange, onBarcodeRead} = useCustomBarcodeRead(
// const [barcodeRead, setBarcodeRead] = useState(false);
// const {onBarcodeFinderLayoutChange, onBarcodeRead} = useCustomBarcodeRead(
// true,
// data => data,
// processed => {
// console.log(processed, {barcodeReadCount});
// setBarcodeReadCount(prev => prev + 1);
// },
// {
// beforeScan: () => {
// setBarcodeRead(true);
// },
// afterScan: () => {},
// },
// (a, b, c) => {
// return event => {
// c(event.data);
// };
// },
// );
const {
barcodeRead,
onBarcodeRead,
onBarcodeFinderLayoutChange,
} = useBarcodeRead(
true,
data => data,
processed => {
console.log(processed, {barcodeReadCount});
setBarcodeReadCount(prev => prev + 1);
},
{
beforeScan: () => {
setBarcodeRead(true);
},
afterScan: () => {},
},
(a, b, c) => {
return event => {
c(event.data);
};
console.log(processed);
},
);

return (
<>
<StatusBar barStyle="dark-content" />
<SafeAreaView style={{flex: 1}}>
<SafeAreaView
style={{
flex: 1,
flexDirection: 'column',
}}>
<View style={{flexDirection: 'row'}}>
<Button
title={'Toggle Barcode Read Aware'}
onPress={() => {
setBarcodeReadAware(prev => !prev);
setBarcodeRead(false);
// setBarcodeRead(false);
setBarcodeReadCount(0);
}}
/>
Expand All @@ -67,7 +82,9 @@ const App = () => {
<View style={{flexDirection: 'row'}}>
<Button
title={'Reset Barcode Read'}
onPress={() => setBarcodeRead(false)}
onPress={() => {
// setBarcodeRead(false);
}}
/>
<Text>{barcodeRead.toString()}</Text>
</View>
Expand All @@ -93,7 +110,8 @@ const App = () => {
captureAudio={false}>
<BarcodeMaskWithOuterLayout
maskOpacity={0.5}
height={'90%'}
height={'80%'}
width={'80%'}
onLayoutChange={onBarcodeFinderLayoutChange}
/>
</RNCamera>
Expand All @@ -105,8 +123,8 @@ const App = () => {
const styles = StyleSheet.create({
scanner: {
flex: 1,
width: '100%',
overflow: 'hidden',
justifyContent: 'flex-end',
alignItems: 'center',
},
});

Expand Down
18 changes: 18 additions & 0 deletions example/ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,14 @@ PODS:
- React-cxxreact (= 0.61.5)
- React-jsi (= 0.61.5)
- React-jsinspector (0.61.5)
- react-native-camera (3.15.0):
- React
- react-native-camera/RCT (= 3.15.0)
- react-native-camera/RN (= 3.15.0)
- react-native-camera/RCT (3.15.0):
- React
- react-native-camera/RN (3.15.0):
- React
- React-RCTActionSheet (0.61.5):
- React-Core/RCTActionSheetHeaders (= 0.61.5)
- React-RCTAnimation (0.61.5):
Expand Down Expand Up @@ -217,6 +225,8 @@ PODS:
- React-cxxreact (= 0.61.5)
- React-jsi (= 0.61.5)
- ReactCommon/jscallinvoker (= 0.61.5)
- RNReanimated (1.4.0):
- React
- Yoga (1.14.0)

DEPENDENCIES:
Expand All @@ -236,6 +246,7 @@ DEPENDENCIES:
- React-jsi (from `../node_modules/react-native/ReactCommon/jsi`)
- React-jsiexecutor (from `../node_modules/react-native/ReactCommon/jsiexecutor`)
- React-jsinspector (from `../node_modules/react-native/ReactCommon/jsinspector`)
- react-native-camera (from `../node_modules/react-native-camera`)
- React-RCTActionSheet (from `../node_modules/react-native/Libraries/ActionSheetIOS`)
- React-RCTAnimation (from `../node_modules/react-native/Libraries/NativeAnimation`)
- React-RCTBlob (from `../node_modules/react-native/Libraries/Blob`)
Expand All @@ -247,6 +258,7 @@ DEPENDENCIES:
- React-RCTVibration (from `../node_modules/react-native/Libraries/Vibration`)
- ReactCommon/jscallinvoker (from `../node_modules/react-native/ReactCommon`)
- ReactCommon/turbomodule/core (from `../node_modules/react-native/ReactCommon`)
- RNReanimated (from `../node_modules/react-native-reanimated`)
- Yoga (from `../node_modules/react-native/ReactCommon/yoga`)

SPEC REPOS:
Expand Down Expand Up @@ -282,6 +294,8 @@ EXTERNAL SOURCES:
:path: "../node_modules/react-native/ReactCommon/jsiexecutor"
React-jsinspector:
:path: "../node_modules/react-native/ReactCommon/jsinspector"
react-native-camera:
:path: "../node_modules/react-native-camera"
React-RCTActionSheet:
:path: "../node_modules/react-native/Libraries/ActionSheetIOS"
React-RCTAnimation:
Expand All @@ -302,6 +316,8 @@ EXTERNAL SOURCES:
:path: "../node_modules/react-native/Libraries/Vibration"
ReactCommon:
:path: "../node_modules/react-native/ReactCommon"
RNReanimated:
:path: "../node_modules/react-native-reanimated"
Yoga:
:path: "../node_modules/react-native/ReactCommon/yoga"

Expand All @@ -321,6 +337,7 @@ SPEC CHECKSUMS:
React-jsi: cb2cd74d7ccf4cffb071a46833613edc79cdf8f7
React-jsiexecutor: d5525f9ed5f782fdbacb64b9b01a43a9323d2386
React-jsinspector: fa0ecc501688c3c4c34f28834a76302233e29dc0
react-native-camera: 52114c432860b89986c9ee4919d00a48a6ba7abb
React-RCTActionSheet: 600b4d10e3aea0913b5a92256d2719c0cdd26d76
React-RCTAnimation: 791a87558389c80908ed06cc5dfc5e7920dfa360
React-RCTBlob: d89293cc0236d9cb0933d85e430b0bbe81ad1d72
Expand All @@ -331,6 +348,7 @@ SPEC CHECKSUMS:
React-RCTText: 9ccc88273e9a3aacff5094d2175a605efa854dbe
React-RCTVibration: a49a1f42bf8f5acf1c3e297097517c6b3af377ad
ReactCommon: 198c7c8d3591f975e5431bec1b0b3b581aa1c5dd
RNReanimated: b2ab0b693dddd2339bd2f300e770f6302d2e960c
Yoga: f2a7cd4280bfe2cca5a7aed98ba0eb3d1310f18b

PODFILE CHECKSUM: 79310af6b976c356911a8a833e9b99c3399fdda3
Expand Down
14 changes: 11 additions & 3 deletions example/ios/example.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,6 @@
5ECA95E1E4CA88CC5D879CA2 /* Pods-exampleTests.debug.xcconfig */,
3956FEBAB5319E39F6611B2F /* Pods-exampleTests.release.xcconfig */,
);
name = Pods;
path = Pods;
sourceTree = "<group>";
};
Expand Down Expand Up @@ -290,8 +289,12 @@
TargetAttributes = {
00E356ED1AD99517003FC87E = {
CreatedOnToolsVersion = 6.2;
DevelopmentTeam = FF6FP9322P;
TestTargetID = 13B07F861A680F5B00A75B9A;
};
13B07F861A680F5B00A75B9A = {
DevelopmentTeam = FF6FP9322P;
};
2D02E47A1E0B4A5D006451C7 = {
CreatedOnToolsVersion = 8.2.1;
ProvisioningStyle = Automatic;
Expand All @@ -308,6 +311,7 @@
developmentRegion = English;
hasScannedForEncodings = 0;
knownRegions = (
English,
en,
Base,
);
Expand Down Expand Up @@ -583,6 +587,7 @@
baseConfigurationReference = 5ECA95E1E4CA88CC5D879CA2 /* Pods-exampleTests.debug.xcconfig */;
buildSettings = {
BUNDLE_LOADER = "$(TEST_HOST)";
DEVELOPMENT_TEAM = FF6FP9322P;
GCC_PREPROCESSOR_DEFINITIONS = (
"DEBUG=1",
"$(inherited)",
Expand All @@ -607,6 +612,7 @@
buildSettings = {
BUNDLE_LOADER = "$(TEST_HOST)";
COPY_PHASE_STRIP = NO;
DEVELOPMENT_TEAM = FF6FP9322P;
INFOPLIST_FILE = exampleTests/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
Expand All @@ -628,14 +634,15 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CURRENT_PROJECT_VERSION = 1;
DEAD_CODE_STRIPPING = NO;
DEVELOPMENT_TEAM = FF6FP9322P;
INFOPLIST_FILE = example/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
OTHER_LDFLAGS = (
"$(inherited)",
"-ObjC",
"-lc++",
);
PRODUCT_BUNDLE_IDENTIFIER = "org.reactjs.native.example.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_BUNDLE_IDENTIFIER = com.nartc.barcodemask;
PRODUCT_NAME = example;
VERSIONING_SYSTEM = "apple-generic";
};
Expand All @@ -647,14 +654,15 @@
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_TEAM = FF6FP9322P;
INFOPLIST_FILE = example/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
OTHER_LDFLAGS = (
"$(inherited)",
"-ObjC",
"-lc++",
);
PRODUCT_BUNDLE_IDENTIFIER = "org.reactjs.native.example.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_BUNDLE_IDENTIFIER = com.nartc.barcodemask;
PRODUCT_NAME = example;
VERSIONING_SYSTEM = "apple-generic";
};
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IDEDidComputeMac32BitWarning</key>
<true/>
</dict>
</plist>
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IDEDidComputeMac32BitWarning</key>
<true/>
</dict>
</plist>
2 changes: 2 additions & 0 deletions example/ios/example/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -53,5 +53,7 @@
</array>
<key>UIViewControllerBasedStatusBarAppearance</key>
<false/>
<key>NSCameraUsageDescription</key>
<string>Your own description of the purpose</string>
</dict>
</plist>
Loading

0 comments on commit c9e9b8e

Please sign in to comment.