scandit-react-native-datacapture-core 6.18.0 → 6.18.2
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.
package/android/build.gradle
CHANGED
|
@@ -42,7 +42,7 @@ android {
|
|
|
42
42
|
}
|
|
43
43
|
|
|
44
44
|
dependencies {
|
|
45
|
-
def sdk_version = "6.18.
|
|
45
|
+
def sdk_version = "6.18.2"
|
|
46
46
|
|
|
47
47
|
println("Version of the native sdk used in this build: ${safeExtGet('global_sdk_version', sdk_version)}")
|
|
48
48
|
if (findProject(':scandit-datacapture-frameworks-core') != null) {
|
|
@@ -12,6 +12,7 @@ import android.widget.FrameLayout
|
|
|
12
12
|
import com.facebook.react.uimanager.ThemedReactContext
|
|
13
13
|
import com.scandit.datacapture.core.ui.DataCaptureView
|
|
14
14
|
import com.scandit.datacapture.frameworks.core.deserialization.DeserializationLifecycleObserver
|
|
15
|
+
import com.scandit.datacapture.frameworks.core.utils.MainThread
|
|
15
16
|
import java.lang.ref.WeakReference
|
|
16
17
|
|
|
17
18
|
class DataCaptureViewManager :
|
|
@@ -30,46 +31,53 @@ class DataCaptureViewManager :
|
|
|
30
31
|
FrameLayout(reactContext)
|
|
31
32
|
|
|
32
33
|
override fun createViewInstance(reactContext: ThemedReactContext): FrameLayout {
|
|
33
|
-
|
|
34
|
-
addDataCaptureViewToContainer(it)
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
private fun addDataCaptureViewToContainer(container: FrameLayout) {
|
|
34
|
+
val container = super.createViewInstance(reactContext)
|
|
39
35
|
dataCaptureViewRef.get()?.let { view ->
|
|
40
|
-
|
|
41
|
-
During hot reloading, DataCaptureViewManager recreates the view instance with
|
|
42
|
-
a createViewInstance() call, without destroying the previous instance (with
|
|
43
|
-
onDropViewInstance() callback). As a result, the DataCaptureViewHandler.dataCaptureView
|
|
44
|
-
still has a parent - we have to remove the reference to the old parent before adding
|
|
45
|
-
DataCaptureViewHandler.dataCaptureView to the newly created container.
|
|
46
|
-
*/
|
|
47
|
-
view.parent?.let {
|
|
48
|
-
(it as ViewGroup).removeView(view)
|
|
49
|
-
}
|
|
50
|
-
container.removeAllViews()
|
|
51
|
-
container.addView(view, MATCH_PARENT, MATCH_PARENT)
|
|
36
|
+
addDataCaptureViewToContainer(view, container)
|
|
52
37
|
}
|
|
38
|
+
return container
|
|
53
39
|
}
|
|
54
40
|
|
|
55
41
|
override fun onDropViewInstance(view: FrameLayout) {
|
|
56
42
|
super.onDropViewInstance(view)
|
|
57
43
|
|
|
58
|
-
currentContainer?.let {
|
|
59
|
-
|
|
44
|
+
currentContainer?.let { container ->
|
|
45
|
+
dataCaptureViewRef.get()?.let { view ->
|
|
46
|
+
addDataCaptureViewToContainer(view, container)
|
|
47
|
+
}
|
|
60
48
|
}
|
|
61
49
|
}
|
|
62
50
|
|
|
63
51
|
override fun onDataCaptureViewDeserialized(dataCaptureView: DataCaptureView) {
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
52
|
+
currentContainer?.let {
|
|
53
|
+
addDataCaptureViewToContainer(dataCaptureView, it)
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
dataCaptureViewRef = WeakReference(dataCaptureView)
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
private fun addDataCaptureViewToContainer(
|
|
60
|
+
dataCaptureView: DataCaptureView,
|
|
61
|
+
container: FrameLayout
|
|
62
|
+
) {
|
|
63
|
+
MainThread.runOnMainThread {
|
|
64
|
+
if (container.childCount > 0 && container.getChildAt(0) === dataCaptureView) {
|
|
65
|
+
// Same instance already attached. No need to detach and attach it again because
|
|
66
|
+
// it will trigger some overlay cleanup that we don't want.
|
|
67
|
+
return@runOnMainThread
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/*
|
|
71
|
+
During hot reloading, DataCaptureViewManager recreates the view instance with
|
|
72
|
+
a createViewInstance() call, without destroying the previous instance (with
|
|
73
|
+
onDropViewInstance() callback). As a result, the DataCaptureViewHandler.dataCaptureView
|
|
74
|
+
still has a parent - we have to remove the reference to the old parent before adding
|
|
75
|
+
DataCaptureViewHandler.dataCaptureView to the newly created container.
|
|
76
|
+
*/
|
|
68
77
|
dataCaptureView.parent?.let {
|
|
69
78
|
(it as ViewGroup).removeView(dataCaptureView)
|
|
70
79
|
}
|
|
71
|
-
|
|
80
|
+
container.addView(dataCaptureView, MATCH_PARENT, MATCH_PARENT)
|
|
72
81
|
}
|
|
73
|
-
dataCaptureViewRef = WeakReference(dataCaptureView)
|
|
74
82
|
}
|
|
75
83
|
}
|
package/js/DataCaptureVersion.js
CHANGED
package/package.json
CHANGED
|
@@ -16,7 +16,7 @@ Pod::Spec.new do |s|
|
|
|
16
16
|
s.requires_arc = true
|
|
17
17
|
s.module_name = "ScanditDataCaptureCore"
|
|
18
18
|
s.header_dir = "ScanditDataCaptureCore"
|
|
19
|
-
s.dependency 'ScanditCaptureCore', '= 6.18.
|
|
19
|
+
s.dependency 'ScanditCaptureCore', '= 6.18.2'
|
|
20
20
|
|
|
21
21
|
s.dependency "React"
|
|
22
22
|
end
|