react-native-navigation 8.8.8-snapshot.2616 → 8.8.9-snapshot.2628
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.
|
@@ -50,10 +50,12 @@ public class TitleBarReactButtonView extends ReactView {
|
|
|
50
50
|
// before the content has laid out that width is collapsed (~1px), Fabric lays the content into
|
|
51
51
|
// it and the button never recovers (#8320/#8326 did this and regressed under the New Arch).
|
|
52
52
|
//
|
|
53
|
-
// Height:
|
|
54
|
-
//
|
|
55
|
-
//
|
|
56
|
-
//
|
|
53
|
+
// Height: bounded (AT_MOST) so the surface sizes to its content height. The view is then
|
|
54
|
+
// centered vertically by the toolbar's action-view layout and the CENTER_VERTICAL gravity set
|
|
55
|
+
// in onViewAdded(). Forcing EXACTLY the full bar height (as #8328 did) made the surface fill
|
|
56
|
+
// the bar, so content-hugging buttons that don't self-center (plain text like "Publish", a
|
|
57
|
+
// fixed-size avatar image) were pinned to the top. AT_MOST height does NOT cause the width
|
|
58
|
+
// collapse — only a forced EXACTLY *width* does.
|
|
57
59
|
int widthSpec = component.width.hasValue()
|
|
58
60
|
? createExactSpec(component.width)
|
|
59
61
|
: makeMeasureSpec(resolveAvailableWidth(widthMeasureSpec), AT_MOST);
|
|
@@ -66,7 +68,7 @@ public class TitleBarReactButtonView extends ReactView {
|
|
|
66
68
|
return createExactSpec(dimension);
|
|
67
69
|
}
|
|
68
70
|
int availableSize = MeasureSpec.getSize(measureSpec);
|
|
69
|
-
return makeMeasureSpec(availableSize > 0 ? availableSize : Math.max(resolveActionBarSize(), 1),
|
|
71
|
+
return makeMeasureSpec(availableSize > 0 ? availableSize : Math.max(resolveActionBarSize(), 1), AT_MOST);
|
|
70
72
|
}
|
|
71
73
|
|
|
72
74
|
private int resolveAvailableWidth(int measureSpec) {
|
package/android/src/test/java/com/reactnativenavigation/views/TitleBarReactButtonViewTest.java
CHANGED
|
@@ -34,12 +34,14 @@ public class TitleBarReactButtonViewTest extends BaseTest {
|
|
|
34
34
|
|
|
35
35
|
// Without explicit dimensions the button measures the hosted React surface ONCE:
|
|
36
36
|
// - width AT_MOST → the surface sizes itself to its content (max-of-children under Fabric).
|
|
37
|
-
// - height
|
|
38
|
-
//
|
|
37
|
+
// - height AT_MOST → the surface sizes to its content height; the view is then centered
|
|
38
|
+
// vertically in the bar by the toolbar's action-view layout + the CENTER_VERTICAL gravity from
|
|
39
|
+
// onViewAdded(). A forced EXACTLY full-bar height would pin content-hugging buttons (plain
|
|
40
|
+
// text, a fixed-size avatar) to the top.
|
|
39
41
|
// It deliberately does not push a forced EXACTLY *width*; under the New Architecture that re-pushes
|
|
40
42
|
// a (initially collapsed) width to the async Fabric layout and the button never recovers.
|
|
41
43
|
@Test
|
|
42
|
-
public void
|
|
44
|
+
public void missingDimensionsSizeToContent() {
|
|
43
45
|
Activity activity = newActivity();
|
|
44
46
|
TitleBarReactButtonView uut = createView(activity, new ComponentOptions());
|
|
45
47
|
RecordingContentView child = new RecordingContentView(activity);
|
|
@@ -48,11 +50,11 @@ public class TitleBarReactButtonViewTest extends BaseTest {
|
|
|
48
50
|
uut.measure(makeMeasureSpec(PARENT_WIDTH, AT_MOST), makeMeasureSpec(PARENT_HEIGHT, AT_MOST));
|
|
49
51
|
|
|
50
52
|
assertThat(uut.getMeasuredWidth()).isEqualTo(CHILD_WIDTH);
|
|
51
|
-
assertThat(uut.getMeasuredHeight()).isEqualTo(
|
|
53
|
+
assertThat(uut.getMeasuredHeight()).isEqualTo(CHILD_HEIGHT);
|
|
52
54
|
assertThat(child.widthMeasureSpecs.size()).isEqualTo(1);
|
|
53
55
|
assertThat(getMode(child.widthMeasureSpecs.get(0))).isEqualTo(AT_MOST);
|
|
54
56
|
assertThat(getSize(child.widthMeasureSpecs.get(0))).isEqualTo(PARENT_WIDTH);
|
|
55
|
-
assertThat(getMode(child.heightMeasureSpecs.get(0))).isEqualTo(
|
|
57
|
+
assertThat(getMode(child.heightMeasureSpecs.get(0))).isEqualTo(AT_MOST);
|
|
56
58
|
assertThat(getSize(child.heightMeasureSpecs.get(0))).isEqualTo(PARENT_HEIGHT);
|
|
57
59
|
}
|
|
58
60
|
|
|
@@ -78,7 +80,7 @@ public class TitleBarReactButtonViewTest extends BaseTest {
|
|
|
78
80
|
}
|
|
79
81
|
|
|
80
82
|
@Test
|
|
81
|
-
public void
|
|
83
|
+
public void zeroParentSpecsFallBackToScreenWidthAndBoundedActionBarHeight() {
|
|
82
84
|
Activity activity = newActivity();
|
|
83
85
|
TitleBarReactButtonView uut = createView(activity, new ComponentOptions());
|
|
84
86
|
RecordingContentView child = new RecordingContentView(activity);
|
|
@@ -90,12 +92,12 @@ public class TitleBarReactButtonViewTest extends BaseTest {
|
|
|
90
92
|
assertThat(getMode(child.widthMeasureSpecs.get(0))).isEqualTo(AT_MOST);
|
|
91
93
|
assertThat(getSize(child.widthMeasureSpecs.get(0)))
|
|
92
94
|
.isEqualTo(Math.max(activity.getResources().getDisplayMetrics().widthPixels, 1));
|
|
93
|
-
assertThat(getMode(child.heightMeasureSpecs.get(0))).isEqualTo(
|
|
95
|
+
assertThat(getMode(child.heightMeasureSpecs.get(0))).isEqualTo(AT_MOST);
|
|
94
96
|
assertThat(getSize(child.heightMeasureSpecs.get(0))).isEqualTo(Math.max(resolveActionBarSize(activity), 1));
|
|
95
97
|
}
|
|
96
98
|
|
|
97
99
|
@Test
|
|
98
|
-
public void
|
|
100
|
+
public void rtlMissingDimensionsUseBoundedWidthAndHeight() {
|
|
99
101
|
Activity activity = newActivity();
|
|
100
102
|
TitleBarReactButtonView uut = createView(activity, new ComponentOptions());
|
|
101
103
|
RecordingContentView child = new RecordingContentView(activity);
|
|
@@ -107,7 +109,7 @@ public class TitleBarReactButtonViewTest extends BaseTest {
|
|
|
107
109
|
assertThat(child.widthMeasureSpecs.size()).isEqualTo(1);
|
|
108
110
|
assertThat(getMode(child.widthMeasureSpecs.get(0))).isEqualTo(AT_MOST);
|
|
109
111
|
assertThat(getSize(child.widthMeasureSpecs.get(0))).isEqualTo(PARENT_WIDTH);
|
|
110
|
-
assertThat(getMode(child.heightMeasureSpecs.get(0))).isEqualTo(
|
|
112
|
+
assertThat(getMode(child.heightMeasureSpecs.get(0))).isEqualTo(AT_MOST);
|
|
111
113
|
assertThat(getSize(child.heightMeasureSpecs.get(0))).isEqualTo(PARENT_HEIGHT);
|
|
112
114
|
}
|
|
113
115
|
|
package/package.json
CHANGED