react-native-navigation 7.28.1-snapshot.645 → 7.29.0
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 +2 -1
- package/lib/Mock/Layouts/BottomTabsNode.ts +3 -3
- package/lib/Mock/actions/layoutActions.ts +10 -0
- package/lib/dist/Mock/Components/ComponentScreen.js +2 -1
- package/lib/dist/Mock/Layouts/BottomTabsNode.js +3 -3
- package/lib/dist/Mock/Layouts/LayoutNodeFactory.d.ts +1 -1
- package/lib/dist/Mock/actions/layoutActions.d.ts +2 -0
- package/lib/dist/Mock/actions/layoutActions.js +12 -0
- package/package.json +1 -1
|
@@ -8,6 +8,7 @@ import { connect } from '../connect';
|
|
|
8
8
|
import { TopBar } from './TopBar';
|
|
9
9
|
import { events } from '../Stores/EventsStore';
|
|
10
10
|
import _ from 'lodash';
|
|
11
|
+
import { switchTabByIndex } from '../actions/layoutActions';
|
|
11
12
|
|
|
12
13
|
export const ComponentScreen = connect(
|
|
13
14
|
class extends Component<ComponentProps> {
|
|
@@ -41,7 +42,7 @@ export const ComponentScreen = connect(
|
|
|
41
42
|
tabIndex: i,
|
|
42
43
|
});
|
|
43
44
|
if (_.defaultTo(bottomTabOptions?.selectTabOnPress, true))
|
|
44
|
-
|
|
45
|
+
switchTabByIndex(this.props.layoutNode.getBottomTabs(), i);
|
|
45
46
|
}}
|
|
46
47
|
/>
|
|
47
48
|
<Text>{bottomTabOptions?.badge}</Text>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _ from 'lodash';
|
|
2
2
|
import { Options } from '../../src/index';
|
|
3
|
-
import {
|
|
3
|
+
import { switchTabByIndex } from '../actions/layoutActions';
|
|
4
4
|
import ParentNode from './ParentNode';
|
|
5
5
|
|
|
6
6
|
export default class BottomTabsNode extends ParentNode {
|
|
@@ -13,7 +13,7 @@ export default class BottomTabsNode extends ParentNode {
|
|
|
13
13
|
super.mergeOptions(options);
|
|
14
14
|
if (options.bottomTabs?.currentTabIndex) {
|
|
15
15
|
this.selectedIndex = options.bottomTabs?.currentTabIndex;
|
|
16
|
-
|
|
16
|
+
switchTabByIndex(this, this.selectedIndex);
|
|
17
17
|
}
|
|
18
18
|
if (options.bottomTabs?.currentTabId) {
|
|
19
19
|
const index = _.findIndex(
|
|
@@ -21,7 +21,7 @@ export default class BottomTabsNode extends ParentNode {
|
|
|
21
21
|
(child) => child.nodeId === options?.bottomTabs?.currentTabId
|
|
22
22
|
);
|
|
23
23
|
if (index !== -1) this.selectedIndex = index;
|
|
24
|
-
|
|
24
|
+
switchTabByIndex(this, this.selectedIndex);
|
|
25
25
|
}
|
|
26
26
|
}
|
|
27
27
|
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import ParentNode from '../Layouts/ParentNode';
|
|
2
|
+
import { LayoutStore } from '../Stores/LayoutStore';
|
|
3
|
+
|
|
4
|
+
export const switchTabByIndex = (bottomTabs: ParentNode | undefined, index: number) => {
|
|
5
|
+
if (bottomTabs) {
|
|
6
|
+
LayoutStore.getVisibleLayout().componentDidDisappear();
|
|
7
|
+
LayoutStore.selectTabIndex(bottomTabs, index);
|
|
8
|
+
LayoutStore.getVisibleLayout().componentDidAppear();
|
|
9
|
+
}
|
|
10
|
+
};
|
|
@@ -11,6 +11,7 @@ const connect_1 = require("../connect");
|
|
|
11
11
|
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
|
+
const layoutActions_1 = require("../actions/layoutActions");
|
|
14
15
|
exports.ComponentScreen = (0, connect_1.connect)(class extends react_1.Component {
|
|
15
16
|
constructor(props) {
|
|
16
17
|
super(props);
|
|
@@ -36,7 +37,7 @@ exports.ComponentScreen = (0, connect_1.connect)(class extends react_1.Component
|
|
|
36
37
|
tabIndex: i,
|
|
37
38
|
});
|
|
38
39
|
if (lodash_1.default.defaultTo(bottomTabOptions?.selectTabOnPress, true))
|
|
39
|
-
|
|
40
|
+
(0, layoutActions_1.switchTabByIndex)(this.props.layoutNode.getBottomTabs(), i);
|
|
40
41
|
} }),
|
|
41
42
|
react_1.default.createElement(react_native_1.Text, null, bottomTabOptions?.badge)));
|
|
42
43
|
});
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const tslib_1 = require("tslib");
|
|
4
4
|
const lodash_1 = (0, tslib_1.__importDefault)(require("lodash"));
|
|
5
|
-
const
|
|
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
8
|
selectedIndex = 0;
|
|
@@ -13,13 +13,13 @@ class BottomTabsNode extends ParentNode_1.default {
|
|
|
13
13
|
super.mergeOptions(options);
|
|
14
14
|
if (options.bottomTabs?.currentTabIndex) {
|
|
15
15
|
this.selectedIndex = options.bottomTabs?.currentTabIndex;
|
|
16
|
-
|
|
16
|
+
(0, layoutActions_1.switchTabByIndex)(this, this.selectedIndex);
|
|
17
17
|
}
|
|
18
18
|
if (options.bottomTabs?.currentTabId) {
|
|
19
19
|
const index = lodash_1.default.findIndex(this.children, (child) => child.nodeId === options?.bottomTabs?.currentTabId);
|
|
20
20
|
if (index !== -1)
|
|
21
21
|
this.selectedIndex = index;
|
|
22
|
-
|
|
22
|
+
(0, layoutActions_1.switchTabByIndex)(this, this.selectedIndex);
|
|
23
23
|
}
|
|
24
24
|
}
|
|
25
25
|
getVisibleLayout() {
|
|
@@ -3,5 +3,5 @@ import ComponentNode from './ComponentNode';
|
|
|
3
3
|
import Stack from './StackNode';
|
|
4
4
|
import ParentNode from './ParentNode';
|
|
5
5
|
export default class LayoutNodeFactory {
|
|
6
|
-
static create(layout: any, parentNode?: ParentNode):
|
|
6
|
+
static create(layout: any, parentNode?: ParentNode): Stack | BottomTabs | ComponentNode;
|
|
7
7
|
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.switchTabByIndex = void 0;
|
|
4
|
+
const LayoutStore_1 = require("../Stores/LayoutStore");
|
|
5
|
+
const switchTabByIndex = (bottomTabs, index) => {
|
|
6
|
+
if (bottomTabs) {
|
|
7
|
+
LayoutStore_1.LayoutStore.getVisibleLayout().componentDidDisappear();
|
|
8
|
+
LayoutStore_1.LayoutStore.selectTabIndex(bottomTabs, index);
|
|
9
|
+
LayoutStore_1.LayoutStore.getVisibleLayout().componentDidAppear();
|
|
10
|
+
}
|
|
11
|
+
};
|
|
12
|
+
exports.switchTabByIndex = switchTabByIndex;
|