@rdyl/react-native-navigator-connect 0.2.0 → 0.2.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/dist/context.js +5 -0
- package/dist/hooks.js +2 -2
- package/dist/index.js +2 -3
- package/package.json +1 -1
- package/types/context.d.ts +5 -0
- package/types/index.d.ts +1 -5
package/dist/context.js
ADDED
package/dist/hooks.js
CHANGED
|
@@ -3,9 +3,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.useNavigator = void 0;
|
|
4
4
|
const native_1 = require("@react-navigation/native");
|
|
5
5
|
const react_1 = require("react");
|
|
6
|
-
const
|
|
6
|
+
const context_1 = require("./context");
|
|
7
7
|
const useNavigator = () => {
|
|
8
|
-
const { findOption } = (0, react_1.useContext)(
|
|
8
|
+
const { findOption } = (0, react_1.useContext)(context_1.NavContext);
|
|
9
9
|
const navigation = (0, native_1.useNavigation)();
|
|
10
10
|
const route = (0, native_1.useRoute)();
|
|
11
11
|
const option = (0, react_1.useMemo)(() => {
|
package/dist/index.js
CHANGED
|
@@ -36,12 +36,11 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
36
36
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
37
37
|
};
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
-
exports.NavContext = void 0;
|
|
40
39
|
const react_1 = __importStar(require("react"));
|
|
41
40
|
const native_1 = require("@react-navigation/native");
|
|
42
41
|
const stack_1 = require("@react-navigation/stack");
|
|
43
42
|
const bottom_tabs_1 = require("@react-navigation/bottom-tabs");
|
|
44
|
-
|
|
43
|
+
const context_1 = require("./context");
|
|
45
44
|
const Tab = (0, bottom_tabs_1.createBottomTabNavigator)();
|
|
46
45
|
const Stack = (0, stack_1.createStackNavigator)();
|
|
47
46
|
const NavigatorConnect = ({ afterEach, stack = [], initial, tabs, }) => {
|
|
@@ -83,7 +82,7 @@ const NavigatorConnect = ({ afterEach, stack = [], initial, tabs, }) => {
|
|
|
83
82
|
navigatorRef.addListener("__unsafe_action__", callback);
|
|
84
83
|
return () => navigatorRef.removeListener("__unsafe_action__", callback);
|
|
85
84
|
}, [navigatorRef.isReady]);
|
|
86
|
-
return (react_1.default.createElement(
|
|
85
|
+
return (react_1.default.createElement(context_1.NavContext.Provider, { value: {
|
|
87
86
|
findOption,
|
|
88
87
|
} },
|
|
89
88
|
react_1.default.createElement(native_1.NavigationContainer, { ref: navigatorRef },
|
package/package.json
CHANGED
package/types/index.d.ts
CHANGED
|
@@ -1,9 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
export declare const NavContext: React.Context<NavContextValue>;
|
|
1
|
+
import { FC } from "react";
|
|
3
2
|
declare const NavigatorConnect: FC<NavigatorConnectProps>;
|
|
4
|
-
interface NavContextValue {
|
|
5
|
-
findOption(n: string): FindNavigatorOptionType;
|
|
6
|
-
}
|
|
7
3
|
export interface NavigatorConnectProps extends NavigatorConnectConfig {
|
|
8
4
|
afterEach?(to: NavigatorOption): void;
|
|
9
5
|
}
|