diff --git a/package/android/src/main/java/com/mrousavy/camera/CameraView.kt b/package/android/src/main/java/com/mrousavy/camera/CameraView.kt index 7627127..20fb4e8 100644 --- a/package/android/src/main/java/com/mrousavy/camera/CameraView.kt +++ b/package/android/src/main/java/com/mrousavy/camera/CameraView.kt @@ -13,6 +13,7 @@ import android.view.Surface import android.widget.FrameLayout import androidx.core.content.ContextCompat import com.facebook.react.bridge.ReadableMap +import com.facebook.react.bridge.UiThreadUtil import com.mrousavy.camera.core.CameraPermissionError import com.mrousavy.camera.core.CameraQueues import com.mrousavy.camera.core.CameraSession @@ -113,6 +114,7 @@ class CameraView(context: Context) : init { this.installHierarchyFitter() + clipToOutline = true setupPreviewView() cameraSession = CameraSession(context, cameraManager, { invokeOnInitialized() }, { error -> invokeOnError(error) }) } @@ -156,8 +158,10 @@ class CameraView(context: Context) : LayoutParams.MATCH_PARENT, Gravity.CENTER ) - addView(previewView) this.previewView = previewView + UiThreadUtil.runOnUiThread { + addView(previewView) + } } fun update(changedProps: ArrayList) {