Socket
Socket
Sign inDemoInstall

react-native-option-menu

Package Overview
Dependencies
0
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.0.1 to 1.1.1

android_screenshot.png

15

index.js

@@ -1,2 +0,2 @@

import React,{useState} from "react";
import React,{useState,useRef} from "react";
import {

@@ -14,2 +14,6 @@ Platform,

const OptionMenu = (props) =>{
console.log(props);
const inputRef = useRef();
const [open,setOpen] = useState(false);

@@ -59,4 +63,5 @@

} else if (Platform.OS === "android") {
UIManager.showPopupMenu(
findNodeHandle(refs.menu),
findNodeHandle(inputRef.current),
options,

@@ -121,3 +126,3 @@ () => console.log("something went wrong with the popup menu"),

<View>
<TouchableOpacity ref={"menu"} onPress={handlePressWeb}>
<TouchableOpacity ref={ inputRef } onPress={handlePressWeb}>
{component}

@@ -132,3 +137,3 @@ </TouchableOpacity>

<View>
<TouchableOpacity ref={"menu"} onPress={handlePress}>
<TouchableOpacity ref={ inputRef } onPress={handlePress}>
{component}

@@ -142,2 +147,2 @@ </TouchableOpacity>

export default OptionMenu;
export default OptionMenu;
{
"name": "react-native-option-menu",
"version": "1.0.1",
"version": "1.1.1",
"description": "A native looking options dialog for Ios and Android",

@@ -5,0 +5,0 @@ "main": "index.js",

# react-native-option-menu
A native looking options dialog for IOS, and Android and Web.
To Download, run: npm i react-native-option-menu.
Usage example:
import OptionsMenu from "react-native-option-menu";
const MoreIcon = require("../../assets/more/more.png");
<OptionsMenu
button={MoreIcon}
buttonStyle={{ width: 32, height: 8, margin: 7.5, resizeMode: "contain" }}
destructiveIndex={1}
options={["Edit", "Delete", "Cancel"]}
actions={[editPost, deletePost]}/>
Note that button is a required prop (pass in a png of the desired button).
As an alternative to the button and style props, you can just pass in a full custom component:
const myIcon = (<Icon name="rocket" size={30} color="#900" />)
<OptionsMenu
customButton={myIcon}
destructiveIndex={1}
options={["Edit", "Delete", "Cancel"]}
actions={[editPost,deletePost]}/>
Destructive index in an iOS only prop. It will appear as a red index.
Options: an array of strings that will be displayed in the menu.
Actions: an array of functions to be executed for every menu item. Note that the orders of options an actions have to match.
iOS Screenshot:
![Screenshot](ios_screenshoot.png)
Android Screenshot:
![Screenshot](android_screenshot.png)
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