@bluebillywig/react-native-bb-player 8.45.9 → 8.45.11

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.
@@ -2,6 +2,8 @@ package com.bluebillywig.bbplayer
2
2
 
3
3
  import android.app.Activity
4
4
  import android.util.Log
5
+ import android.view.Choreographer
6
+ import android.view.View.MeasureSpec
5
7
  import android.widget.FrameLayout
6
8
  import com.bluebillywig.bbnativeplayersdk.BBNativeShorts
7
9
  import com.bluebillywig.bbnativeplayersdk.BBNativeShortsView
@@ -9,6 +11,7 @@ import com.bluebillywig.bbnativeplayersdk.BBNativeShortsViewDelegate
9
11
  import com.facebook.react.bridge.Arguments
10
12
  import com.facebook.react.bridge.ReadableMap
11
13
  import com.facebook.react.bridge.WritableMap
14
+ import com.facebook.react.modules.core.ReactChoreographer
12
15
  import com.facebook.react.uimanager.ThemedReactContext
13
16
  import com.facebook.react.uimanager.UIManagerHelper
14
17
  import com.facebook.react.uimanager.events.Event
@@ -48,20 +51,47 @@ class BBShortsView(private val reactContext: ThemedReactContext) : FrameLayout(r
48
51
 
49
52
  private var shortsView: BBNativeShortsView? = null
50
53
 
54
+ // ReactChoreographer layout pattern - same as BBPlayerView
55
+ private var isLayoutEnqueued = false
56
+ private var constructorComplete = false
57
+
58
+ private val layoutCallback = Choreographer.FrameCallback {
59
+ isLayoutEnqueued = false
60
+ measure(
61
+ MeasureSpec.makeMeasureSpec(width, MeasureSpec.EXACTLY),
62
+ MeasureSpec.makeMeasureSpec(height, MeasureSpec.EXACTLY)
63
+ )
64
+ layout(left, top, right, bottom)
65
+ }
66
+
51
67
  init {
52
68
  // Default to black background for Shorts
53
69
  setBackgroundColor(android.graphics.Color.BLACK)
70
+ setPadding(0, 0, 0, 0)
71
+ clipToPadding = false
72
+ clipChildren = false
73
+ constructorComplete = true
74
+ }
75
+
76
+ override fun requestLayout() {
77
+ super.requestLayout()
78
+ if (!constructorComplete) return
79
+ if (!isLayoutEnqueued) {
80
+ isLayoutEnqueued = true
81
+ ReactChoreographer.getInstance()
82
+ .postFrameCallback(
83
+ ReactChoreographer.CallbackType.NATIVE_ANIMATED_MODULE,
84
+ layoutCallback
85
+ )
86
+ }
54
87
  }
55
88
 
56
- /**
57
- * Override onLayout to ensure child views receive proper bounds.
58
- * This is critical for React Native Fabric where layout isn't automatically propagated.
59
- */
60
89
  override fun onLayout(changed: Boolean, left: Int, top: Int, right: Int, bottom: Int) {
61
90
  super.onLayout(changed, left, top, right, bottom)
62
- // Explicitly layout all children to fill the container
91
+ val w = right - left
92
+ val h = bottom - top
63
93
  for (i in 0 until childCount) {
64
- getChildAt(i)?.layout(0, 0, right - left, bottom - top)
94
+ getChildAt(i)?.layout(0, 0, w, h)
65
95
  }
66
96
  }
67
97
 
@@ -2,17 +2,21 @@ package com.bluebillywig.bbplayer
2
2
 
3
3
  import com.facebook.react.bridge.ReadableArray
4
4
  import com.facebook.react.bridge.ReadableMap
5
- import com.facebook.react.uimanager.SimpleViewManager
6
5
  import com.facebook.react.uimanager.ThemedReactContext
6
+ import com.facebook.react.uimanager.ViewGroupManager
7
7
  import com.facebook.react.uimanager.annotations.ReactProp
8
8
 
9
9
  /**
10
10
  * ViewManager for BBShortsView - manages the React Native native view for Shorts playback.
11
+ * Uses ViewGroupManager (not SimpleViewManager) because the native Shorts view has child views
12
+ * that need custom layout propagation via needsCustomLayoutForChildren().
11
13
  */
12
- class BBShortsViewManager : SimpleViewManager<BBShortsView>() {
14
+ class BBShortsViewManager : ViewGroupManager<BBShortsView>() {
13
15
 
14
16
  override fun getName(): String = REACT_CLASS
15
17
 
18
+ override fun needsCustomLayoutForChildren(): Boolean = true
19
+
16
20
  override fun createViewInstance(reactContext: ThemedReactContext): BBShortsView {
17
21
  return BBShortsView(reactContext)
18
22
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bluebillywig/react-native-bb-player",
3
- "version": "8.45.9",
3
+ "version": "8.45.11",
4
4
  "description": "Blue Billywig Native Video Player for React Native - iOS AVPlayer and Android ExoPlayer integration",
5
5
  "main": "lib/commonjs/index.js",
6
6
  "module": "lib/module/index.js",