Bump version to 23.01.54 and fix external camera preview black screen after photo
This commit is contained in:
1 parent
2f2ae286cc
commit
e3a94d132d
15 files changed
+78
-50
No files matched your search
@@ -50,6 +50,11 @@ class UsbCameraModule : Module() {
|
||||
promise.resolve(view.isCameraConnected())
|
||||
}
|
||||
|
||||
AsyncFunction("restartPreview") { view: UsbCameraView, promise: Promise ->
|
||||
view.restartPreview()
|
||||
promise.resolve(true)
|
||||
}
|
||||
|
||||
OnViewDestroys { view ->
|
||||
view.onDestroy()
|
||||
}
|
||||
|
||||
@@ -224,6 +224,16 @@ class UsbCameraView(context: Context, appContext: AppContext) : ExpoView(context
|
||||
return cameraClient?.isCameraOpened() ?: false
|
||||
}
|
||||
|
||||
fun restartPreview() {
|
||||
try {
|
||||
if (cameraClient != null) {
|
||||
cameraClient?.openCamera(textureView)
|
||||
}
|
||||
} catch (e: Exception) {
|
||||
e.printStackTrace()
|
||||
}
|
||||
}
|
||||
|
||||
fun onDestroy() {
|
||||
try {
|
||||
permissionReceiver?.let {
|
||||
|
||||
@@ -19,6 +19,7 @@ export interface UsbCameraViewProps extends ViewProps {
|
||||
export interface UsbCameraRef {
|
||||
takePicture(savePath: string): Promise<string>;
|
||||
isCameraConnected(): Promise<boolean>;
|
||||
restartPreview(): Promise<boolean>;
|
||||
}
|
||||
|
||||
// Export the native view manager component
|
||||
|
||||
Reference in new issue
Block a user