@upscopeio/react-native-sdk 2026.7.1 → 2026.7.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.kts +13 -1
- package/android/src/main/kotlin/io/upscope/reactnative/UpscopeMaskedView.kt +28 -0
- package/android/src/main/kotlin/io/upscope/reactnative/UpscopeMaskedViewManager.kt +3 -16
- package/android/src/test/kotlin/io/upscope/reactnative/UpscopeMaskedViewTest.kt +52 -0
- package/lib/commonjs/version.js +1 -1
- package/lib/module/version.js +1 -1
- package/lib/typescript/version.d.ts +1 -1
- package/package.json +1 -1
- package/src/version.ts +1 -1
- package/upscopeio-react-native-sdk.podspec +1 -1
package/android/build.gradle.kts
CHANGED
|
@@ -27,10 +27,22 @@ android {
|
|
|
27
27
|
named("main") {
|
|
28
28
|
java.srcDirs("src/main/kotlin")
|
|
29
29
|
}
|
|
30
|
+
named("test") {
|
|
31
|
+
java.srcDirs("src/test/kotlin")
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
testOptions {
|
|
36
|
+
unitTests {
|
|
37
|
+
isIncludeAndroidResources = true
|
|
38
|
+
}
|
|
30
39
|
}
|
|
31
40
|
}
|
|
32
41
|
|
|
33
42
|
dependencies {
|
|
34
43
|
implementation("com.facebook.react:react-android")
|
|
35
|
-
implementation("io.github.upscopeio:upscope-android-sdk:2026.7.
|
|
44
|
+
implementation("io.github.upscopeio:upscope-android-sdk:2026.7.3")
|
|
45
|
+
|
|
46
|
+
testImplementation("junit:junit:4.13.2")
|
|
47
|
+
testImplementation("org.robolectric:robolectric:4.16")
|
|
36
48
|
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
package io.upscope.reactnative
|
|
2
|
+
|
|
3
|
+
import android.content.Context
|
|
4
|
+
import android.view.View
|
|
5
|
+
import com.facebook.react.views.view.ReactViewGroup
|
|
6
|
+
import io.upscope.sdk.Upscope
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Host view for the UpscopeMasked component. Extends ReactViewGroup so that
|
|
10
|
+
* Android-initiated layout passes never reposition the Yoga-laid-out children
|
|
11
|
+
* (ReactViewGroup no-ops onLayout and terminates requestLayout); a plain
|
|
12
|
+
* ViewGroup would stack all children at the top-left on the first native
|
|
13
|
+
* layout pass after window attach.
|
|
14
|
+
*/
|
|
15
|
+
class UpscopeMaskedView(context: Context) : ReactViewGroup(context) {
|
|
16
|
+
|
|
17
|
+
init {
|
|
18
|
+
addOnAttachStateChangeListener(object : View.OnAttachStateChangeListener {
|
|
19
|
+
override fun onViewAttachedToWindow(v: View) {
|
|
20
|
+
Upscope.addMaskedView(v)
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
override fun onViewDetachedFromWindow(v: View) {
|
|
24
|
+
Upscope.removeMaskedView(v)
|
|
25
|
+
}
|
|
26
|
+
})
|
|
27
|
+
}
|
|
28
|
+
}
|
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
package io.upscope.reactnative
|
|
2
2
|
|
|
3
|
-
import android.widget.FrameLayout
|
|
4
3
|
import com.facebook.react.module.annotations.ReactModule
|
|
5
4
|
import com.facebook.react.uimanager.ThemedReactContext
|
|
6
5
|
import com.facebook.react.uimanager.ViewGroupManager
|
|
7
|
-
import io.upscope.sdk.Upscope
|
|
8
6
|
|
|
9
7
|
@ReactModule(name = UpscopeMaskedViewManager.NAME)
|
|
10
|
-
class UpscopeMaskedViewManager : ViewGroupManager<
|
|
8
|
+
class UpscopeMaskedViewManager : ViewGroupManager<UpscopeMaskedView>() {
|
|
11
9
|
|
|
12
10
|
companion object {
|
|
13
11
|
const val NAME = "UpscopeMaskedView"
|
|
@@ -15,17 +13,6 @@ class UpscopeMaskedViewManager : ViewGroupManager<FrameLayout>() {
|
|
|
15
13
|
|
|
16
14
|
override fun getName(): String = NAME
|
|
17
15
|
|
|
18
|
-
override fun createViewInstance(reactContext: ThemedReactContext):
|
|
19
|
-
|
|
20
|
-
view.addOnAttachStateChangeListener(object : android.view.View.OnAttachStateChangeListener {
|
|
21
|
-
override fun onViewAttachedToWindow(v: android.view.View) {
|
|
22
|
-
Upscope.addMaskedView(v)
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
override fun onViewDetachedFromWindow(v: android.view.View) {
|
|
26
|
-
Upscope.removeMaskedView(v)
|
|
27
|
-
}
|
|
28
|
-
})
|
|
29
|
-
return view
|
|
30
|
-
}
|
|
16
|
+
override fun createViewInstance(reactContext: ThemedReactContext): UpscopeMaskedView =
|
|
17
|
+
UpscopeMaskedView(reactContext)
|
|
31
18
|
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
package io.upscope.reactnative
|
|
2
|
+
|
|
3
|
+
import android.view.View
|
|
4
|
+
import android.widget.TextView
|
|
5
|
+
import org.junit.Assert.assertEquals
|
|
6
|
+
import org.junit.Test
|
|
7
|
+
import org.junit.runner.RunWith
|
|
8
|
+
import org.robolectric.RobolectricTestRunner
|
|
9
|
+
import org.robolectric.RuntimeEnvironment
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* React Native positions children directly via layout() calls from Yoga; the
|
|
13
|
+
* host view must not re-run Android's own layout pass on them. A plain
|
|
14
|
+
* FrameLayout does exactly that on the window-attach layout pass (cold start),
|
|
15
|
+
* stacking every child at the top-left corner.
|
|
16
|
+
*/
|
|
17
|
+
@RunWith(RobolectricTestRunner::class)
|
|
18
|
+
class UpscopeMaskedViewTest {
|
|
19
|
+
|
|
20
|
+
@Test
|
|
21
|
+
fun childrenKeepRnAssignedPositionsAcrossAndroidLayoutPass() {
|
|
22
|
+
val context = RuntimeEnvironment.getApplication()
|
|
23
|
+
val view = UpscopeMaskedView(context)
|
|
24
|
+
val line1 = TextView(context)
|
|
25
|
+
val line2 = TextView(context)
|
|
26
|
+
view.addView(line1)
|
|
27
|
+
view.addView(line2)
|
|
28
|
+
|
|
29
|
+
// RN (Yoga) lays out the container, then positions children directly.
|
|
30
|
+
measureExactly(view, 720, 200)
|
|
31
|
+
view.layout(0, 0, 720, 200)
|
|
32
|
+
line1.layout(0, 0, 720, 100)
|
|
33
|
+
line2.layout(0, 100, 720, 200)
|
|
34
|
+
|
|
35
|
+
// Android-initiated layout pass, e.g. window attach on cold start
|
|
36
|
+
// (attach requests layout, forcing measure/layout to re-run).
|
|
37
|
+
view.forceLayout()
|
|
38
|
+
measureExactly(view, 720, 200)
|
|
39
|
+
view.layout(0, 0, 720, 200)
|
|
40
|
+
|
|
41
|
+
assertEquals(0, line1.top)
|
|
42
|
+
assertEquals(100, line2.top)
|
|
43
|
+
assertEquals(200, line2.bottom)
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
private fun measureExactly(view: View, width: Int, height: Int) {
|
|
47
|
+
view.measure(
|
|
48
|
+
View.MeasureSpec.makeMeasureSpec(width, View.MeasureSpec.EXACTLY),
|
|
49
|
+
View.MeasureSpec.makeMeasureSpec(height, View.MeasureSpec.EXACTLY),
|
|
50
|
+
)
|
|
51
|
+
}
|
|
52
|
+
}
|
package/lib/commonjs/version.js
CHANGED
|
@@ -5,5 +5,5 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.SDK_VERSION = void 0;
|
|
7
7
|
// Auto-generated by scripts/generate-version.sh — do not edit manually
|
|
8
|
-
const SDK_VERSION = exports.SDK_VERSION = "2026.7.
|
|
8
|
+
const SDK_VERSION = exports.SDK_VERSION = "2026.7.2";
|
|
9
9
|
//# sourceMappingURL=version.js.map
|
package/lib/module/version.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "2026.7.
|
|
1
|
+
export declare const SDK_VERSION = "2026.7.2";
|
|
2
2
|
//# sourceMappingURL=version.d.ts.map
|
package/package.json
CHANGED
package/src/version.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// Auto-generated by scripts/generate-version.sh — do not edit manually
|
|
2
|
-
export const SDK_VERSION = "2026.7.
|
|
2
|
+
export const SDK_VERSION = "2026.7.2";
|