Skip to content
Snippets Groups Projects
Commit 591c42d0 authored by Alexey Lunin's avatar Alexey Lunin
Browse files

fix ios build after upgrading xcode

parent 9b960979
No related branches found
No related tags found
No related merge requests found
......@@ -8,12 +8,12 @@
/* Begin PBXBuildFile section */
00E356F31AD99517003FC87E /* PersonalCredentialManagerTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 00E356F21AD99517003FC87E /* PersonalCredentialManagerTests.m */; };
0C80B921A6F3F58F76C31292 /* libPods-PersonalCredentialManager.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 5DCACB8F33CDC322A6C60F78 /* libPods-PersonalCredentialManager.a */; };
13B07FBC1A68108700A75B9A /* AppDelegate.mm in Sources */ = {isa = PBXBuildFile; fileRef = 13B07FB01A68108700A75B9A /* AppDelegate.mm */; };
13B07FBF1A68108700A75B9A /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 13B07FB51A68108700A75B9A /* Images.xcassets */; };
13B07FC11A68108700A75B9A /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 13B07FB71A68108700A75B9A /* main.m */; };
187EB63322A7D47D73A8922F /* Pods_PersonalCredentialManager_PersonalCredentialManagerTests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 24A7F946000EAD9A5E633A0B /* Pods_PersonalCredentialManager_PersonalCredentialManagerTests.framework */; };
45C868E35EB249A298F128C4 /* TitilliumWeb-Regular.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 34AF55BBFD0A4B44AB7DBE8B /* TitilliumWeb-Regular.ttf */; };
7699B88040F8A987B510C191 /* libPods-PersonalCredentialManager-PersonalCredentialManagerTests.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 19F6CBCC0A4E27FBF8BF4A61 /* libPods-PersonalCredentialManager-PersonalCredentialManagerTests.a */; };
4BBAC69AF6BEA057D2317C70 /* Pods_PersonalCredentialManager.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = ACFB060D60804F98D0E0A4CB /* Pods_PersonalCredentialManager.framework */; };
7BA9C4503A9B4E6D8132A42C /* antoutline.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 1035D30535C64F25B3B6EF5A /* antoutline.ttf */; };
7D1BB02F91E54B0297C6C67D /* TitilliumWeb-SemiBold.ttf in Resources */ = {isa = PBXBuildFile; fileRef = EF7CF2CD60574ADD8E0AFAD9 /* TitilliumWeb-SemiBold.ttf */; };
81AB9BB82411601600AC10FF /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 81AB9BB72411601600AC10FF /* LaunchScreen.storyboard */; };
......@@ -45,9 +45,9 @@
13B07FB61A68108700A75B9A /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = Info.plist; path = PersonalCredentialManager/Info.plist; sourceTree = "<group>"; };
13B07FB71A68108700A75B9A /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = main.m; path = PersonalCredentialManager/main.m; sourceTree = "<group>"; };
186C1DA476994FEBB2A0FB48 /* Octicons.ttf */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = unknown; name = Octicons.ttf; path = "../node_modules/react-native-vector-icons/Fonts/Octicons.ttf"; sourceTree = "<group>"; };
19F6CBCC0A4E27FBF8BF4A61 /* libPods-PersonalCredentialManager-PersonalCredentialManagerTests.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-PersonalCredentialManager-PersonalCredentialManagerTests.a"; sourceTree = BUILT_PRODUCTS_DIR; };
1C10BC92F9394E6486AF27F0 /* MaterialCommunityIcons.ttf */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = unknown; name = MaterialCommunityIcons.ttf; path = "../node_modules/react-native-vector-icons/Fonts/MaterialCommunityIcons.ttf"; sourceTree = "<group>"; };
22925182963E43AABAFC6DE1 /* Ionicons.ttf */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = unknown; name = Ionicons.ttf; path = "../node_modules/react-native-vector-icons/Fonts/Ionicons.ttf"; sourceTree = "<group>"; };
24A7F946000EAD9A5E633A0B /* Pods_PersonalCredentialManager_PersonalCredentialManagerTests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_PersonalCredentialManager_PersonalCredentialManagerTests.framework; sourceTree = BUILT_PRODUCTS_DIR; };
34AF55BBFD0A4B44AB7DBE8B /* TitilliumWeb-Regular.ttf */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = unknown; name = "TitilliumWeb-Regular.ttf"; path = "../src/assets/fonts/TitilliumWeb-Regular.ttf"; sourceTree = "<group>"; };
3B4392A12AC88292D35C810B /* Pods-PersonalCredentialManager.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-PersonalCredentialManager.debug.xcconfig"; path = "Target Support Files/Pods-PersonalCredentialManager/Pods-PersonalCredentialManager.debug.xcconfig"; sourceTree = "<group>"; };
3CF1B5970F764466AA5B532C /* Zocial.ttf */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = unknown; name = Zocial.ttf; path = "../node_modules/react-native-vector-icons/Fonts/Zocial.ttf"; sourceTree = "<group>"; };
......@@ -55,11 +55,11 @@
56C06A0D868D49B28D5EE2DB /* MaterialIcons.ttf */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = unknown; name = MaterialIcons.ttf; path = "../node_modules/react-native-vector-icons/Fonts/MaterialIcons.ttf"; sourceTree = "<group>"; };
5709B34CF0A7D63546082F79 /* Pods-PersonalCredentialManager.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-PersonalCredentialManager.release.xcconfig"; path = "Target Support Files/Pods-PersonalCredentialManager/Pods-PersonalCredentialManager.release.xcconfig"; sourceTree = "<group>"; };
5B7EB9410499542E8C5724F5 /* Pods-PersonalCredentialManager-PersonalCredentialManagerTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-PersonalCredentialManager-PersonalCredentialManagerTests.debug.xcconfig"; path = "Target Support Files/Pods-PersonalCredentialManager-PersonalCredentialManagerTests/Pods-PersonalCredentialManager-PersonalCredentialManagerTests.debug.xcconfig"; sourceTree = "<group>"; };
5DCACB8F33CDC322A6C60F78 /* libPods-PersonalCredentialManager.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-PersonalCredentialManager.a"; sourceTree = BUILT_PRODUCTS_DIR; };
81AB9BB72411601600AC10FF /* LaunchScreen.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; name = LaunchScreen.storyboard; path = PersonalCredentialManager/LaunchScreen.storyboard; sourceTree = "<group>"; };
89C6BE57DB24E9ADA2F236DE /* Pods-PersonalCredentialManager-PersonalCredentialManagerTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-PersonalCredentialManager-PersonalCredentialManagerTests.release.xcconfig"; path = "Target Support Files/Pods-PersonalCredentialManager-PersonalCredentialManagerTests/Pods-PersonalCredentialManager-PersonalCredentialManagerTests.release.xcconfig"; sourceTree = "<group>"; };
A20DE76CC5794D40B00346D9 /* FontAwesome5_Brands.ttf */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = unknown; name = FontAwesome5_Brands.ttf; path = "../node_modules/react-native-vector-icons/Fonts/FontAwesome5_Brands.ttf"; sourceTree = "<group>"; };
A78E245B6B044A8193B781D6 /* EvilIcons.ttf */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = unknown; name = EvilIcons.ttf; path = "../node_modules/react-native-vector-icons/Fonts/EvilIcons.ttf"; sourceTree = "<group>"; };
ACFB060D60804F98D0E0A4CB /* Pods_PersonalCredentialManager.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_PersonalCredentialManager.framework; sourceTree = BUILT_PRODUCTS_DIR; };
B472E6D57FD947A8A95A3D9A /* AntDesign.ttf */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = unknown; name = AntDesign.ttf; path = "../node_modules/react-native-vector-icons/Fonts/AntDesign.ttf"; sourceTree = "<group>"; };
B490EA60295A4303AC328F11 /* SimpleLineIcons.ttf */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = unknown; name = SimpleLineIcons.ttf; path = "../node_modules/react-native-vector-icons/Fonts/SimpleLineIcons.ttf"; sourceTree = "<group>"; };
B511E1FF35794D8384EEB91B /* FontAwesome5_Regular.ttf */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = unknown; name = FontAwesome5_Regular.ttf; path = "../node_modules/react-native-vector-icons/Fonts/FontAwesome5_Regular.ttf"; sourceTree = "<group>"; };
......@@ -79,7 +79,7 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
7699B88040F8A987B510C191 /* libPods-PersonalCredentialManager-PersonalCredentialManagerTests.a in Frameworks */,
187EB63322A7D47D73A8922F /* Pods_PersonalCredentialManager_PersonalCredentialManagerTests.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
......@@ -88,7 +88,7 @@
buildActionMask = 2147483647;
files = (
FE5B187A27BB9E9700E39BA4 /* Indy.framework in Frameworks */,
0C80B921A6F3F58F76C31292 /* libPods-PersonalCredentialManager.a in Frameworks */,
4BBAC69AF6BEA057D2317C70 /* Pods_PersonalCredentialManager.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
......@@ -130,8 +130,8 @@
children = (
FE5B187927BB9E9700E39BA4 /* Indy.framework */,
ED297162215061F000B7C4FE /* JavaScriptCore.framework */,
5DCACB8F33CDC322A6C60F78 /* libPods-PersonalCredentialManager.a */,
19F6CBCC0A4E27FBF8BF4A61 /* libPods-PersonalCredentialManager-PersonalCredentialManagerTests.a */,
ACFB060D60804F98D0E0A4CB /* Pods_PersonalCredentialManager.framework */,
24A7F946000EAD9A5E633A0B /* Pods_PersonalCredentialManager_PersonalCredentialManagerTests.framework */,
);
name = Frameworks;
sourceTree = "<group>";
......
#import <React/RCTBridgeDelegate.h>
#import <RCTAppDelegate.h>
#import <UIKit/UIKit.h>
@interface AppDelegate : UIResponder <UIApplicationDelegate, RCTBridgeDelegate>
@property (nonatomic, strong) UIWindow *window;
@interface AppDelegate : RCTAppDelegate
@end
#import "AppDelegate.h"
#import <React/RCTBridge.h>
#import <React/RCTBundleURLProvider.h>
#import <React/RCTRootView.h>
#import <React/RCTAppSetupUtils.h>
#import <React/RCTLinkingManager.h>
#if RCT_NEW_ARCH_ENABLED
#import <React/CoreModulesPlugins.h>
#import <React/RCTCxxBridgeDelegate.h>
#import <React/RCTFabricSurfaceHostingProxyRootView.h>
#import <React/RCTSurfacePresenter.h>
#import <React/RCTSurfacePresenterBridgeAdapter.h>
#import <ReactCommon/RCTTurboModuleManager.h>
#import <react/config/ReactNativeConfig.h>
static NSString *const kRNConcurrentRoot = @"concurrentRoot";
@interface AppDelegate () <RCTCxxBridgeDelegate, RCTTurboModuleManagerDelegate> {
RCTTurboModuleManager *_turboModuleManager;
RCTSurfacePresenterBridgeAdapter *_bridgeAdapter;
std::shared_ptr<const facebook::react::ReactNativeConfig> _reactNativeConfig;
facebook::react::ContextContainer::Shared _contextContainer;
}
@end
#endif
@implementation AppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
RCTAppSetupPrepareApp(application);
RCTBridge *bridge = [[RCTBridge alloc] initWithDelegate:self launchOptions:launchOptions];
#if RCT_NEW_ARCH_ENABLED
_contextContainer = std::make_shared<facebook::react::ContextContainer const>();
_reactNativeConfig = std::make_shared<facebook::react::EmptyReactNativeConfig const>();
_contextContainer->insert("ReactNativeConfig", _reactNativeConfig);
_bridgeAdapter = [[RCTSurfacePresenterBridgeAdapter alloc] initWithBridge:bridge contextContainer:_contextContainer];
bridge.surfacePresenter = _bridgeAdapter.surfacePresenter;
#endif
NSDictionary *initProps = [self prepareInitialProps];
UIView *rootView = RCTAppSetupDefaultRootView(bridge, @"PersonalCredentialManager", initProps);
if (@available(iOS 13.0, *)) {
rootView.backgroundColor = [UIColor systemBackgroundColor];
} else {
rootView.backgroundColor = [UIColor whiteColor];
}
self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
UIViewController *rootViewController = [UIViewController new];
rootViewController.view = rootView;
self.window.rootViewController = rootViewController;
[self.window makeKeyAndVisible];
return YES;
}
/// This method controls whether the `concurrentRoot`feature of React18 is turned on or off.
///
/// @see: https://reactjs.org/blog/2022/03/29/react-v18.html
/// @note: This requires to be rendering on Fabric (i.e. on the New Architecture).
/// @return: `true` if the `concurrentRoot` feture is enabled. Otherwise, it returns `false`.
- (BOOL)concurrentRootEnabled
{
// Switch this bool to turn on and off the concurrent root
return true;
}
- (NSDictionary *)prepareInitialProps
{
NSMutableDictionary *initProps = [NSMutableDictionary new];
self.moduleName = @"PersonalCredentialManager";
// You can add your custom initial props in the dictionary below.
// They will be passed down to the ViewController used by React Native.
self.initialProps = @{};
#ifdef RCT_NEW_ARCH_ENABLED
initProps[kRNConcurrentRoot] = @([self concurrentRootEnabled]);
#endif
return initProps;
return [super application:application didFinishLaunchingWithOptions:launchOptions];
}
- (NSURL *)sourceURLForBridge:(RCTBridge *)bridge
......@@ -92,45 +24,16 @@ static NSString *const kRNConcurrentRoot = @"concurrentRoot";
#endif
}
#if RCT_NEW_ARCH_ENABLED
#pragma mark - RCTCxxBridgeDelegate
- (std::unique_ptr<facebook::react::JSExecutorFactory>)jsExecutorFactoryForBridge:(RCTBridge *)bridge
{
_turboModuleManager = [[RCTTurboModuleManager alloc] initWithBridge:bridge
delegate:self
jsInvoker:bridge.jsCallInvoker];
return RCTAppSetupDefaultJsExecutorFactory(bridge, _turboModuleManager);
}
#pragma mark RCTTurboModuleManagerDelegate
- (Class)getModuleClassFromName:(const char *)name
{
return RCTCoreModulesClassProvider(name);
}
- (std::shared_ptr<facebook::react::TurboModule>)getTurboModule:(const std::string &)name
jsInvoker:(std::shared_ptr<facebook::react::CallInvoker>)jsInvoker
{
return nullptr;
}
- (std::shared_ptr<facebook::react::TurboModule>)getTurboModule:(const std::string &)name
initParams:
(const facebook::react::ObjCTurboModule::InitParams &)params
{
return nullptr;
}
- (id<RCTTurboModule>)getModuleInstanceFromClass:(Class)moduleClass
/// This method controls whether the `concurrentRoot`feature of React18 is turned on or off.
///
/// @see: https://reactjs.org/blog/2022/03/29/react-v18.html
/// @note: This requires to be rendering on Fabric (i.e. on the New Architecture).
/// @return: `true` if the `concurrentRoot` feature is enabled. Otherwise, it returns `false`.
- (BOOL)concurrentRootEnabled
{
return RCTAppSetupDefaultModuleFromClass(moduleClass);
return true;
}
#endif
// Add this inside `@implementation AppDelegate` above `@end`:
- (BOOL)application:(UIApplication *)application
openURL:(NSURL *)url
......@@ -139,4 +42,5 @@ static NSString *const kRNConcurrentRoot = @"concurrentRoot";
return [RCTLinkingManager application:application openURL:url options:options];
}
@end
# source 'https://github.com/hyperledger/indy-sdk-react-native'
source 'https://github.com/hyperledger/indy-sdk-react-native'
source 'https://github.com/CocoaPods/Specs.git'
require_relative '../node_modules/react-native/scripts/react_native_pods'
require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'
platform :ios, '12.4'
prepare_react_native_project!
install! 'cocoapods', :deterministic_uuids => false
use_frameworks! :linkage => :static
target 'PersonalCredentialManager' do
config = use_native_modules!
......@@ -22,7 +27,7 @@ target 'PersonalCredentialManager' do
#
# Note that if you have use_frameworks! enabled, Flipper will not work and
# you should disable the next line.
# :flipper_configuration => FlipperConfiguration.enabled,
:flipper_configuration => FlipperConfiguration.disabled,
# An absolute path to your application root.
:app_path => "#{Pod::Config.instance.installation_root}/.."
)
......
This diff is collapsed.
......@@ -15,15 +15,15 @@ import {
Pressable,
Keyboard,
} from 'react-native';
import Icon from 'react-native-vector-icons/MaterialIcons';
import { Camera, useCameraDevices } from 'react-native-vision-camera';
import { useScanBarcodes, BarcodeFormat } from 'vision-camera-code-scanner';
import AntDesign from 'react-native-vector-icons/AntDesign';
import QRScannerClose from '../misc/QRScannerClose';
import QRScannerTorch from '../misc/QRScannerTorch';
// import Icon from 'react-native-vector-icons/MaterialIcons';
// import { Camera, useCameraDevices } from 'react-native-vision-camera';
// import { useScanBarcodes, BarcodeFormat } from 'vision-camera-code-scanner';
// import AntDesign from 'react-native-vector-icons/AntDesign';
// import QRScannerClose from '../misc/QRScannerClose';
// import QRScannerTorch from '../misc/QRScannerTorch';
import QrCodeScanError from '../../types/error';
import { ColorPallet } from '../../theme/theme';
import useKeyboard from '../../utils/keyboard';
// import useKeyboard from '../../utils/keyboard';
interface Props {
handleCodeScan: (data: string) => Promise<void>;
......@@ -58,152 +58,152 @@ const QRScanner: React.FC<Props> = ({
onChangeText,
textInputSubmit,
}) => {
const navigation = useNavigation();
const [cameraActive, setCameraActive] = useState(true);
const [torchActive, setTorchActive] = useState(false);
const [invalidQrCodes] = useState(() => new Set<string>());
const { keyboardHeight, isKeyBoardOpen } = useKeyboard();
const { width, height } = useWindowDimensions();
const portraitMode = height > width;
const { t } = useTranslation();
const [hasPermission, setHasPermission] = React.useState(false);
const devices = useCameraDevices();
const device = devices.back;
const [frameProcessor, barcodes] = useScanBarcodes([BarcodeFormat.QR_CODE], {
checkInverted: true,
});
React.useEffect(() => {
(async () => {
const status = await Camera.requestCameraPermission();
setHasPermission(status === 'authorized');
})();
}, []);
useEffect(() => {
if (barcodes.length === 0 || !barcodes[0].rawValue) {
return;
}
const data = barcodes[0].rawValue;
if (invalidQrCodes.has(data)) {
return;
}
if (error?.data === data) {
invalidQrCodes.add(error.data);
if (enableCameraOnError) {
setCameraActive(true);
}
}
if (cameraActive) {
Vibration.vibrate();
handleCodeScan(data);
setCameraActive(false);
}
}, [
invalidQrCodes,
barcodes,
enableCameraOnError,
cameraActive,
error,
handleCodeScan,
]);
if (!hasPermission || device == null) {
return null;
}
return (
<Pressable
onPress={() => Keyboard.dismiss()}
style={styles.container}
testID="QRScannerTest"
>
<Camera
style={styles.container}
device={device}
isActive={true}
frameProcessor={frameProcessor}
frameProcessorFps={5}
torch={torchActive ? 'on' : 'off'}
audio={false}
// TODO
// androidCameraPermissionOptions={{
// title: t<string>('QRScanner.PermissionToUseCamera'),
// message: t<string>('QRScanner.PermissionMessage'),
// buttonPositive: t<string>('Global.Okay'),
// buttonNegative: t<string>('Global.Cancel'),
// }}
/>
<CameraViewContainer portrait={portraitMode}>
<View style={styles.actionsView}>
<QRScannerTorch
active={torchActive}
onPress={() => setTorchActive(!torchActive)}
/>
<QRScannerClose onPress={() => navigation.goBack()} />
</View>
<View style={styles.scanTextView}>
<Text style={styles.scanText}>
{t<string>('QRScanner.ScanMessage')}
</Text>
<Text style={styles.scanText}>
{t<string>('QRScanner.VerifyMessage')}
</Text>
</View>
{error && (
<View style={styles.errorContainer}>
<Icon style={styles.icon} name="cancel" size={30} />
<Text>{error.message}</Text>
</View>
)}
<View style={styles.viewFinderContainer}>
<View style={styles.viewFinder} />
</View>
</CameraViewContainer>
<View
style={[
styles.bottomView,
{
marginTop:
Platform.OS === 'ios' && isKeyBoardOpen
? -keyboardHeight - 80
: -80,
},
]}
>
<KeyboardAvoidingView
behavior="padding"
keyboardVerticalOffset={Platform.OS === 'ios' ? 0 : 20}
enabled={Platform.OS === 'ios'}
style={styles.rowTextInputView}
>
<TextInput
style={styles.textInputStyle}
placeholder="url"
value={url}
onChangeText={onChangeText}
placeholderTextColor={ColorPallet.baseColors.black}
/>
<TouchableOpacity
onPress={textInputSubmit}
style={styles.submitIconStyle}
>
<AntDesign
name="right"
color={ColorPallet.baseColors.black}
size={Platform.OS === 'ios' ? height / 30 : height / 28}
/>
</TouchableOpacity>
</KeyboardAvoidingView>
</View>
</Pressable>
);
// const navigation = useNavigation();
// const [cameraActive, setCameraActive] = useState(true);
// const [torchActive, setTorchActive] = useState(false);
// const [invalidQrCodes] = useState(() => new Set<string>());
//
// const { keyboardHeight, isKeyBoardOpen } = useKeyboard();
//
// const { width, height } = useWindowDimensions();
// const portraitMode = height > width;
// const { t } = useTranslation();
//
// const [hasPermission, setHasPermission] = React.useState(false);
// const devices = useCameraDevices();
// const device = devices.back;
//
// const [frameProcessor, barcodes] = useScanBarcodes([BarcodeFormat.QR_CODE], {
// checkInverted: true,
// });
//
// React.useEffect(() => {
// (async () => {
// const status = await Camera.requestCameraPermission();
// setHasPermission(status === 'authorized');
// })();
// }, []);
//
// useEffect(() => {
// if (barcodes.length === 0 || !barcodes[0].rawValue) {
// return;
// }
//
// const data = barcodes[0].rawValue;
//
// if (invalidQrCodes.has(data)) {
// return;
// }
// if (error?.data === data) {
// invalidQrCodes.add(error.data);
// if (enableCameraOnError) {
// setCameraActive(true);
// }
// }
// if (cameraActive) {
// Vibration.vibrate();
// handleCodeScan(data);
// setCameraActive(false);
// }
// }, [
// invalidQrCodes,
// barcodes,
// enableCameraOnError,
// cameraActive,
// error,
// handleCodeScan,
// ]);
//
// if (!hasPermission || device == null) {
// return null;
// }
//
// return (
// <Pressable
// onPress={() => Keyboard.dismiss()}
// style={styles.container}
// testID="QRScannerTest"
// >
// <Camera
// style={styles.container}
// device={device}
// isActive={true}
// frameProcessor={frameProcessor}
// frameProcessorFps={5}
// torch={torchActive ? 'on' : 'off'}
// audio={false}
// // TODO
// // androidCameraPermissionOptions={{
// // title: t<string>('QRScanner.PermissionToUseCamera'),
// // message: t<string>('QRScanner.PermissionMessage'),
// // buttonPositive: t<string>('Global.Okay'),
// // buttonNegative: t<string>('Global.Cancel'),
// // }}
// />
// <CameraViewContainer portrait={portraitMode}>
// <View style={styles.actionsView}>
// <QRScannerTorch
// active={torchActive}
// onPress={() => setTorchActive(!torchActive)}
// />
// <QRScannerClose onPress={() => navigation.goBack()} />
// </View>
// <View style={styles.scanTextView}>
// <Text style={styles.scanText}>
// {t<string>('QRScanner.ScanMessage')}
// </Text>
// <Text style={styles.scanText}>
// {t<string>('QRScanner.VerifyMessage')}
// </Text>
// </View>
// {error && (
// <View style={styles.errorContainer}>
// <Icon style={styles.icon} name="cancel" size={30} />
// <Text>{error.message}</Text>
// </View>
// )}
// <View style={styles.viewFinderContainer}>
// <View style={styles.viewFinder} />
// </View>
// </CameraViewContainer>
// <View
// style={[
// styles.bottomView,
// {
// marginTop:
// Platform.OS === 'ios' && isKeyBoardOpen
// ? -keyboardHeight - 80
// : -80,
// },
// ]}
// >
// <KeyboardAvoidingView
// behavior="padding"
// keyboardVerticalOffset={Platform.OS === 'ios' ? 0 : 20}
// enabled={Platform.OS === 'ios'}
// style={styles.rowTextInputView}
// >
// <TextInput
// style={styles.textInputStyle}
// placeholder="url"
// value={url}
// onChangeText={onChangeText}
// placeholderTextColor={ColorPallet.baseColors.black}
// />
// <TouchableOpacity
// onPress={textInputSubmit}
// style={styles.submitIconStyle}
// >
// <AntDesign
// name="right"
// color={ColorPallet.baseColors.black}
// size={Platform.OS === 'ios' ? height / 30 : height / 28}
// />
// </TouchableOpacity>
// </KeyboardAvoidingView>
// </View>
// </Pressable>
// );
};
export default QRScanner;
......
This diff is collapsed.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment