Socket
Socket
Sign inDemoInstall

@react-navigation/native

Package Overview
Dependencies
498
Maintainers
6
Versions
230
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 6.1.7 to 6.1.8

lib/commonjs/useBackButton.native.js

3

lib/commonjs/extractPathFromURL.js

@@ -17,3 +17,4 @@ "use strict";

const prefixRegex = new RegExp(`^${(0, _escapeStringRegexp.default)(protocol)}(/)*${host.split('.').map(it => it === '*' ? '[^/]+' : (0, _escapeStringRegexp.default)(it)).join('\\.')}`);
const normalizedURL = url.replace(/\/+/g, '/');
const [originAndPath, searchParams] = url.split('?');
const normalizedURL = originAndPath.replace(/\/+/g, '/').concat(searchParams ? `?${searchParams}` : '');
if (prefixRegex.test(normalizedURL)) {

@@ -20,0 +21,0 @@ return normalizedURL.replace(prefixRegex, '');

@@ -7,22 +7,6 @@ "use strict";

exports.default = useBackButton;
var React = _interopRequireWildcard(require("react"));
var _reactNative = require("react-native");
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
function useBackButton(ref) {
React.useEffect(() => {
const subscription = _reactNative.BackHandler.addEventListener('hardwareBackPress', () => {
const navigation = ref.current;
if (navigation == null) {
return false;
}
if (navigation.canGoBack()) {
navigation.goBack();
return true;
}
return false;
});
return () => subscription.remove();
}, [ref]);
function useBackButton(_) {
// No-op
// BackHandler is not available on web
}
//# sourceMappingURL=useBackButton.js.map

@@ -7,2 +7,3 @@ "use strict";

exports.default = useLinking;
exports.series = void 0;
var _core = require("@react-navigation/core");

@@ -48,26 +49,9 @@ var _fastDeepEqual = _interopRequireDefault(require("fast-deep-equal"));

const series = cb => {
// Whether we're currently handling a callback
let handling = false;
let queue = [];
const callback = async () => {
try {
if (handling) {
// If we're currently handling a previous event, wait before handling this one
// Add the callback to the beginning of the queue
queue.unshift(callback);
return;
}
handling = true;
await cb();
} finally {
handling = false;
if (queue.length) {
// If we have queued items, handle the last one
const last = queue.pop();
last === null || last === void 0 ? void 0 : last();
}
}
let queue = Promise.resolve();
const callback = () => {
queue = queue.then(cb);
};
return callback;
};
exports.series = series;
let linkingHandlers = [];

@@ -74,0 +58,0 @@ function useLinking(ref, _ref) {

@@ -10,3 +10,4 @@ import escapeStringRegexp from 'escape-string-regexp';

const prefixRegex = new RegExp(`^${escapeStringRegexp(protocol)}(/)*${host.split('.').map(it => it === '*' ? '[^/]+' : escapeStringRegexp(it)).join('\\.')}`);
const normalizedURL = url.replace(/\/+/g, '/');
const [originAndPath, searchParams] = url.split('?');
const normalizedURL = originAndPath.replace(/\/+/g, '/').concat(searchParams ? `?${searchParams}` : '');
if (prefixRegex.test(normalizedURL)) {

@@ -13,0 +14,0 @@ return normalizedURL.replace(prefixRegex, '');

@@ -1,19 +0,5 @@

import * as React from 'react';
import { BackHandler } from 'react-native';
export default function useBackButton(ref) {
React.useEffect(() => {
const subscription = BackHandler.addEventListener('hardwareBackPress', () => {
const navigation = ref.current;
if (navigation == null) {
return false;
}
if (navigation.canGoBack()) {
navigation.goBack();
return true;
}
return false;
});
return () => subscription.remove();
}, [ref]);
export default function useBackButton(_) {
// No-op
// BackHandler is not available on web
}
//# sourceMappingURL=useBackButton.js.map

@@ -37,24 +37,6 @@ import { findFocusedRoute, getActionFromState as getActionFromStateDefault, getPathFromState as getPathFromStateDefault, getStateFromPath as getStateFromPathDefault } from '@react-navigation/core';

*/
const series = cb => {
// Whether we're currently handling a callback
let handling = false;
let queue = [];
const callback = async () => {
try {
if (handling) {
// If we're currently handling a previous event, wait before handling this one
// Add the callback to the beginning of the queue
queue.unshift(callback);
return;
}
handling = true;
await cb();
} finally {
handling = false;
if (queue.length) {
// If we have queued items, handle the last one
const last = queue.pop();
last === null || last === void 0 ? void 0 : last();
}
}
export const series = cb => {
let queue = Promise.resolve();
const callback = () => {
queue = queue.then(cb);
};

@@ -61,0 +43,0 @@ return callback;

@@ -0,4 +1,4 @@

/// <reference types="react" />
import type { NavigationContainerRef, ParamListBase } from '@react-navigation/core';
import * as React from 'react';
export default function useBackButton(ref: React.RefObject<NavigationContainerRef<ParamListBase>>): void;
export default function useBackButton(_: React.RefObject<NavigationContainerRef<ParamListBase>>): void;
//# sourceMappingURL=useBackButton.d.ts.map
import { NavigationContainerRef, ParamListBase } from '@react-navigation/core';
import * as React from 'react';
import type { LinkingOptions } from './types';
/**
* Run async function in series as it's called.
*/
export declare const series: (cb: () => Promise<void>) => () => void;
type Options = LinkingOptions<ParamListBase> & {

@@ -5,0 +9,0 @@ independent?: boolean;

{
"name": "@react-navigation/native",
"description": "React Native integration for React Navigation",
"version": "6.1.7",
"version": "6.1.8",
"keywords": [

@@ -75,3 +75,3 @@ "react-native",

},
"gitHead": "cf836cb84932638369f7bf59534d5a3ccea9b4f6"
"gitHead": "46954cec3d746aa2d9097d1b94f9e2a915d3e1c7"
}

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

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

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc