npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@paraboly/react-native-media-picker

v0.2.1

Published

Easy to use media picker modal for React Native by Paraboly

Downloads

19

Readme

Battle Tested ✅

Easy to use media picker modal for React Native by Paraboly

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

Installation

Add the dependency:

npm i @paraboly/react-native-media-picker

Peer Dependencies

IMPORTANT! You need install them
"@freakycoder/react-native-helpers": ">= 0.1.2",
"react-native-image-crop-picker": ">= 0.26.2",
"react-native-modalize": ">= 2.0.0",
"react-native-vector-icons": ">= 6.6.0",
"react-native-dynamic-vector-icons": ">= 0.2.1",

iOS & Android Permissions

iOS

<key>NSCameraUsageDescription</key>
<string>This allows us to capture and use the the captured photo</string>
<key>NSPhotoLibraryAddUsageDescription</key>
<string>This allows us to show/pick a photo from your library</string>
<key>NSPhotoLibraryUsageDescription</key>
<string>This allows us to show/pick a photo from your library</string>

Android

<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />

Usage

Import

import MediaPicker from "@paraboly/react-native-media-picker";

Basic Usage

<MediaPicker>

Advanced Usage

You can check the example :) Put your own logic for galleryOnPress or cameraOnPress both returns the callback of the images.

<MediaPicker
  multiple
  ref={(ref) => (this.mediaPicker = ref)}
  cameraOnPress={(image: any) => {
    this.setState({ image });
  }}
  galleryOnPress={(images: any) => {
    this.setState({
      image: null,
      images: images.map((image: any) => {
        return {
          uri: image.path,
          width: image.width,
          height: image.height,
          mime: image.mime,
        };
      }),
    });
    // ? Single Image (Multiple = false)
    // this.setState({
    //   image: {
    //     uri: image.path,
    //     width: image.width,
    //     height: image.height,
    //     mime: image.mime
    //   }
    // });
  }}
/>

Open/Close The MediaPicker Modal

Open

this.mediaPicker.openModal();

Close

this.mediaPicker.closeModal();

Configuration - Props

| Property | Type | Default | Description | | ---------------------------- | :-------: | :---------: | ----------------------------------------------------------------------------- | | IconComponent | component | Icon | set your own Icon component such as Icon from react-native-vector-icons | | multiple | boolean | true | change the picking media's as single or multiple at once | | cameraText | string | Camera | change the camera button's text | | galleryText | string | Gallery | change the gallery button's text | | backgroundColor | color | #90a1fc | change the modal's background color | | onCameraPress | function | default | set your own logic when camera is on pressed (please check the example) | | onGalleryPress | function | default | set your own logic when gallery is on pressed (please check the example) | | cameraIconName | string | camera | change the camera's icon name | | cameraIconType | string | FontAwesome | change the camera's icon type | | cameraIconColor | color | #fdfdfd | change the camera's icon color | | cameraIconSize | number | 20 | change the camera's icon size | | galleryIconName | string | md-photos | change the gallery's icon name | | galleryIconType | string | Ionicons | change the gallery's icon type | | galleryIconColor | color | #fdfdfd | change the gallery's icon color | | galleryIconSize | number | 20 | change the gallery's icon size | | cameraButtonBackgroundColor | color | #fdfdfd | change the camera button's background color | | galleryButtonBackgroundColor | color | #fdfdfd | change the gallery button's background color | | cameraButtonSize | number | 50 | change the camera button's whole size | | galleryButtonSize | number | 50 | change the gallery button's whole size | | cameraTextColor | color | #fdfdfd | change the camera button's text color | | galleryTextColor | color | #fdfdfd | change the gallery button's text color | | compressImageQuality | number | 0.5 | change the quality of your photo | | onCameraButtonPressed | function | default | set instead of react-native-image-crop-picker library when preesing camera | | onGalleryButtonPressed | function | default | set instead of react-native-image-crop-picker library when preesing gallery |

Future Plans

  • [x] ~~LICENSE~~
  • [ ] Write an article about the lib on Medium

Author

FreakyCoder, [email protected]

License

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