alexandre
alexandre

Reputation: 195

react native how to link official libraries (like CameraRoll)?

I've tryed to install camera roll with the official documentation.
But i couldn't find the name of the library in npm
I've tryed :

npm install RCTCameraRoll --save

but i get

npm ERR! code E404

what is the proper way to do it ?
NOTE: i don't want to install a third party plugin i want to use facebook CameraRoll

Upvotes: 2

Views: 4395

Answers (2)

Sinan Baymammadli
Sinan Baymammadli

Reputation: 808

Inorder to use CameraRoll in ios you need to:

  1. Drag the node_modules/react-native/Libraries/CameraRoll/RCTCameraRoll.xcodeproj file in your Libraries folder in Xcode
  2. in Xcode Build Phases -> Link Binary With Libraries -> then press + sign and add the libRCTCameraRoll.a
  3. Recompile your app

Upvotes: 19

WilomGfx
WilomGfx

Reputation: 2013

Its part of the react-native api as mentionned in the docs so you dont need to save it as dependency from NPM.

So you just do :

import React, { CameraRoll } from 'react-native'

Take a look at the example from the docs, it's quite complete.

Upvotes: 6

Related Questions