diff --git a/docs/kotlin.md b/docs/kotlin.md index 5d16834..e7735b7 100644 --- a/docs/kotlin.md +++ b/docs/kotlin.md @@ -8,7 +8,7 @@ Add the `kotlin_version` to `buildscript.ext` buildscript { ext { ... - kotlin_version = '1.5.10' + kotlin_version = '1.7.20' } ``` diff --git a/example/ios/CameraKitExample.xcodeproj/project.pbxproj b/example/ios/CameraKitExample.xcodeproj/project.pbxproj index be5ad98..7185de6 100644 --- a/example/ios/CameraKitExample.xcodeproj/project.pbxproj +++ b/example/ios/CameraKitExample.xcodeproj/project.pbxproj @@ -201,7 +201,7 @@ ); inputPaths = ( "${PODS_ROOT}/Target Support Files/Pods-CameraKitExample/Pods-CameraKitExample-frameworks.sh", - "${PODS_XCFRAMEWORKS_BUILD_DIR}/OpenSSL/OpenSSL.framework/OpenSSL", + "${PODS_XCFRAMEWORKS_BUILD_DIR}/OpenSSL-Universal/OpenSSL.framework/OpenSSL", ); name = "[CP] Embed Pods Frameworks"; outputPaths = ( diff --git a/example/ios/Podfile.lock b/example/ios/Podfile.lock index 950ea46..306f105 100644 --- a/example/ios/Podfile.lock +++ b/example/ios/Podfile.lock @@ -294,7 +294,7 @@ PODS: - React-Core (= 0.63.4) - React-cxxreact (= 0.63.4) - React-jsi (= 0.63.4) - - ReactNativeCameraKit (11.2.0): + - ReactNativeCameraKit (13.0.0): - React-Core - Yoga (1.14.0) - YogaKit (1.18.1): @@ -458,10 +458,10 @@ SPEC CHECKSUMS: React-RCTText: 5c51df3f08cb9dedc6e790161195d12bac06101c React-RCTVibration: ae4f914cfe8de7d4de95ae1ea6cc8f6315d73d9d ReactCommon: 73d79c7039f473b76db6ff7c6b159c478acbbb3b - ReactNativeCameraKit: c25ef4c32abd8918578a9ece01c90233f478c97c + ReactNativeCameraKit: 9d46a5d7dd544ca64aa9c03c150d2348faf437eb Yoga: 4bd86afe9883422a7c4028c00e34790f560923d6 YogaKit: f782866e155069a2cca2517aafea43200b01fd5a PODFILE CHECKSUM: f9ef8a8a0dbf13b0a1ceaa5b4c54937559d74e9e -COCOAPODS: 1.10.1 +COCOAPODS: 1.11.3 diff --git a/src/CameraScreen.tsx b/src/CameraScreen.tsx index 17300fd..78b80ee 100644 --- a/src/CameraScreen.tsx +++ b/src/CameraScreen.tsx @@ -10,6 +10,7 @@ import { Platform, SafeAreaView, ImageStyle, + ImageSourcePropType, } from 'react-native'; import _ from 'lodash'; import Camera from './Camera'; @@ -22,44 +23,61 @@ const { width, height } = Dimensions.get('window'); export enum CameraType { Front = 'front', - Back = 'back' + Back = 'back', } +export type ActionsT = { + leftButtonText?: string; + rightButtonText?: string; +}; + +export type CameraRatioOverlayT = { + ratios: string[]; +}; + +export type FlashImagesT = { + on: number | string; + off: number | string; + auto: number | string; +}; + export type Props = { - focusMode?: string, - zoomMode?: string, - ratioOverlay?: string, - ratioOverlayColor?: string, - allowCaptureRetake: boolean, - cameraRatioOverlay: any, - showCapturedImageCount?: boolean, - captureButtonImage: any, - captureButtonImageStyle: ImageStyle, - cameraFlipImage: any, - cameraFlipImageStyle: ImageStyle, - hideControls: any, - showFrame: any, - scanBarcode: any, - laserColor: any, - frameColor: any, - torchOnImage: any, - torchOffImage: any, - - torchImageStyle: ImageStyle, - onReadCode: (event: any) => void; - onBottomButtonPressed: (event: any) => void; -} + actions?: ActionsT; + flashImages?: FlashImagesT; + focusMode?: string; + zoomMode?: string; + ratioOverlay?: string; + ratioOverlayColor?: string; + allowCaptureRetake?: boolean; + cameraRatioOverlay?: CameraRatioOverlayT; + showCapturedImageCount?: boolean; + captureButtonImage?: ImageSourcePropType; + captureButtonImageStyle?: ImageStyle; + cameraFlipImage?: ImageSourcePropType; + cameraFlipImageStyle?: ImageStyle; + hideControls?: boolean; + showFrame?: boolean; + scanBarcode?: boolean; + laserColor?: string; + frameColor?: string; + torchOnImage?: any; + torchOffImage?: any; + cameraType?: CameraType; + torchImageStyle?: ImageStyle; + onReadCode?: (event: any) => void; + onBottomButtonPressed?: (event: any) => void; +}; type State = { - captureImages: any[], - flashData: any, - torchMode: boolean, - ratios: any[], - ratioArrayPosition: number, - imageCaptured: any, - captured: boolean, - cameraType: CameraType, -} + captureImages: any[]; + flashData: any; + torchMode: boolean; + ratios: any[]; + ratioArrayPosition: number; + imageCaptured: any; + captured: boolean; + cameraType: CameraType; +}; export default class CameraScreen extends Component { static propTypes = { @@ -105,7 +123,7 @@ export default class CameraScreen extends Component { } componentDidMount() { - let ratios = []; + let ratios: string | any[] = []; if (this.props.cameraRatioOverlay) { ratios = this.props.cameraRatioOverlay.ratios || []; } @@ -127,7 +145,7 @@ export default class CameraScreen extends Component { ) @@ -141,7 +159,7 @@ export default class CameraScreen extends Component { ) @@ -156,7 +174,7 @@ export default class CameraScreen extends Component { ) @@ -195,7 +213,6 @@ export default class CameraScreen extends Component { laserColor={this.props.laserColor} frameColor={this.props.frameColor} onReadCode={this.props.onReadCode} - /> )} @@ -222,7 +239,7 @@ export default class CameraScreen extends Component { {this.props.showCapturedImageCount && ( @@ -351,77 +368,76 @@ export default class CameraScreen extends Component { } } -const styles = StyleSheet.create( - { - bottomButtons: { - flex: 2, - flexDirection: 'row', - justifyContent: 'space-between', - padding: 14, - }, - textStyle: { - color: 'white', - fontSize: 20, - }, - ratioBestText: { - color: 'white', - fontSize: 18, - }, - ratioText: { - color: '#ffc233', - fontSize: 18, - }, - topButtons: { - flex: 1, - flexDirection: 'row', - justifyContent: 'space-between', - paddingTop: 8, - paddingBottom: 0, - }, - cameraContainer: { - ...Platform.select({ - android: { - position: 'absolute', - top: 0, - left: 0, - width, - height, - }, - default: { - flex: 10, - flexDirection: 'column', - }, - }), - }, - captureButtonContainer: { - flex: 1, - justifyContent: 'center', - alignItems: 'center', - }, - textNumberContainer: { - position: 'absolute', - top: 0, - left: 0, - bottom: 0, - right: 0, - justifyContent: 'center', - alignItems: 'center', - }, - bottomButton: { - flex: 1, - flexDirection: 'row', - alignItems: 'center', - padding: 10, - }, - bottomContainerGap: { - flex: 1, - flexDirection: 'row', - justifyContent: 'flex-end', - alignItems: 'center', - padding: 10, - }, - gap: { - flex: 10, - flexDirection: 'column', - }, - }); +const styles = StyleSheet.create({ + bottomButtons: { + flex: 2, + flexDirection: 'row', + justifyContent: 'space-between', + padding: 14, + }, + textStyle: { + color: 'white', + fontSize: 20, + }, + ratioBestText: { + color: 'white', + fontSize: 18, + }, + ratioText: { + color: '#ffc233', + fontSize: 18, + }, + topButtons: { + flex: 1, + flexDirection: 'row', + justifyContent: 'space-between', + paddingTop: 8, + paddingBottom: 0, + }, + cameraContainer: { + ...Platform.select({ + android: { + position: 'absolute', + top: 0, + left: 0, + width, + height, + }, + default: { + flex: 10, + flexDirection: 'column', + }, + }), + }, + captureButtonContainer: { + flex: 1, + justifyContent: 'center', + alignItems: 'center', + }, + textNumberContainer: { + position: 'absolute', + top: 0, + left: 0, + bottom: 0, + right: 0, + justifyContent: 'center', + alignItems: 'center', + }, + bottomButton: { + flex: 1, + flexDirection: 'row', + alignItems: 'center', + padding: 10, + }, + bottomContainerGap: { + flex: 1, + flexDirection: 'row', + justifyContent: 'flex-end', + alignItems: 'center', + padding: 10, + }, + gap: { + flex: 10, + flexDirection: 'column', + }, +});