Skip to content

Commit

Permalink
chore(npm): migrate package to new @react-native-camera-roll/camera-r…
Browse files Browse the repository at this point in the history
…oll namespace (#414)

BREAKING CHANGE: new package namespace!
  • Loading branch information
bartolkaruza committed Aug 23, 2022
1 parent 46bd2c3 commit 8998fe6
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 15 deletions.
29 changes: 18 additions & 11 deletions README.md
@@ -1,25 +1,32 @@
# `@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


#### 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`)<

Expand All @@ -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`:

Expand All @@ -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
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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';

Expand Down Expand Up @@ -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
8 changes: 4 additions & 4 deletions package.json
@@ -1,8 +1,8 @@
{
"name": "@react-native-community/cameraroll",
"name": "@react-native-camera-roll/camera-roll",
"author": "Bartol Karuza <bartol.k@gmail.com>",
"homepage": "https://github.com/react-native-community/react-native-cameraroll#readme",
"version": "5.0.0",
"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",
"module": "lib/module/index",
Expand Down Expand Up @@ -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"
}
}

0 comments on commit 8998fe6

Please sign in to comment.