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

react-native-popup-menu

Package Overview
Dependencies
Maintainers
1
Versions
63
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-native-popup-menu - npm Package Compare versions

Comparing version 0.8.0 to 0.8.1

9

package.json
{
"name": "react-native-popup-menu",
"version": "0.8.0",
"version": "0.8.1",
"description": "extensible popup/context menu for react native",

@@ -28,3 +28,6 @@ "main": "src/index.js",

"testRegex": ".*-test.js",
"testPathIgnorePatterns": ["/node_modules/", "<rootDir>/examples/"],
"testPathIgnorePatterns": [
"/node_modules/",
"<rootDir>/examples/"
],
"moduleFileExtensions": [

@@ -59,6 +62,6 @@ "js"

"react": "^15.5.4",
"react-addons-test-utils": "^15.5.1",
"react-dom": "^15.5.4",
"react-test-renderer": "^15.6.1",
"sinon": "^2.2.0"
}
}
# react-native-popup-menu
[![](https://img.shields.io/npm/dm/react-native-popup-menu.svg?style=flat-square)](https://www.npmjs.com/package/react-native-popup-menu)

@@ -9,2 +10,3 @@ Extensible popup menu component for React Native for Android, iOS and (unofficially) UWP.

* By default opening and closing animations
* Optional back button handling
* Easy styling

@@ -11,0 +13,0 @@ * Customizable on various levels - menu options, positioning, animations

import React, { Component } from 'react';
import PropTypes from 'prop-types';
import { View } from 'react-native';
import { View, BackHandler } from 'react-native';
import makeMenuRegistry from './menuRegistry';

@@ -37,2 +37,39 @@ import Backdrop from './Backdrop';

_handleBackButton = () => {
const { backHandler } = this.props;
debug('_handleBackButton called', backHandler);
// Default handler if true is passed
if (backHandler === true) {
if (this.isMenuOpen()) {
this.closeMenu();
return true;
}
}
// Custom handler called with MenuContext instance id function is passed
if (typeof backHandler === 'function') {
return backHandler(this);
}
return false;
}
componentDidMount() {
if (BackHandler) {
BackHandler.addEventListener('hardwareBackPress', this._handleBackButton);
} else {
const {backHandler} = this.props;
if (backHandler === true || typeof backHandler === 'function') {
console.warn('backHandler prop cannot be used if BackHandler is not present (RN >= 0.44 required)');
}
}
}
componentWillUnmount() {
if (BackHandler) {
BackHandler.removeEventListener('hardwareBackPress', this._handleBackButton);
}
}
isMenuOpen() {

@@ -242,2 +279,3 @@ return !!this.state.openedMenu;

customStyles: PropTypes.object,
backHandler: PropTypes.oneOfType([PropTypes.bool, PropTypes.func]),
}

@@ -247,2 +285,3 @@

customStyles: {},
backHandler: false,
};

@@ -249,0 +288,0 @@

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