react-native-rectangle-doc-scanner 3.167.0 → 3.168.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -82,9 +82,14 @@ class DocumentScannerView(context: ThemedReactContext) : FrameLayout(context), L
|
|
|
82
82
|
// PERFORMANCE mode keeps the preview visible while still allowing us
|
|
83
83
|
// to draw our overlay on top.
|
|
84
84
|
implementationMode = PreviewView.ImplementationMode.PERFORMANCE
|
|
85
|
+
// Force visibility to ensure the view is rendered
|
|
86
|
+
visibility = View.VISIBLE
|
|
87
|
+
// Request layout to ensure proper sizing
|
|
88
|
+
requestLayout()
|
|
85
89
|
}
|
|
86
90
|
Log.d(TAG, "[INIT] PreviewView created: $previewView")
|
|
87
91
|
Log.d(TAG, "[INIT] PreviewView implementationMode: ${previewView.implementationMode}")
|
|
92
|
+
Log.d(TAG, "[INIT] PreviewView visibility: ${previewView.visibility}")
|
|
88
93
|
|
|
89
94
|
Log.d(TAG, "[INIT] Adding PreviewView to parent...")
|
|
90
95
|
addView(previewView)
|
|
@@ -113,15 +118,26 @@ class DocumentScannerView(context: ThemedReactContext) : FrameLayout(context), L
|
|
|
113
118
|
Log.d(TAG, "This view: width=$width, height=$height")
|
|
114
119
|
Log.d(TAG, "========================================")
|
|
115
120
|
|
|
116
|
-
//
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
121
|
+
// Update lifecycle
|
|
122
|
+
lifecycleRegistry.handleLifecycleEvent(Lifecycle.Event.ON_CREATE)
|
|
123
|
+
lifecycleRegistry.handleLifecycleEvent(Lifecycle.Event.ON_START)
|
|
124
|
+
lifecycleRegistry.handleLifecycleEvent(Lifecycle.Event.ON_RESUME)
|
|
125
|
+
|
|
126
|
+
// Wait for view to be laid out before starting camera
|
|
127
|
+
viewTreeObserver.addOnGlobalLayoutListener(object : android.view.ViewTreeObserver.OnGlobalLayoutListener {
|
|
128
|
+
override fun onGlobalLayout() {
|
|
129
|
+
viewTreeObserver.removeOnGlobalLayoutListener(this)
|
|
130
|
+
|
|
131
|
+
if (width > 0 && height > 0 && previewView.width > 0 && previewView.height > 0) {
|
|
132
|
+
Log.d(TAG, "[LAYOUT] View laid out: width=$width, height=$height")
|
|
133
|
+
Log.d(TAG, "[LAYOUT] PreviewView: width=${previewView.width}, height=${previewView.height}")
|
|
134
|
+
setupCamera()
|
|
135
|
+
startCamera()
|
|
136
|
+
} else {
|
|
137
|
+
Log.e(TAG, "[LAYOUT] View or PreviewView has invalid dimensions")
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
})
|
|
125
141
|
}
|
|
126
142
|
|
|
127
143
|
private fun setupCamera() {
|
package/package.json
CHANGED