react-native-navigation 7.33.2 → 7.33.3-hotfix.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/jest.config.js +3 -2
- package/lib/Mock/Layouts/BottomTabsNode.ts +2 -1
- package/lib/android/app/src/main/java/com/reactnativenavigation/views/stack/topbar/titlebar/TitleAndButtonsContainer.kt +4 -0
- package/lib/android/app/src/reactNative51/java/com/reactnativenavigation/views/stack/topbar/titlebar/TitleBarReactView.kt +1 -0
- package/lib/android/app/src/reactNative55/java/com/reactnativenavigation/views/stack/topbar/titlebar/TitleBarReactView.kt +1 -0
- package/lib/android/app/src/reactNative56/java/com/reactnativenavigation/views/stack/topbar/titlebar/TitleBarReactView.kt +1 -0
- package/lib/android/app/src/reactNative57/java/com/reactnativenavigation/views/stack/topbar/titlebar/TitleBarReactView.kt +1 -0
- package/lib/android/app/src/reactNative57_5/java/com/reactnativenavigation/views/stack/topbar/titlebar/TitleBarReactView.kt +1 -0
- package/lib/android/app/src/reactNative60/java/com/reactnativenavigation/views/stack/topbar/titlebar/TitleBarReactView.kt +1 -0
- package/lib/android/app/src/reactNative62/java/com/reactnativenavigation/views/stack/topbar/titlebar/TitleBarReactView.kt +1 -0
- package/lib/android/app/src/reactNative63/java/com/reactnativenavigation/views/stack/topbar/titlebar/TitleBarReactView.kt +1 -0
- package/lib/android/app/src/reactNative68/java/com/reactnativenavigation/views/stack/topbar/titlebar/TitleBarReactView.kt +1 -0
- package/lib/android/app/src/reactNative71/java/com/reactnativenavigation/views/stack/topbar/titlebar/TitleBarReactView.kt +10 -54
- package/lib/dist/Mock/Layouts/BottomTabsNode.js +2 -1
- package/lib/ios/RNNBaseIconCreator.m +1 -1
- package/lib/ios/RNNBottomTabsController.m +5 -5
- package/lib/ios/RNNButtonOptions.h +2 -1
- package/lib/ios/RNNButtonOptions.m +10 -3
- package/lib/ios/RNNUIBarButtonItem.m +5 -6
- package/package.json +1 -1
package/jest.config.js
CHANGED
|
@@ -8,6 +8,7 @@ module.exports = {
|
|
|
8
8
|
},
|
|
9
9
|
roots: [
|
|
10
10
|
'<rootDir>/lib/src/',
|
|
11
|
+
'<rootDir>/lib/Mock/',
|
|
11
12
|
'<rootDir>/playground/src/',
|
|
12
13
|
'<rootDir>/integration/',
|
|
13
14
|
'<rootDir>/scripts/',
|
|
@@ -23,8 +24,8 @@ module.exports = {
|
|
|
23
24
|
'<rootDir>/playground/img/layouts@2x.png',
|
|
24
25
|
},
|
|
25
26
|
collectCoverageFrom: [
|
|
26
|
-
'lib/src/**/*.ts',
|
|
27
|
-
'lib/
|
|
27
|
+
'lib/src/**/*.(ts|tsx)',
|
|
28
|
+
'lib/Mock/**/*.(ts|tsx)',
|
|
28
29
|
'integration/**/*.js',
|
|
29
30
|
'!lib/dist/index.js',
|
|
30
31
|
'!lib/dist/Navigation.js',
|
|
@@ -4,9 +4,10 @@ import { switchTabByIndex } from '../actions/layoutActions';
|
|
|
4
4
|
import ParentNode from './ParentNode';
|
|
5
5
|
|
|
6
6
|
export default class BottomTabsNode extends ParentNode {
|
|
7
|
-
selectedIndex: number
|
|
7
|
+
selectedIndex: number;
|
|
8
8
|
constructor(layout: any, parentNode?: ParentNode) {
|
|
9
9
|
super(layout, 'BottomTabs', parentNode);
|
|
10
|
+
this.selectedIndex = layout.data?.options?.bottomTabs?.currentTabIndex || 0;
|
|
10
11
|
}
|
|
11
12
|
|
|
12
13
|
mergeOptions(options: Options) {
|
|
@@ -153,6 +153,10 @@ class TitleAndButtonsContainer(context: Context) : ViewGroup(context) {
|
|
|
153
153
|
val isCenter = titleComponentAlignment == Alignment.Center
|
|
154
154
|
val titleHeightMeasureSpec = MeasureSpec.makeMeasureSpec(containerHeight, MeasureSpec.AT_MOST)
|
|
155
155
|
val titleWidthMeasureSpec = makeTitleAtMostWidthMeasureSpec(containerWidth, rightBarWidth, leftBarWidth, isCenter)
|
|
156
|
+
if (titleComponent is TitleBarReactView) {
|
|
157
|
+
titleComponent.centered = isCenter
|
|
158
|
+
}
|
|
159
|
+
|
|
156
160
|
titleComponent.measure(titleWidthMeasureSpec, titleHeightMeasureSpec)
|
|
157
161
|
}
|
|
158
162
|
|
|
@@ -9,6 +9,7 @@ import com.reactnativenavigation.react.ReactView
|
|
|
9
9
|
@SuppressLint("ViewConstructor")
|
|
10
10
|
class TitleBarReactView(context: Context?, reactInstanceManager: ReactInstanceManager?, componentId: String?,
|
|
11
11
|
componentName: String?) : ReactView(context, reactInstanceManager, componentId, componentName) {
|
|
12
|
+
var centered: Boolean = false
|
|
12
13
|
override fun onMeasure(widthMeasureSpec: Int, heightMeasureSpec: Int) {
|
|
13
14
|
super.onMeasure(interceptReactRootViewMeasureSpec(widthMeasureSpec), heightMeasureSpec)
|
|
14
15
|
}
|
|
@@ -9,6 +9,7 @@ import com.reactnativenavigation.react.ReactView
|
|
|
9
9
|
@SuppressLint("ViewConstructor")
|
|
10
10
|
class TitleBarReactView(context: Context?, reactInstanceManager: ReactInstanceManager?, componentId: String?,
|
|
11
11
|
componentName: String?) : ReactView(context, reactInstanceManager, componentId, componentName) {
|
|
12
|
+
var centered: Boolean = false
|
|
12
13
|
override fun onMeasure(widthMeasureSpec: Int, heightMeasureSpec: Int) {
|
|
13
14
|
super.onMeasure(interceptReactRootViewMeasureSpec(widthMeasureSpec), heightMeasureSpec)
|
|
14
15
|
}
|
|
@@ -9,6 +9,7 @@ import com.reactnativenavigation.react.ReactView
|
|
|
9
9
|
@SuppressLint("ViewConstructor")
|
|
10
10
|
class TitleBarReactView(context: Context?, reactInstanceManager: ReactInstanceManager?, componentId: String?,
|
|
11
11
|
componentName: String?) : ReactView(context, reactInstanceManager, componentId, componentName) {
|
|
12
|
+
var centered: Boolean = false
|
|
12
13
|
override fun onMeasure(widthMeasureSpec: Int, heightMeasureSpec: Int) {
|
|
13
14
|
super.onMeasure(interceptReactRootViewMeasureSpec(widthMeasureSpec), heightMeasureSpec)
|
|
14
15
|
}
|
|
@@ -9,6 +9,7 @@ import com.reactnativenavigation.react.ReactView
|
|
|
9
9
|
@SuppressLint("ViewConstructor")
|
|
10
10
|
class TitleBarReactView(context: Context?, reactInstanceManager: ReactInstanceManager?, componentId: String?,
|
|
11
11
|
componentName: String?) : ReactView(context, reactInstanceManager, componentId, componentName) {
|
|
12
|
+
var centered: Boolean = false
|
|
12
13
|
override fun onMeasure(widthMeasureSpec: Int, heightMeasureSpec: Int) {
|
|
13
14
|
super.onMeasure(interceptReactRootViewMeasureSpec(widthMeasureSpec), heightMeasureSpec)
|
|
14
15
|
}
|
|
@@ -9,6 +9,7 @@ import com.reactnativenavigation.react.ReactView
|
|
|
9
9
|
@SuppressLint("ViewConstructor")
|
|
10
10
|
class TitleBarReactView(context: Context?, reactInstanceManager: ReactInstanceManager?, componentId: String?,
|
|
11
11
|
componentName: String?) : ReactView(context, reactInstanceManager, componentId, componentName) {
|
|
12
|
+
var centered: Boolean = false
|
|
12
13
|
override fun onMeasure(widthMeasureSpec: Int, heightMeasureSpec: Int) {
|
|
13
14
|
super.onMeasure(interceptReactRootViewMeasureSpec(widthMeasureSpec), heightMeasureSpec)
|
|
14
15
|
}
|
|
@@ -9,6 +9,7 @@ import com.reactnativenavigation.react.ReactView
|
|
|
9
9
|
@SuppressLint("ViewConstructor")
|
|
10
10
|
class TitleBarReactView(context: Context?, reactInstanceManager: ReactInstanceManager?, componentId: String?,
|
|
11
11
|
componentName: String?) : ReactView(context, reactInstanceManager, componentId, componentName) {
|
|
12
|
+
var centered: Boolean = false
|
|
12
13
|
override fun onMeasure(widthMeasureSpec: Int, heightMeasureSpec: Int) {
|
|
13
14
|
super.onMeasure(interceptReactRootViewMeasureSpec(widthMeasureSpec), heightMeasureSpec)
|
|
14
15
|
}
|
|
@@ -9,6 +9,7 @@ import com.reactnativenavigation.react.ReactView
|
|
|
9
9
|
@SuppressLint("ViewConstructor")
|
|
10
10
|
class TitleBarReactView(context: Context?, reactInstanceManager: ReactInstanceManager?, componentId: String?,
|
|
11
11
|
componentName: String?) : ReactView(context, reactInstanceManager, componentId, componentName) {
|
|
12
|
+
var centered: Boolean = false
|
|
12
13
|
override fun onMeasure(widthMeasureSpec: Int, heightMeasureSpec: Int) {
|
|
13
14
|
super.onMeasure(interceptReactRootViewMeasureSpec(widthMeasureSpec), heightMeasureSpec)
|
|
14
15
|
}
|
|
@@ -9,6 +9,7 @@ import com.reactnativenavigation.react.ReactView
|
|
|
9
9
|
@SuppressLint("ViewConstructor")
|
|
10
10
|
class TitleBarReactView(context: Context?, reactInstanceManager: ReactInstanceManager?, componentId: String?,
|
|
11
11
|
componentName: String?) : ReactView(context, reactInstanceManager, componentId, componentName) {
|
|
12
|
+
var centered: Boolean = false
|
|
12
13
|
override fun onMeasure(widthMeasureSpec: Int, heightMeasureSpec: Int) {
|
|
13
14
|
super.onMeasure(interceptReactRootViewMeasureSpec(widthMeasureSpec), heightMeasureSpec)
|
|
14
15
|
}
|
|
@@ -9,6 +9,7 @@ import com.reactnativenavigation.react.ReactView
|
|
|
9
9
|
@SuppressLint("ViewConstructor")
|
|
10
10
|
class TitleBarReactView(context: Context?, reactInstanceManager: ReactInstanceManager?, componentId: String?,
|
|
11
11
|
componentName: String?) : ReactView(context, reactInstanceManager, componentId, componentName) {
|
|
12
|
+
var centered: Boolean = false
|
|
12
13
|
override fun onMeasure(widthMeasureSpec: Int, heightMeasureSpec: Int) {
|
|
13
14
|
super.onMeasure(interceptReactRootViewMeasureSpec(widthMeasureSpec), heightMeasureSpec)
|
|
14
15
|
}
|
|
@@ -11,61 +11,17 @@ import com.reactnativenavigation.react.ReactView
|
|
|
11
11
|
@SuppressLint("ViewConstructor")
|
|
12
12
|
class TitleBarReactView(context: Context?, reactInstanceManager: ReactInstanceManager?, componentId: String?,
|
|
13
13
|
componentName: String?) : ReactView(context, reactInstanceManager, componentId, componentName) {
|
|
14
|
+
var centered: Boolean = false
|
|
14
15
|
override fun onMeasure(widthMeasureSpec: Int, heightMeasureSpec: Int) {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
// See for more details https://github.com/wix/react-native-navigation/pull/7096
|
|
24
|
-
val measuredWidth = this.getLastRootViewChildMaxWidth()
|
|
25
|
-
|
|
26
|
-
return MeasureSpec.makeMeasureSpec(measuredWidth, MeasureSpec.EXACTLY)
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
private fun interceptReactRootViewMeasureSpecHeight(heightMeasureSpec: Int): Int {
|
|
30
|
-
// This is a HACK.
|
|
31
|
-
// ReactRootView has problematic behavior when setting width to WRAP_CONTENT,
|
|
32
|
-
// It's causing infinite measurements, that hung up the UI.
|
|
33
|
-
// Intercepting largest child by height, and use its height as (parent) ReactRootView width fixed that.
|
|
34
|
-
// See for more details https://github.com/wix/react-native-navigation/pull/7096
|
|
35
|
-
val measuredHeight = this.getLastRootViewChild()?.height
|
|
36
|
-
|
|
37
|
-
return if (measuredHeight != null) MeasureSpec.makeMeasureSpec(measuredHeight, MeasureSpec.EXACTLY) else
|
|
38
|
-
heightMeasureSpec
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
private fun getLastRootViewChildMaxWidth(): Int {
|
|
42
|
-
if (rootViewGroup.children.count() == 0) {
|
|
43
|
-
return 0
|
|
44
|
-
}
|
|
45
|
-
var maxWidth = rootViewGroup.width
|
|
46
|
-
var next = rootViewGroup as Any
|
|
47
|
-
while(next is ViewGroup) { //try {
|
|
48
|
-
if (next.width > maxWidth) {
|
|
49
|
-
maxWidth = next.width
|
|
50
|
-
}
|
|
51
|
-
if (next.children.count() == 0) break
|
|
52
|
-
next.children.first().also { next = it }
|
|
53
|
-
}
|
|
54
|
-
return maxWidth
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
private fun getLastRootViewChild(): View? {
|
|
58
|
-
if (rootViewGroup.children.count() == 0) {
|
|
59
|
-
return null
|
|
60
|
-
}
|
|
61
|
-
var rootViewGroupLastChild: View = rootViewGroup
|
|
62
|
-
var next = rootViewGroup as Any
|
|
63
|
-
while(next is ViewGroup) { //try {
|
|
64
|
-
rootViewGroupLastChild = next
|
|
65
|
-
if (next.children.count() == 0) break
|
|
66
|
-
next.children.first().also { next = it }
|
|
16
|
+
var titleHeightMeasureSpec: Int
|
|
17
|
+
var titleWidthMeasureSpec: Int
|
|
18
|
+
if (centered) {
|
|
19
|
+
titleHeightMeasureSpec = MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED)
|
|
20
|
+
titleWidthMeasureSpec = MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED)
|
|
21
|
+
} else {
|
|
22
|
+
titleHeightMeasureSpec = heightMeasureSpec
|
|
23
|
+
titleWidthMeasureSpec = widthMeasureSpec
|
|
67
24
|
}
|
|
68
|
-
|
|
69
|
-
return rootViewGroupLastChild
|
|
25
|
+
super.onMeasure(titleWidthMeasureSpec, titleHeightMeasureSpec)
|
|
70
26
|
}
|
|
71
27
|
}
|
|
@@ -5,9 +5,10 @@ const lodash_1 = (0, tslib_1.__importDefault)(require("lodash"));
|
|
|
5
5
|
const layoutActions_1 = require("../actions/layoutActions");
|
|
6
6
|
const ParentNode_1 = (0, tslib_1.__importDefault)(require("./ParentNode"));
|
|
7
7
|
class BottomTabsNode extends ParentNode_1.default {
|
|
8
|
-
selectedIndex
|
|
8
|
+
selectedIndex;
|
|
9
9
|
constructor(layout, parentNode) {
|
|
10
10
|
super(layout, 'BottomTabs', parentNode);
|
|
11
|
+
this.selectedIndex = layout.data?.options?.bottomTabs?.currentTabIndex || 0;
|
|
11
12
|
}
|
|
12
13
|
mergeOptions(options) {
|
|
13
14
|
super.mergeOptions(options);
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
|
|
19
19
|
- (UIImage *)createEnabledIcon:(RNNButtonOptions *)buttonOptions {
|
|
20
20
|
UIColor *backgroundColor = [buttonOptions.iconBackground.color withDefault:UIColor.clearColor];
|
|
21
|
-
UIColor *tintColor =
|
|
21
|
+
UIColor *tintColor = buttonOptions.resolveColor;
|
|
22
22
|
|
|
23
23
|
return [self createIcon:buttonOptions tintColor:tintColor backgroundColor:backgroundColor];
|
|
24
24
|
}
|
|
@@ -58,11 +58,11 @@
|
|
|
58
58
|
- (void)viewWillAppear:(BOOL)animated {
|
|
59
59
|
[super viewWillAppear:animated];
|
|
60
60
|
// This hack is needed for cases when the initialized state of the tabBar should be hidden
|
|
61
|
-
UINavigationController *
|
|
62
|
-
if ([
|
|
63
|
-
|
|
64
|
-
[
|
|
65
|
-
[
|
|
61
|
+
UINavigationController *selectedChild = self.selectedViewController;
|
|
62
|
+
if ([selectedChild isKindOfClass:UINavigationController.class] &&
|
|
63
|
+
selectedChild.hidesBottomBarWhenPushed) {
|
|
64
|
+
[selectedChild pushViewController:UIViewController.new animated:NO];
|
|
65
|
+
[selectedChild popViewControllerAnimated:NO];
|
|
66
66
|
}
|
|
67
67
|
}
|
|
68
68
|
|
|
@@ -22,10 +22,11 @@
|
|
|
22
22
|
@property(nonatomic, strong) Bool *selectTabOnPress;
|
|
23
23
|
@property(nonatomic, strong) RNNComponentOptions *component;
|
|
24
24
|
@property(nonatomic, strong) RNNIconBackgroundOptions *iconBackground;
|
|
25
|
+
@property(nonatomic, strong) Bool *disableIconTint;
|
|
25
26
|
|
|
26
27
|
- (RNNButtonOptions *)withDefault:(RNNButtonOptions *)defaultOptions;
|
|
27
28
|
|
|
28
|
-
- (
|
|
29
|
+
- (UIColor *)resolveColor;
|
|
29
30
|
|
|
30
31
|
- (RNNButtonOptions *)withDefaultColor:(Color *)color disabledColor:(Color *)disabledColor;
|
|
31
32
|
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
#import "RNNButtonOptions.h"
|
|
2
|
+
#import "NullColor.h"
|
|
2
3
|
|
|
3
4
|
@implementation RNNButtonOptions
|
|
4
5
|
|
|
@@ -23,6 +24,7 @@
|
|
|
23
24
|
self.iconBackground = [[RNNIconBackgroundOptions alloc] initWithDict:dict[@"iconBackground"]
|
|
24
25
|
enabled:self.enabled];
|
|
25
26
|
self.systemItem = [TextParser parse:dict key:@"systemItem"];
|
|
27
|
+
self.disableIconTint = [BoolParser parse:dict key:@"disableIconTint"];
|
|
26
28
|
|
|
27
29
|
return self;
|
|
28
30
|
}
|
|
@@ -46,6 +48,7 @@
|
|
|
46
48
|
newOptions.selectTabOnPress = self.selectTabOnPress.copy;
|
|
47
49
|
newOptions.iconBackground = self.iconBackground.copy;
|
|
48
50
|
newOptions.systemItem = self.systemItem.copy;
|
|
51
|
+
newOptions.disableIconTint = self.disableIconTint.copy;
|
|
49
52
|
return newOptions;
|
|
50
53
|
}
|
|
51
54
|
|
|
@@ -83,6 +86,8 @@
|
|
|
83
86
|
self.selectTabOnPress = options.selectTabOnPress;
|
|
84
87
|
if (options.systemItem.hasValue)
|
|
85
88
|
self.systemItem = options.systemItem;
|
|
89
|
+
if (options.disableIconTint.hasValue)
|
|
90
|
+
self.disableIconTint = options.disableIconTint;
|
|
86
91
|
}
|
|
87
92
|
|
|
88
93
|
- (BOOL)shouldCreateCustomView {
|
|
@@ -93,11 +98,13 @@
|
|
|
93
98
|
return [self.enabled withDefault:YES];
|
|
94
99
|
}
|
|
95
100
|
|
|
96
|
-
- (
|
|
101
|
+
- (UIColor *)resolveColor {
|
|
102
|
+
if ([_disableIconTint withDefault:NO])
|
|
103
|
+
return NullColor.new.get;
|
|
97
104
|
if (![_enabled withDefault:YES] && _disabledColor.hasValue)
|
|
98
|
-
return _disabledColor;
|
|
105
|
+
return _disabledColor.get;
|
|
99
106
|
else
|
|
100
|
-
return _color;
|
|
107
|
+
return [_color withDefault:nil];
|
|
101
108
|
}
|
|
102
109
|
|
|
103
110
|
- (RNNButtonOptions *)withDefault:(RNNButtonOptions *)defaultOptions {
|
|
@@ -139,17 +139,16 @@
|
|
|
139
139
|
[self applyDisabledTitleTextAttributes:buttonOptions];
|
|
140
140
|
}
|
|
141
141
|
|
|
142
|
-
- (void)applyColor:(
|
|
143
|
-
if (color
|
|
142
|
+
- (void)applyColor:(UIColor *)color {
|
|
143
|
+
if (color) {
|
|
144
144
|
NSMutableDictionary *titleTextAttributes = [NSMutableDictionary
|
|
145
145
|
dictionaryWithDictionary:[self titleTextAttributesForState:UIControlStateNormal]];
|
|
146
|
-
[titleTextAttributes setValue:color
|
|
146
|
+
[titleTextAttributes setValue:color forKey:NSForegroundColorAttributeName];
|
|
147
147
|
[self setTitleTextAttributes:titleTextAttributes forState:UIControlStateNormal];
|
|
148
148
|
[self setTitleTextAttributes:titleTextAttributes forState:UIControlStateHighlighted];
|
|
149
|
+
self.tintColor = color;
|
|
149
150
|
} else
|
|
150
151
|
self.image = [self.image imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
|
|
151
|
-
|
|
152
|
-
self.tintColor = color.get;
|
|
153
152
|
}
|
|
154
153
|
|
|
155
154
|
- (void)mergeBackgroundColor:(Color *)color {
|
|
@@ -159,7 +158,7 @@
|
|
|
159
158
|
|
|
160
159
|
- (void)mergeColor:(Color *)color {
|
|
161
160
|
_buttonOptions.color = color;
|
|
162
|
-
[self applyColor:color];
|
|
161
|
+
[self applyColor:color.get];
|
|
163
162
|
[self redrawIcon];
|
|
164
163
|
}
|
|
165
164
|
|