@cactuslab/native-navigation-react
Advanced tools
Comparing version 0.0.4 to 0.0.5
@@ -14,4 +14,7 @@ import type { AllComponentOptions, ClickEventData, ComponentId, DismissOptions, DismissResult, NativeNavigationPlugin } from '@cactuslab/native-navigation'; | ||
interface CapacitorNativeNavigationContext { | ||
componentId: string; | ||
/** | ||
* The component id. Will be undefined if not in a native context. | ||
*/ | ||
componentId?: string; | ||
/** | ||
* The id of the stack containing this component, if any. | ||
@@ -39,5 +42,4 @@ */ | ||
} | ||
export declare const Context: React.Context<CapacitorNativeNavigationContext | undefined>; | ||
export declare function useNativeNavigationContext(): CapacitorNativeNavigationContext | undefined; | ||
export declare function useNativeNavigationContext(defaultValue: Partial<CapacitorNativeNavigationContext>): Partial<CapacitorNativeNavigationContext>; | ||
export declare const Context: React.Context<CapacitorNativeNavigationContext>; | ||
export declare function useNativeNavigationContext(): CapacitorNativeNavigationContext; | ||
export {}; |
@@ -37,15 +37,20 @@ import React, { useContext } from 'react'; | ||
} | ||
export const Context = React.createContext(undefined); | ||
export function useNativeNavigationContext(defaultValue) { | ||
const context = useContext(Context); | ||
if (context) { | ||
return context; | ||
const DEFAULT_CONTEXT = { | ||
viewWindow: window, | ||
setOptions: async function () { | ||
return; | ||
}, | ||
dismiss: async function () { | ||
throw new Error('Not in a native context'); | ||
}, | ||
addClickListener: function () { | ||
return function () { | ||
/* noop */ | ||
}; | ||
} | ||
else if (defaultValue) { | ||
return defaultValue; | ||
} | ||
else { | ||
return undefined; | ||
} | ||
}; | ||
export const Context = React.createContext(DEFAULT_CONTEXT); | ||
export function useNativeNavigationContext() { | ||
return useContext(Context); | ||
} | ||
//# sourceMappingURL=context.js.map |
@@ -49,14 +49,19 @@ 'use strict'; | ||
} | ||
const Context = React__default["default"].createContext(undefined); | ||
function useNativeNavigationContext(defaultValue) { | ||
const context = React.useContext(Context); | ||
if (context) { | ||
return context; | ||
const DEFAULT_CONTEXT = { | ||
viewWindow: window, | ||
setOptions: async function () { | ||
return; | ||
}, | ||
dismiss: async function () { | ||
throw new Error('Not in a native context'); | ||
}, | ||
addClickListener: function () { | ||
return function () { | ||
/* noop */ | ||
}; | ||
} | ||
else if (defaultValue) { | ||
return defaultValue; | ||
} | ||
else { | ||
return undefined; | ||
} | ||
}; | ||
const Context = React__default["default"].createContext(DEFAULT_CONTEXT); | ||
function useNativeNavigationContext() { | ||
return React.useContext(Context); | ||
} | ||
@@ -63,0 +68,0 @@ |
@@ -44,14 +44,19 @@ var CapacitorNativeNavigationReact = (function (exports, nativeNavigation, React, ReactDOM) { | ||
} | ||
const Context = React__default["default"].createContext(undefined); | ||
function useNativeNavigationContext(defaultValue) { | ||
const context = React.useContext(Context); | ||
if (context) { | ||
return context; | ||
const DEFAULT_CONTEXT = { | ||
viewWindow: window, | ||
setOptions: async function () { | ||
return; | ||
}, | ||
dismiss: async function () { | ||
throw new Error('Not in a native context'); | ||
}, | ||
addClickListener: function () { | ||
return function () { | ||
/* noop */ | ||
}; | ||
} | ||
else if (defaultValue) { | ||
return defaultValue; | ||
} | ||
else { | ||
return undefined; | ||
} | ||
}; | ||
const Context = React__default["default"].createContext(DEFAULT_CONTEXT); | ||
function useNativeNavigationContext() { | ||
return React.useContext(Context); | ||
} | ||
@@ -58,0 +63,0 @@ |
{ | ||
"name": "@cactuslab/native-navigation-react", | ||
"version": "0.0.4", | ||
"version": "0.0.5", | ||
"description": "React support for Native navigation for Capacitor apps", | ||
@@ -30,3 +30,3 @@ "main": "dist/plugin.cjs.js", | ||
"devDependencies": { | ||
"@cactuslab/native-navigation": "^0.0.3", | ||
"@cactuslab/native-navigation": "^0.0.4", | ||
"@capacitor/core": "^4.0.0", | ||
@@ -44,3 +44,3 @@ "@ionic/eslint-config": "^0.3.0", | ||
"peerDependencies": { | ||
"@cactuslab/native-navigation": "^0.0.3", | ||
"@cactuslab/native-navigation": "^0.0.4", | ||
"@capacitor/core": "^4.0.0", | ||
@@ -47,0 +47,0 @@ "react": "^18.2.0", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
100428
935