From 6afa303eb23d7950e2ec8f568ff1aa7a1995f2ff Mon Sep 17 00:00:00 2001 From: Bartol Karuza Date: Tue, 23 Aug 2022 16:30:32 +0800 Subject: [PATCH] chore(npm): migrate package to new @react-native-camera-roll/camera-roll namespace (#416) BREAKING CHANGE: new package namespace! --- README.md | 29 ++++++++++++++++++----------- package.json | 6 +++--- 2 files changed, 21 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index 122952d..86fb2ee 100644 --- a/README.md +++ b/README.md @@ -1,17 +1,24 @@ -# `@react-native-community/cameraroll` +# `@react-native-camera-roll/camera-roll` [![CircleCI Status][circle-ci-badge]][circle-ci] ![Supports Android and iOS][supported-os-badge] ![MIT License][license-badge] [![Lean Core Badge][lean-core-badge]][lean-core-issue] +## *Notice*: The NPM package name has changed, please change your package.json dependency! + +Previous package name: @react-native-community/cameraroll + +New package name: @react-native-camera-roll/camera-roll + + ## Getting started -`$ npm install @react-native-community/cameraroll --save` +`$ npm install @react-native-camera-roll/camera-roll --save` ### Mostly automatic installation -`$ react-native link @react-native-community/cameraroll && npx pod-install` +`$ react-native link @react-native-camera-roll/camera-roll && npx pod-install` ### Manual installation @@ -19,7 +26,7 @@ #### iOS 1. In XCode, in the project navigator, right click `Libraries` ➜ `Add Files to [your project's name]` -2. Go to `node_modules` ➜ `@react-native-community/cameraroll` and add `RNCCameraroll.xcodeproj` +2. Go to `node_modules` ➜ `@react-native-camera-roll/camera-roll` and add `RNCCameraroll.xcodeproj` 3. In XCode, in the project navigator, select your project. Add `libRNCCameraroll.a` to your project's `Build Phases` ➜ `Link Binary With Libraries` 4. Run your project (`Cmd+R`)< @@ -30,12 +37,12 @@ - Add `new CameraRollPackage()` to the list returned by the `getPackages()` method 2. Append the following lines to `android/settings.gradle`: ``` - include ':@react-native-community_cameraroll' - project(':@react-native-community_cameraroll').projectDir = new File(rootProject.projectDir, '../node_modules/@react-native-community/cameraroll/android') + include ':@react-native-camera-roll_camera-roll' + project(':@react-native-camera-roll_camera-roll').projectDir = new File(rootProject.projectDir, '../node_modules/@react-native-camera-roll/camera-roll/android') ``` 3. Insert the following lines inside the dependencies block in `android/app/build.gradle`: ``` - implementation project(':@react-native-community_cameraroll') + implementation project(':@react-native-camera-roll_camera-roll') ``` Starting with Android 10, the concept of [scoped storage](https://developer.android.com/training/data-storage#scoped-storage) is introduced. Currently, to make it working with that change, you have to add `android:requestLegacyExternalStorage="true"` to `AndroidManifest.xml`: @@ -56,7 +63,7 @@ import { CameraRoll } from "react-native"; to: ```javascript -import { CameraRoll } from "@react-native-community/cameraroll"; +import { CameraRoll } from "@react-native-camera-roll/camera-roll"; ``` ## Usage @@ -93,7 +100,7 @@ Then you have to explicitly ask for the permission ```javascript import { PermissionsAndroid, Platform } from "react-native"; -import { CameraRoll } from "@react-native-community/cameraroll"; +import { CameraRoll } from "@react-native-camera-roll/camera-roll"; async function hasAndroidPermission() { const permission = PermissionsAndroid.PERMISSIONS.WRITE_EXTERNAL_STORAGE; @@ -287,7 +294,7 @@ render() { Loading images with listeners and refetchs: ```javascript -import { PhotoGallery, cameraRollEventEmitter } from 'react-native-photo-gallery-api'; +import { PhotoGallery, cameraRollEventEmitter } from '@react-native-camera-roll/camera-roll'; import { useCallback, useEffect, useState } from 'react'; @@ -460,6 +467,6 @@ If you try to save media into specific album without asking for read and write p [circle-ci-badge]:https://img.shields.io/circleci/project/github/react-native-cameraroll/react-native-cameraroll/master.svg?style=flat-square [circle-ci]:https://circleci.com/gh/react-native-cameraroll/workflows/react-native-cameraroll/tree/master [supported-os-badge]:https://img.shields.io/badge/platforms-android%20|%20ios-lightgrey.svg?style=flat-square -[license-badge]:https://img.shields.io/npm/l/@react-native-community/cameraroll.svg?style=flat-square +[license-badge]:https://img.shields.io/npm/l/@react-native-camera-roll/camera-roll.svg?style=flat-square [lean-core-badge]: https://img.shields.io/badge/Lean%20Core-Extracted-brightgreen.svg?style=flat-square [lean-core-issue]: https://github.com/facebook/react-native/issues/23313 diff --git a/package.json b/package.json index 8c77d28..d220b01 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { - "name": "@react-native-community/cameraroll", + "name": "@react-native-camera-roll/camera-roll", "author": "Bartol Karuza ", - "homepage": "https://github.com/react-native-community/react-native-cameraroll#readme", + "homepage": "https://github.com/react-native-cameraroll/react-native-cameraroll#readme", "version": "4.1.2", "description": "React Native Camera Roll for iOS & Android", "main": "lib/commonjs/index", @@ -151,6 +151,6 @@ }, "repository": { "type": "git", - "url": "https://github.com/react-native-community/react-native-cameraroll.git" + "url": "https://github.com/react-native-cameraroll/react-native-cameraroll.git" } }