A dead simple camera-roll polling endpoint.
A dead simple camera-roll polling endpoint.
1. Request a new check for photos since forever
``javascript
import CameraRoll from '@textile/react-native-camera-roll'
const minEpoch = 0
CameraRoll.requestLocalPhotos(minEpoch)
`
2. Listen for photos detected
`javascript
import { eventEmitter as Events, ILocalPhotoResult } from '@textile/react-native-camera-roll'
Events.addListener('@textile/newLocalPhoto', (localPhoto: ILocalPhotoResult) => {
// Do something
})
`
$ npm install @textile/react-native-camera-roll --save
$ react-native link @textile/react-native-camera-roll
#### iOS
1. In XCode, in the project navigator, right click Libraries ➜ Add Files to [your project's name]node_modules
2. Go to ➜ @textile/react-native-camera-roll and add RNCameraRoll.xcodeprojlibRNCameraRoll.a
3. In XCode, in the project navigator, select your project. Add to your project's Build Phases ➜ Link Binary With LibrariesCmd+R
4. Run your project ()<
#### Android
1. Open up android/app/src/main/java/[...]/MainActivity.javaimport io.textile.cameraroll.RNCameraRollPackage;
- Add to the imports at the top of the filenew RNCameraRollPackage()
- Add to the list returned by the getPackages() methodandroid/settings.gradle
2. Append the following lines to :`
`
include ':react-native-camera-roll'
project(':react-native-camera-roll').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-camera-roll/android')
android/app/build.gradle
3. Insert the following lines inside the dependencies block in :`
`
compile project(':react-native-camera-roll')
javascript
import CameraRoll from '@textile/react-native-camera-roll';// TODO: What to do with the module?
CameraRoll;
``