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

react-native-in-app-gallery

v0.0.7

Published

A react-native in-app gallery component

Downloads

8

Readme

react-native-in-app-gallery

A react-native in-app gallery component which allows to pick an image from both gallery and camera, optionally without exiting the current screen. It's Android and iOS compatible.

Getting started

Installation guide

This package depends on some common react-native packages:

npm i --save @react-native-community/cameraroll react-native-permissions react-native-camera react-native-image-picker react-native-in-app-gallery

Android

Add required permissions inside the manifest

<manifest>
...
    <uses-permission android:name="android.permission.CAMERA" />
    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.RECORD_AUDIO"/>
...
<application>

Add the following lines in android/app/build.gradle

android {
  ...
  defaultConfig {
    ...
    missingDimensionStrategy 'react-native-camera', 'general' // <--- insert this line
  }
}

iOS

Add required keys in your Info.plist

    <key>NSCameraUsageDescription</key>
	<string>$(PRODUCT_NAME) would like to use your camera</string>
	<key>NSMicrophoneUsageDescription</key>
	<string>$(PRODUCT_NAME) would like to use your microphone to let you take and send videos</string>
	<key>NSPhotoLibraryAddUsageDescription</key>
	<string>$(PRODUCT_NAME) would like to save photos to your photo gallery</string>
	<key>NSPhotoLibraryUsageDescription</key>
	<string>$(PRODUCT_NAME) would like access to your photo gallery</string>

Add permission handlers in your Podfile

  permissions_path = '../node_modules/react-native-permissions/ios'

  pod 'Permission-Camera', :path => "#{permissions_path}/Camera.podspec"
  pod 'Permission-PhotoLibrary', :path => "#{permissions_path}/PhotoLibrary.podspec"

Run

cd ios
pod install

If any problems, please refer to the mentioned above packages installation guides before opening an issue.

Usage

The usage should be straightforward: simply import the component and consume it.

import InAppGallery from 'react-native-in-app-gallery';
...
<InAppGallery
    onImagePicked={(image) => {
        console.log(image);
    }}
/>

Try it out

You can check a simple example here.

Props

| Property | Type | Description | | --------------------------------------- | :--------------------------------------: | :--------------------------------------- | | onImagePicked | (image: ImageFile) => void | Callback which triggers when an image is picked (press on image, take a photo from the camera or from gallery) | | pageSize | number (default 100) | (Optional) The page size dimension to paginate images fetching | | initialNumToRender | number (default 9) | (Optional) The initial number of items to render for the FlatList | | imageHeight | number (default 120) | (Optional) The height of the image item | | withCamera | bool (default true) | (Optional) If true, shows camera preview and allow to take picture from the camera | | withFullGallery | bool (default true) | (Optional) If true, a FAB button allows you to open the gallery | | onPermissionGranted | (permission: Permission) => void | (Optional) Callback on permission granted | | onPermissionDenied | (permission: Permission) => void | (Optional) Callback on permission denied | | onPermissionBlocked | (permission: Permission) => void | (Optional) Callback on permission blocked | | imagePickerOptions | ImagePickerOptions (default {storageOptions: {skipBackup: true, path: 'images'}}) | (Optional) Options for ImagePicker | | enableSelection | bool (default false) | (Optional) It enables selection (with long press) | | onImageSelected | (image: ImageFile, selected: boolean) | (Optional) Callback on image selection. It's triggered whenever an image is selected or deselected | | onSelectionEnd | (images: ImageFile[]) => void | (Optional) Callback on images selection end | | cancelSelectionText | string (default Cancel) | (Optional) Text to cancel selection | | doneSelectionText | string (default DONE) | (Optional) Text to end selection | | selectionColor | string (default #0284ff) | (Optional) It's the tint color for selection icon |

Methods

| Method | Description | | --------------------------------------- | :--------------------------------------: | | clearSelection | It clears selected images |

Who we are