0.1.2 • Published 2 years ago

@freakycoder/react-native-picker-modal v0.1.2

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

Battle Tested ✅

React Native Picker Modal

npm version npm Platform - Android and iOS License: MIT styled with prettier

Installation

Add the dependency:

npm i react-native-picker-modal

Peer Dependencies

"react-native-modal": ">= 13.0.0"

Usage

Import

import PickerModal from "@freakycoder/react-native-picker-modal";

Fundamental Usage

<PickerModal
  title="You can either take a picture or select one from your album."
  isVisible={isVisible}
  data={["Take a photo", "Select from album"]}
  onPress={(selectedItem: string, index: number) => {
    console.log({ selectedItem, index });
  }}
  onCancelPress={() => {
    setVisible(false);
  }}
  onBackdropPress={() => {
    setVisible(false);
  }}
/>

Example Project 😍

You can checkout the example project 🥰

Simply run

npm i
react-native run-ios/android

should work of the example project.

Configuration - Props

Fundamentals Required

PropertyTypeDefaultDescription
titlestringundefinedchange the title
datastring[]undefinedset the picker modal dataset as string array
isVisiblebooleanundefinedchange the picker modal visibility
onPressfunctionundefinedset your own logic for the button functionality when it is pressed
onCancelPressfunctionundefinedset your own logic for the cancel button functionality when it is pressed

Customization (Optionals)

PropertyTypeDefaultDescription
onBackdropPressfunctionundefinedset your own logic for the backdrop of the modal functionality when it is pressed
TouchableComponentTouchableHightlightdefaultset your own component instead of default react-native TouchableHightlight component
styleViewStyledefaultset or override the style object for the main container
dividerStyleViewStyledefaultset or override the style object for the divider style
cancelButtonStyleViewStyledefaultset or override the style object for the cancel button style
titleTextContainerViewStyledefaultset or override the style object for the title text container
titleTextStyleTextStyledefaultset or override the style object for the title text style
cancelButtonTextStyleViewStyledefaultset or override the style object for the cancel button text container
actionButtonStyleViewStyledefaultset or override the style object for the action button container
actionButtonTextStyleViewStyledefaultset or override the style object for the action button text
actionButtonUnderlayColorstringrgba(0,0,0,0.3)change the action button's underlay color
cancelButtonUnderlayColorstringrgba(200,200,200,0.1)change the cancel button's underlay color

Future Plans

  • LICENSE
  • Write an article about the lib on Medium

Author

FreakyCoder, kurayogun@gmail.com

License

React Native Picker Modal is available under the MIT license. See the LICENSE file for more info.