Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@cactuslab/native-navigation-react

Package Overview
Dependencies
Maintainers
3
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@cactuslab/native-navigation-react - npm Package Compare versions

Comparing version 0.0.7 to 0.0.8

1

dist/esm/context.d.ts

@@ -30,2 +30,3 @@ import type { AllComponentOptions, ClickEventData, ComponentId, DismissOptions, DismissResult, NativeNavigationPlugin } from '@cactuslab/native-navigation';

setOptions: (options: AllComponentOptions & {
id?: string;
animated?: boolean;

@@ -32,0 +33,0 @@ }) => Promise<void>;

6

dist/esm/context.js

@@ -10,3 +10,3 @@ import React, { useContext } from 'react';

return plugin.setOptions({
id,
id: options.id || id,
animated: options.animated,

@@ -24,3 +24,3 @@ options,

}).catch(reason => {
console.warn(`Failed to add listener for ${id}: ${reason}`);
console.warn(`NativeNavigation: Failed to add click listener for ${id}, this may cause some navigation buttons to fail: ${reason}`);
});

@@ -32,3 +32,3 @@ return function () {

else {
console.warn(`Failed to remove listener for ${id}. This may cause a memory leak.`);
console.warn(`NativeNavigation: Failed to remove listener for ${id}. This may cause a memory leak.`);
}

@@ -35,0 +35,0 @@ };

@@ -13,3 +13,11 @@ import type { NativeNavigationPlugin } from '@cactuslab/native-navigation';

viewRootId?: string;
/**
* An optional error handler to receive unexpected errors from the NativeNavigation plugin
*/
errorHandler?: (source: string, error: unknown) => void;
}
/**
* An error handler implementation that presents an alert with details of the error.
*/
export declare function alertErrorHandler(source: string, error: unknown): void;
export declare function initReact(options: Options): Promise<void>;

@@ -8,2 +8,8 @@ import { initViewHandler } from '@cactuslab/native-navigation';

export { useNativeNavigationContext } from './context';
/**
* An error handler implementation that presents an alert with details of the error.
*/
export function alertErrorHandler(source, error) {
alert(`Native navigation integration failed (${source}): ${error instanceof Error ? error.message : error}`);
}
export async function initReact(options) {

@@ -25,2 +31,12 @@ const { plugin, root } = options;

});
function reportError(source, error) {
var _a;
if (error instanceof Error) {
console.error(`NativeNavigation React: ${source}`, error);
}
else {
console.warn(`NativeNavigation React (${source}): ${error}`);
}
(_a = options.errorHandler) === null || _a === void 0 ? void 0 : _a.call(options, source, error);
}
function createView(viewWindow, data) {

@@ -37,3 +53,3 @@ const { path, id } = data;

else {
console.warn(`Attempted to load view "${path}" but could not find root node: #${viewRootId}`);
reportError('createView', `Attempted to load view "${path}" but could not find root node: #${viewRootId}`);
}

@@ -45,3 +61,3 @@ }

if (!reactRoot) {
console.warn(`Attempted to update a React root that doesn't exist: ${id}`);
reportError('updateView', `Attempted to update a React root that doesn't exist: ${id}`);
return;

@@ -62,5 +78,10 @@ }

setTimeout(function () {
internalPlugin.viewReady({
id,
});
try {
internalPlugin.viewReady({
id,
});
}
catch (error) {
reportError('viewReady', error);
}
}, 20);

@@ -67,0 +88,0 @@ }

@@ -22,3 +22,3 @@ 'use strict';

return plugin.setOptions({
id,
id: options.id || id,
animated: options.animated,

@@ -36,3 +36,3 @@ options,

}).catch(reason => {
console.warn(`Failed to add listener for ${id}: ${reason}`);
console.warn(`NativeNavigation: Failed to add click listener for ${id}, this may cause some navigation buttons to fail: ${reason}`);
});

@@ -44,3 +44,3 @@ return function () {

else {
console.warn(`Failed to remove listener for ${id}. This may cause a memory leak.`);
console.warn(`NativeNavigation: Failed to remove listener for ${id}. This may cause a memory leak.`);
}

@@ -230,2 +230,8 @@ };

/**
* An error handler implementation that presents an alert with details of the error.
*/
function alertErrorHandler(source, error) {
alert(`Native navigation integration failed (${source}): ${error instanceof Error ? error.message : error}`);
}
async function initReact(options) {

@@ -247,2 +253,12 @@ const { plugin, root } = options;

});
function reportError(source, error) {
var _a;
if (error instanceof Error) {
console.error(`NativeNavigation React: ${source}`, error);
}
else {
console.warn(`NativeNavigation React (${source}): ${error}`);
}
(_a = options.errorHandler) === null || _a === void 0 ? void 0 : _a.call(options, source, error);
}
function createView(viewWindow, data) {

@@ -259,3 +275,3 @@ const { path, id } = data;

else {
console.warn(`Attempted to load view "${path}" but could not find root node: #${viewRootId}`);
reportError('createView', `Attempted to load view "${path}" but could not find root node: #${viewRootId}`);
}

@@ -267,3 +283,3 @@ }

if (!reactRoot) {
console.warn(`Attempted to update a React root that doesn't exist: ${id}`);
reportError('updateView', `Attempted to update a React root that doesn't exist: ${id}`);
return;

@@ -284,5 +300,10 @@ }

setTimeout(function () {
internalPlugin.viewReady({
id,
});
try {
internalPlugin.viewReady({
id,
});
}
catch (error) {
reportError('viewReady', error);
}
}, 20);

@@ -303,4 +324,5 @@ }

exports.alertErrorHandler = alertErrorHandler;
exports.initReact = initReact;
exports.useNativeNavigationContext = useNativeNavigationContext;
//# sourceMappingURL=index.cjs.js.map

@@ -17,3 +17,3 @@ var CapacitorNativeNavigationReact = (function (exports, nativeNavigation, React, ReactDOM) {

return plugin.setOptions({
id,
id: options.id || id,
animated: options.animated,

@@ -31,3 +31,3 @@ options,

}).catch(reason => {
console.warn(`Failed to add listener for ${id}: ${reason}`);
console.warn(`NativeNavigation: Failed to add click listener for ${id}, this may cause some navigation buttons to fail: ${reason}`);
});

@@ -39,3 +39,3 @@ return function () {

else {
console.warn(`Failed to remove listener for ${id}. This may cause a memory leak.`);
console.warn(`NativeNavigation: Failed to remove listener for ${id}. This may cause a memory leak.`);
}

@@ -225,2 +225,8 @@ };

/**
* An error handler implementation that presents an alert with details of the error.
*/
function alertErrorHandler(source, error) {
alert(`Native navigation integration failed (${source}): ${error instanceof Error ? error.message : error}`);
}
async function initReact(options) {

@@ -242,2 +248,12 @@ const { plugin, root } = options;

});
function reportError(source, error) {
var _a;
if (error instanceof Error) {
console.error(`NativeNavigation React: ${source}`, error);
}
else {
console.warn(`NativeNavigation React (${source}): ${error}`);
}
(_a = options.errorHandler) === null || _a === void 0 ? void 0 : _a.call(options, source, error);
}
function createView(viewWindow, data) {

@@ -254,3 +270,3 @@ const { path, id } = data;

else {
console.warn(`Attempted to load view "${path}" but could not find root node: #${viewRootId}`);
reportError('createView', `Attempted to load view "${path}" but could not find root node: #${viewRootId}`);
}

@@ -262,3 +278,3 @@ }

if (!reactRoot) {
console.warn(`Attempted to update a React root that doesn't exist: ${id}`);
reportError('updateView', `Attempted to update a React root that doesn't exist: ${id}`);
return;

@@ -279,5 +295,10 @@ }

setTimeout(function () {
internalPlugin.viewReady({
id,
});
try {
internalPlugin.viewReady({
id,
});
}
catch (error) {
reportError('viewReady', error);
}
}, 20);

@@ -298,2 +319,3 @@ }

exports.alertErrorHandler = alertErrorHandler;
exports.initReact = initReact;

@@ -300,0 +322,0 @@ exports.useNativeNavigationContext = useNativeNavigationContext;

{
"name": "@cactuslab/native-navigation-react",
"version": "0.0.7",
"version": "0.0.8",
"description": "React support for Native navigation for Capacitor apps",

@@ -30,3 +30,3 @@ "main": "dist/plugin.cjs.js",

"devDependencies": {
"@cactuslab/native-navigation": "^0.0.6",
"@cactuslab/native-navigation": "^0.0.7",
"@capacitor/core": "^4.0.0",

@@ -44,3 +44,3 @@ "@ionic/eslint-config": "^0.3.0",

"peerDependencies": {
"@cactuslab/native-navigation": "^0.0.6",
"@cactuslab/native-navigation": "^0.0.7",
"@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

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc