react-native-navigation 7.33.0-alpha.2 → 7.33.0-alpha.3

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.
@@ -11,10 +11,10 @@ import com.reactnativenavigation.react.ReactView
11
11
  class TitleBarReactView(context: Context?, reactInstanceManager: ReactInstanceManager?, componentId: String?,
12
12
  componentName: String?) : ReactView(context, reactInstanceManager, componentId, componentName) {
13
13
  override fun onMeasure(widthMeasureSpec: Int, heightMeasureSpec: Int) {
14
- super.onMeasure(interceptReactRootViewMeasureSpec(widthMeasureSpec), heightMeasureSpec)
14
+ super.onMeasure(interceptReactRootViewMeasureSpecWidth(widthMeasureSpec), interceptReactRootViewMeasureSpecHeight(heightMeasureSpec))
15
15
  }
16
16
 
17
- private fun interceptReactRootViewMeasureSpec(widthMeasureSpec: Int): Int {
17
+ private fun interceptReactRootViewMeasureSpecWidth(widthMeasureSpec: Int): Int {
18
18
  // This is a HACK.
19
19
  // ReactRootView has problematic behavior when setting width to WRAP_CONTENT,
20
20
  // It's causing infinite measurements, that hung up the UI.
@@ -29,4 +29,20 @@ class TitleBarReactView(context: Context?, reactInstanceManager: ReactInstanceMa
29
29
  return if (measuredWidth > 0) MeasureSpec.makeMeasureSpec(measuredWidth, MeasureSpec.EXACTLY) else
30
30
  widthMeasureSpec
31
31
  }
32
+
33
+ private fun interceptReactRootViewMeasureSpecHeight(heightMeasureSpec: Int): Int {
34
+ // This is a HACK.
35
+ // ReactRootView has problematic behavior when setting width to WRAP_CONTENT,
36
+ // It's causing infinite measurements, that hung up the UI.
37
+ // Intercepting largest child by height, and use its height as (parent) ReactRootView width fixed that.
38
+ // See for more details https://github.com/wix/react-native-navigation/pull/7096
39
+ var measuredHeight = 0
40
+
41
+ if (rootViewGroup.children.count() > 0) {
42
+ measuredHeight = (((rootViewGroup.children.first() as ViewGroup).children.first() as ViewGroup).children.first() as ViewGroup).height
43
+ }
44
+
45
+ return if (measuredHeight > 0) MeasureSpec.makeMeasureSpec(measuredHeight, MeasureSpec.EXACTLY) else
46
+ heightMeasureSpec
47
+ }
32
48
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-navigation",
3
- "version": "7.33.0-alpha.2",
3
+ "version": "7.33.0-alpha.3",
4
4
  "description": "React Native Navigation - truly native navigation for iOS and Android",
5
5
  "license": "MIT",
6
6
  "nativePackage": true,