react-native-navigation 7.33.0-alpha.4 → 7.33.0-alpha.6

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,7 @@ package com.reactnativenavigation.views.stack.topbar.titlebar
2
2
 
3
3
  import android.annotation.SuppressLint
4
4
  import android.content.Context
5
+ import android.util.Log
5
6
  import android.view.View
6
7
  import android.view.ViewGroup
7
8
  import androidx.core.view.children
@@ -21,7 +22,7 @@ class TitleBarReactView(context: Context?, reactInstanceManager: ReactInstanceMa
21
22
  // It's causing infinite measurements, that hung up the UI.
22
23
  // Intercepting largest child by width, and use its width as (parent) ReactRootView width fixed that.
23
24
  // See for more details https://github.com/wix/react-native-navigation/pull/7096
24
- val measuredWidth = this.getRootViewFirstChild()?.width
25
+ val measuredWidth = this.getLastRootViewChild()?.width
25
26
 
26
27
  return if (measuredWidth != null) MeasureSpec.makeMeasureSpec(measuredWidth, MeasureSpec.EXACTLY) else
27
28
  widthMeasureSpec
@@ -33,23 +34,26 @@ class TitleBarReactView(context: Context?, reactInstanceManager: ReactInstanceMa
33
34
  // It's causing infinite measurements, that hung up the UI.
34
35
  // Intercepting largest child by height, and use its height as (parent) ReactRootView width fixed that.
35
36
  // See for more details https://github.com/wix/react-native-navigation/pull/7096
36
- val measuredHeight = this.getRootViewFirstChild()?.height
37
+ val measuredHeight = this.getLastRootViewChild()?.height
37
38
 
38
39
  return if (measuredHeight != null) MeasureSpec.makeMeasureSpec(measuredHeight, MeasureSpec.EXACTLY) else
39
40
  heightMeasureSpec
40
41
  }
41
42
 
42
- private fun getRootViewFirstChild(): View? {
43
- if (rootViewGroup.children.count() > 0) {
43
+ private fun getLastRootViewChild(): View? {
44
+ if (rootViewGroup.children.count() == 0) {
44
45
  return null
45
46
  }
46
- var rootViewGroupFirstChild: View = rootViewGroup.children.first()
47
- while(true) try {
48
- (rootViewGroupFirstChild as ViewGroup).children.first().also { rootViewGroupFirstChild = it }
47
+ var rootViewGroupLastChild: View = rootViewGroup
48
+ var next = rootViewGroup as Any
49
+ while(next is ViewGroup && next.childCount > 0) try {
50
+ rootViewGroupLastChild = next
51
+ next.children.first().also { next = it }
52
+
49
53
  } catch (e: Exception) {
50
- //
54
+ Log.i("TitleBarReactView", "getRootViewFirstChild: ${e.message}")
51
55
  }
52
56
  @Suppress("UNREACHABLE_CODE")
53
- return rootViewGroupFirstChild
57
+ return rootViewGroupLastChild
54
58
  }
55
- }
59
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-navigation",
3
- "version": "7.33.0-alpha.4",
3
+ "version": "7.33.0-alpha.6",
4
4
  "description": "React Native Navigation - truly native navigation for iOS and Android",
5
5
  "license": "MIT",
6
6
  "nativePackage": true,