New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

react-native-modal-selector

Package Overview
Dependencies
Maintainers
2
Versions
36
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-native-modal-selector - npm Package Compare versions

Comparing version 1.0.2 to 1.0.3

23

index.js

@@ -74,2 +74,3 @@ 'use strict';

customSelector: PropTypes.node,
selectedKey: PropTypes.any,
};

@@ -110,3 +111,3 @@

backdropPressToClose: false,
openButtonContainerAccessible: false,
openButtonContainerAccessible: false,
listItemAccessible: false,

@@ -122,2 +123,3 @@ cancelButtonAccessible: false,

customSelector: undefined,
selectedKey: '',
};

@@ -129,8 +131,8 @@

super(props);
let selectedItem = this.validateSelectedKey(props.selectedKey);
this.state = {
modalVisible: props.visible,
selected: props.initValue,
selected: selectedItem.label,
cancelText: props.cancelText,
changedItem: undefined,
changedItem: selectedItem.key,
};

@@ -150,2 +152,8 @@ }

}
if(prevProps.selectedKey !== this.props.selectedKey){
let selectedItem = this.validateSelectedKey(this.props.selectedKey);
newState.selected = selectedItem.label;
newState.changedItem = selectedItem.key;
doUpdate = true;
}
if (doUpdate) {

@@ -156,2 +164,9 @@ this.setState(newState);

validateSelectedKey = (key) => {
let selectedItem = this.props.data.filter((item) => this.props.keyExtractor(item) === key);
let selectedLabel = selectedItem.length > 0 ? this.props.labelExtractor(selectedItem[0]) : this.props.initValue;
let selectedKey = selectedItem.length > 0 ? key : undefined;
return {label: selectedLabel, key: selectedKey}
}
onChange = (item) => {

@@ -158,0 +173,0 @@ if (Platform.OS === 'android' || (Modal.propTypes !== undefined && !Modal.propTypes.onDismiss)) { // don't know if this will work for previous version, please check!

2

package.json
{
"name": "react-native-modal-selector",
"version": "1.0.2",
"version": "1.0.3",
"description": "A cross-platform (iOS / Android), selector/picker component for React Native that is highly customizable and supports sections.",

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

@@ -167,2 +167,3 @@ # react-native-modal-selector [![npm version](https://badge.fury.io/js/react-native-modal-selector.svg)](https://badge.fury.io/js/react-native-modal-selector)

`customSelector` | node | Yes | undefined | Render a custom node instead of the built-in select box.
`selectedKey` | any | Yes | '' | Key of the item to be initially selected

@@ -169,0 +170,0 @@ ### Methods

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