react-native-navigation 7.37.0 → 7.37.1-hotfix.1
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/lib/Mock/Components/ComponentScreen.tsx +25 -9
- package/lib/android/app/src/main/java/com/reactnativenavigation/react/NavigationModule.java +3 -1
- package/lib/android/app/src/main/java/com/reactnativenavigation/utils/UiUtils.java +2 -2
- package/lib/dist/Mock/Components/ComponentScreen.js +14 -6
- package/lib/ios/RNNSplashScreen.m +2 -0
- package/lib/ios/RNNUIBarButtonItem.m +21 -2
- package/package.json +1 -1
- package/react-native.config.js +0 -4
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { Component } from 'react';
|
|
2
|
-
import {
|
|
3
|
-
import { Navigation } from 'react-native-navigation';
|
|
2
|
+
import { View, Text, TouchableOpacity, Image, ImageURISource} from 'react-native';
|
|
3
|
+
import { Navigation, ImageResource} from 'react-native-navigation';
|
|
4
4
|
import { ComponentProps } from '../ComponentProps';
|
|
5
5
|
import { VISIBLE_SCREEN_TEST_ID } from '../constants';
|
|
6
6
|
import { LayoutStore } from '../Stores/LayoutStore';
|
|
@@ -10,6 +10,11 @@ import { events } from '../Stores/EventsStore';
|
|
|
10
10
|
import _ from 'lodash';
|
|
11
11
|
import { switchTabByIndex } from '../actions/layoutActions';
|
|
12
12
|
|
|
13
|
+
|
|
14
|
+
function isURISource(src: ImageResource| undefined): src is ImageURISource {
|
|
15
|
+
return !!src && typeof src === 'object' && 'uri' in src;
|
|
16
|
+
}
|
|
17
|
+
|
|
13
18
|
export const ComponentScreen = connect(
|
|
14
19
|
class extends Component<ComponentProps> {
|
|
15
20
|
constructor(props: ComponentProps) {
|
|
@@ -27,16 +32,17 @@ export const ComponentScreen = connect(
|
|
|
27
32
|
renderTabBar() {
|
|
28
33
|
const bottomTabs = this.props.layoutNode.getBottomTabs();
|
|
29
34
|
if (!bottomTabs) return null;
|
|
30
|
-
|
|
31
35
|
const bottomTabsOptions = bottomTabs.resolveOptions().bottomTabs;
|
|
32
36
|
if (bottomTabsOptions?.visible === false) return null;
|
|
33
37
|
const buttons = bottomTabs!.children!.map((child, i) => {
|
|
34
38
|
const bottomTabOptions = child.resolveOptions().bottomTab;
|
|
39
|
+
const icon = (bottomTabs as any).selectedIndex === i ? bottomTabOptions?.selectedIcon : bottomTabOptions?.icon;
|
|
40
|
+
const iconURI = isURISource(icon) ? icon.uri : undefined;
|
|
35
41
|
return (
|
|
36
42
|
<View key={`tab-${i}`}>
|
|
37
|
-
<
|
|
43
|
+
<TouchableOpacity
|
|
44
|
+
style={{padding:10}}
|
|
38
45
|
testID={bottomTabOptions?.testID}
|
|
39
|
-
title={bottomTabOptions?.text || ''}
|
|
40
46
|
onPress={() => {
|
|
41
47
|
events.invokeBottomTabPressed({
|
|
42
48
|
tabIndex: i,
|
|
@@ -44,13 +50,23 @@ export const ComponentScreen = connect(
|
|
|
44
50
|
if (_.defaultTo(bottomTabOptions?.selectTabOnPress, true))
|
|
45
51
|
switchTabByIndex(this.props.layoutNode.getBottomTabs(), i);
|
|
46
52
|
}}
|
|
47
|
-
|
|
48
|
-
<
|
|
53
|
+
>
|
|
54
|
+
<View style={{justifyContent: 'center', alignItems: 'center'}}>
|
|
55
|
+
<Text>{bottomTabOptions?.badge}</Text>
|
|
56
|
+
{iconURI && <Image style={{width: 18, height: 18, marginBottom: 5}} source={{uri: iconURI}}/>}
|
|
57
|
+
<Text style={{fontSize: 12}}>{bottomTabOptions?.text || ''}</Text>
|
|
58
|
+
</View>
|
|
59
|
+
</TouchableOpacity>
|
|
49
60
|
</View>
|
|
50
61
|
);
|
|
51
62
|
});
|
|
52
63
|
|
|
53
|
-
return
|
|
64
|
+
return (
|
|
65
|
+
<View
|
|
66
|
+
testID={bottomTabsOptions?.testID}
|
|
67
|
+
style={{flexDirection: 'row',justifyContent: 'center', width: '100%', backgroundColor: '#F0F2F5'}}>
|
|
68
|
+
{buttons}
|
|
69
|
+
</View>);
|
|
54
70
|
}
|
|
55
71
|
|
|
56
72
|
render() {
|
|
@@ -67,8 +83,8 @@ export const ComponentScreen = connect(
|
|
|
67
83
|
backButtonOptions={this.props.layoutNode.resolveOptions().topBar?.backButton}
|
|
68
84
|
/>
|
|
69
85
|
)}
|
|
70
|
-
{this.renderTabBar()}
|
|
71
86
|
<Component componentId={this.props.layoutNode.nodeId} />
|
|
87
|
+
{this.renderTabBar()}
|
|
72
88
|
</View>
|
|
73
89
|
);
|
|
74
90
|
}
|
|
@@ -59,7 +59,9 @@ public class NavigationModule extends ReactContextBaseJavaModule {
|
|
|
59
59
|
@Override
|
|
60
60
|
public void onHostPause() {
|
|
61
61
|
super.onHostPause();
|
|
62
|
-
UiUtils.runOnMainThread(() ->
|
|
62
|
+
UiUtils.runOnMainThread(() -> {
|
|
63
|
+
if (navigator() != null) navigator().onHostPause();
|
|
64
|
+
});
|
|
63
65
|
}
|
|
64
66
|
|
|
65
67
|
@Override
|
|
@@ -82,9 +82,9 @@ public class UiUtils {
|
|
|
82
82
|
|
|
83
83
|
public static void runOnMainThread(Runnable runnable) {
|
|
84
84
|
if (Looper.myLooper() == Looper.getMainLooper()) {
|
|
85
|
-
|
|
85
|
+
runnable.run();
|
|
86
86
|
} else {
|
|
87
|
-
new Handler(Looper.getMainLooper()).
|
|
87
|
+
new Handler(Looper.getMainLooper()).postAtFrontOfQueue(runnable);
|
|
88
88
|
}
|
|
89
89
|
}
|
|
90
90
|
|
|
@@ -12,6 +12,9 @@ const TopBar_1 = require("./TopBar");
|
|
|
12
12
|
const EventsStore_1 = require("../Stores/EventsStore");
|
|
13
13
|
const lodash_1 = (0, tslib_1.__importDefault)(require("lodash"));
|
|
14
14
|
const layoutActions_1 = require("../actions/layoutActions");
|
|
15
|
+
function isURISource(src) {
|
|
16
|
+
return !!src && typeof src === 'object' && 'uri' in src;
|
|
17
|
+
}
|
|
15
18
|
exports.ComponentScreen = (0, connect_1.connect)(class extends react_1.Component {
|
|
16
19
|
constructor(props) {
|
|
17
20
|
super(props);
|
|
@@ -31,17 +34,22 @@ exports.ComponentScreen = (0, connect_1.connect)(class extends react_1.Component
|
|
|
31
34
|
return null;
|
|
32
35
|
const buttons = bottomTabs.children.map((child, i) => {
|
|
33
36
|
const bottomTabOptions = child.resolveOptions().bottomTab;
|
|
37
|
+
const icon = bottomTabs.selectedIndex === i ? bottomTabOptions?.selectedIcon : bottomTabOptions?.icon;
|
|
38
|
+
const iconURI = isURISource(icon) ? icon.uri : undefined;
|
|
34
39
|
return (react_1.default.createElement(react_native_1.View, { key: `tab-${i}` },
|
|
35
|
-
react_1.default.createElement(react_native_1.
|
|
40
|
+
react_1.default.createElement(react_native_1.TouchableOpacity, { style: { padding: 10 }, testID: bottomTabOptions?.testID, onPress: () => {
|
|
36
41
|
EventsStore_1.events.invokeBottomTabPressed({
|
|
37
42
|
tabIndex: i,
|
|
38
43
|
});
|
|
39
44
|
if (lodash_1.default.defaultTo(bottomTabOptions?.selectTabOnPress, true))
|
|
40
45
|
(0, layoutActions_1.switchTabByIndex)(this.props.layoutNode.getBottomTabs(), i);
|
|
41
|
-
} }
|
|
42
|
-
|
|
46
|
+
} },
|
|
47
|
+
react_1.default.createElement(react_native_1.View, { style: { justifyContent: 'center', alignItems: 'center' } },
|
|
48
|
+
react_1.default.createElement(react_native_1.Text, null, bottomTabOptions?.badge),
|
|
49
|
+
iconURI && react_1.default.createElement(react_native_1.Image, { style: { width: 18, height: 18, marginBottom: 5 }, source: { uri: iconURI } }),
|
|
50
|
+
react_1.default.createElement(react_native_1.Text, { style: { fontSize: 12 } }, bottomTabOptions?.text || '')))));
|
|
43
51
|
});
|
|
44
|
-
return react_1.default.createElement(react_native_1.View, { testID: bottomTabsOptions?.testID }, buttons);
|
|
52
|
+
return (react_1.default.createElement(react_native_1.View, { testID: bottomTabsOptions?.testID, style: { flexDirection: 'row', justifyContent: 'center', width: '100%', backgroundColor: '#F0F2F5' } }, buttons));
|
|
45
53
|
}
|
|
46
54
|
render() {
|
|
47
55
|
const Component = react_native_navigation_1.Navigation.mock.store.getWrappedComponent(this.props.layoutNode.data.name);
|
|
@@ -49,7 +57,7 @@ exports.ComponentScreen = (0, connect_1.connect)(class extends react_1.Component
|
|
|
49
57
|
throw new Error(`${this.props.layoutNode.data.name} has not been registered.`);
|
|
50
58
|
return (react_1.default.createElement(react_native_1.View, { testID: this.isVisible() ? constants_1.VISIBLE_SCREEN_TEST_ID : undefined },
|
|
51
59
|
this.props.layoutNode.getStack() && (react_1.default.createElement(TopBar_1.TopBar, { layoutNode: this.props.layoutNode, topBarOptions: this.props.layoutNode.resolveOptions().topBar, backButtonOptions: this.props.layoutNode.resolveOptions().topBar?.backButton })),
|
|
52
|
-
this.
|
|
53
|
-
|
|
60
|
+
react_1.default.createElement(Component, { componentId: this.props.layoutNode.nodeId }),
|
|
61
|
+
this.renderTabBar()));
|
|
54
62
|
}
|
|
55
63
|
});
|
|
@@ -14,6 +14,8 @@
|
|
|
14
14
|
if (launchStoryBoard != nil) { // load the splash from the storyboard that's defined in the
|
|
15
15
|
// info.plist as the LaunchScreen
|
|
16
16
|
@try {
|
|
17
|
+
// Remove .storyboard extension
|
|
18
|
+
launchStoryBoard = [launchStoryBoard stringByDeletingPathExtension];
|
|
17
19
|
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:launchStoryBoard
|
|
18
20
|
bundle:nil];
|
|
19
21
|
UIViewController *launchVC = [storyboard instantiateInitialViewController];
|
|
@@ -87,9 +87,28 @@
|
|
|
87
87
|
buttonOptions:(RNNButtonOptions *)buttonOptions
|
|
88
88
|
onPress:(RNNButtonPressCallback)onPress {
|
|
89
89
|
self = [super initWithCustomView:reactView];
|
|
90
|
-
[reactView setFrame:CGRectMake(0, 0, 50, 50)];
|
|
91
90
|
[self applyOptions:buttonOptions];
|
|
92
|
-
|
|
91
|
+
reactView.sizeFlexibility = RCTRootViewSizeFlexibilityWidthAndHeight;
|
|
92
|
+
reactView.hidden = CGRectEqualToRect(reactView.frame, CGRectZero);
|
|
93
|
+
|
|
94
|
+
[NSLayoutConstraint deactivateConstraints:reactView.constraints];
|
|
95
|
+
self.widthConstraint =
|
|
96
|
+
[NSLayoutConstraint constraintWithItem:reactView
|
|
97
|
+
attribute:NSLayoutAttributeWidth
|
|
98
|
+
relatedBy:NSLayoutRelationEqual
|
|
99
|
+
toItem:nil
|
|
100
|
+
attribute:NSLayoutAttributeNotAnAttribute
|
|
101
|
+
multiplier:1.0
|
|
102
|
+
constant:reactView.intrinsicContentSize.width];
|
|
103
|
+
self.heightConstraint =
|
|
104
|
+
[NSLayoutConstraint constraintWithItem:reactView
|
|
105
|
+
attribute:NSLayoutAttributeHeight
|
|
106
|
+
relatedBy:NSLayoutRelationEqual
|
|
107
|
+
toItem:nil
|
|
108
|
+
attribute:NSLayoutAttributeNotAnAttribute
|
|
109
|
+
multiplier:1.0
|
|
110
|
+
constant:reactView.intrinsicContentSize.height];
|
|
111
|
+
[NSLayoutConstraint activateConstraints:@[ self.widthConstraint, self.heightConstraint ]];
|
|
93
112
|
reactView.delegate = self;
|
|
94
113
|
|
|
95
114
|
reactView.backgroundColor = [UIColor clearColor];
|
package/package.json
CHANGED
package/react-native.config.js
CHANGED