Socket
Socket
Sign inDemoInstall

react-native-image-picker-modal

Package Overview
Dependencies
0
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    react-native-image-picker-modal

Easy to use image picker modal with awesome iOS Picker design for React Native


Version published
Weekly downloads
9
increased by12.5%
Maintainers
1
Created
Weekly downloads
 

Readme

Source
React Native Image Picker Modal

Battle Tested ✅

React Native Image Picker Modal

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

React Native Image Picker Modal

Installation

Add the dependency:

npm i react-native-image-picker-modal

Peer Dependencies

IMPORTANT! You need install them
"react-native-image-picker": ">= 4.7.0",
"react-native-modal": ">= 13.0.0",
"@freakycoder/react-native-picker-modal": ">= 0.1.0",

Usage

Import

import ImagePickerModal from "react-native-image-picker-modal";

Fundamental Usage

<ImagePickerModal
  title="You can either take a picture or select one from your album."
  data={["Take a photo", "Select from the library"]}
  isVisible={isVisible}
  onCancelPress={() => {
    setVisible(false);
  }}
  onBackdropPress={() => {
    setVisible(false);
  }}
  onPress={(item: any) => {
    setSelectedItem(item);
    // Example usage from the object: `item.assets[0].uri`
  }}
/>

Asset Object from The Selection

{
  "assets": [
    {
      "timestamp": string, // "2018-03-30T19:14:19.365+0000"
      "type": string, // "image/jpg"
      "fileName": string,
      "fileSize": number,
      "height": number,
      "width": number,
      "id": string,
      "uri": string
    }
  ]
}

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
includeBase64booleanfalsewhen you need base64
capturePhotoOptionsCameraOptionsdefaultoverride the options for capturing the photo
libraryPhotoOptionsImageLibraryOptionsdefaultoverride the options for picking images from library

Future Plans

  • LICENSE
  • Write an article about the lib on Medium

Author

FreakyCoder, kurayogun@gmail.com

License

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

Keywords

FAQs

Last updated on 26 Jan 2022

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

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