mirror of
https://github.com/status-im/react-native-cameraroll.git
synced 2025-02-17 20:16:56 +00:00
Make lib JS+native code reachable from iOS example app
This commit is contained in:
parent
b00c05bb81
commit
4777d05546
@ -72,7 +72,7 @@ munge_underscores=true
|
|||||||
|
|
||||||
module.name_mapper='^[./a-zA-Z0-9$_-]+\.\(bmp\|gif\|jpg\|jpeg\|png\|psd\|svg\|webp\|m4v\|mov\|mp4\|mpeg\|mpg\|webm\|aac\|aiff\|caf\|m4a\|mp3\|wav\|html\|pdf\)$' -> 'RelativeImageStub'
|
module.name_mapper='^[./a-zA-Z0-9$_-]+\.\(bmp\|gif\|jpg\|jpeg\|png\|psd\|svg\|webp\|m4v\|mov\|mp4\|mpeg\|mpg\|webm\|aac\|aiff\|caf\|m4a\|mp3\|wav\|html\|pdf\)$' -> 'RelativeImageStub'
|
||||||
# Support the library import in examples
|
# Support the library import in examples
|
||||||
module.name_mapper='^\@react-native-community/cameraroll$' -> '<PROJECT_ROOT>/js/index.js'
|
module.name_mapper='^\@react-native-community/cameraroll$' -> '<PROJECT_ROOT>/js/CameraRoll.js'
|
||||||
|
|
||||||
suppress_type=$FlowIssue
|
suppress_type=$FlowIssue
|
||||||
suppress_type=$FlowFixMe
|
suppress_type=$FlowFixMe
|
||||||
|
@ -43,7 +43,7 @@ title: CameraRoll
|
|||||||
|
|
||||||
`CameraRoll` provides access to the local camera roll or photo library.
|
`CameraRoll` provides access to the local camera roll or photo library.
|
||||||
|
|
||||||
On iOS, the `CameraRoll` API requires the `RCTCameraRoll` library to be linked. You can refer to [Linking Libraries (iOS)](linking-libraries-ios.md) to learn more.
|
On iOS, the `CameraRoll` API requires the `RNCCameraRoll` library to be linked. You can refer to [Linking Libraries (iOS)](linking-libraries-ios.md) to learn more.
|
||||||
|
|
||||||
### Permissions
|
### Permissions
|
||||||
|
|
||||||
|
@ -5,7 +5,7 @@ module.exports = {
|
|||||||
"module-resolver",
|
"module-resolver",
|
||||||
{
|
{
|
||||||
alias: {
|
alias: {
|
||||||
"@react-native-community/cameraroll": "./js"
|
"@react-native-community/cameraroll": "./js/CameraRoll.js"
|
||||||
},
|
},
|
||||||
cwd: "babelrc"
|
cwd: "babelrc"
|
||||||
}
|
}
|
||||||
|
@ -8,23 +8,19 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import React, {Component} from 'react';
|
import React, {Component} from 'react';
|
||||||
import {Platform, StyleSheet, Text, View} from 'react-native';
|
import {StyleSheet, Text, View} from 'react-native';
|
||||||
|
import CameraRoll from '@react-native-community/cameraroll';
|
||||||
const instructions = Platform.select({
|
|
||||||
ios: 'Press Cmd+R to reload,\n' + 'Cmd+D or shake for dev menu',
|
|
||||||
android:
|
|
||||||
'Double tap R on your keyboard to reload,\n' +
|
|
||||||
'Shake or press menu button for dev menu',
|
|
||||||
});
|
|
||||||
|
|
||||||
type Props = {};
|
type Props = {};
|
||||||
export default class App extends Component<Props> {
|
export default class App extends Component<Props> {
|
||||||
|
componentDidMount = async () => {
|
||||||
|
const photos = await CameraRoll.getPhotos({first: 0, assetType: 'Photos'});
|
||||||
|
};
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
return (
|
return (
|
||||||
<View style={styles.container}>
|
<View style={styles.container}>
|
||||||
<Text style={styles.welcome}>Welcome to React Native!</Text>
|
<Text>Welcome</Text>
|
||||||
<Text style={styles.instructions}>To get started, edit App.js</Text>
|
|
||||||
<Text style={styles.instructions}>{instructions}</Text>
|
|
||||||
</View>
|
</View>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,8 @@
|
|||||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||||
<plist version="1.0">
|
<plist version="1.0">
|
||||||
<dict>
|
<dict>
|
||||||
|
<key>NSPhotoLibraryUsageDescription</key>
|
||||||
|
<string>This app wants to see your photos to test the CameraRollManager</string>
|
||||||
<key>CFBundleDevelopmentRegion</key>
|
<key>CFBundleDevelopmentRegion</key>
|
||||||
<string>en</string>
|
<string>en</string>
|
||||||
<key>CFBundleDisplayName</key>
|
<key>CFBundleDisplayName</key>
|
||||||
@ -40,13 +42,10 @@
|
|||||||
</array>
|
</array>
|
||||||
<key>UIViewControllerBasedStatusBarAppearance</key>
|
<key>UIViewControllerBasedStatusBarAppearance</key>
|
||||||
<false/>
|
<false/>
|
||||||
<key>NSLocationWhenInUseUsageDescription</key>
|
|
||||||
<string></string>
|
|
||||||
<key>NSAppTransportSecurity</key>
|
<key>NSAppTransportSecurity</key>
|
||||||
<!--See http://ste.vn/2015/06/10/configuring-app-transport-security-ios-9-osx-10-11/ -->
|
|
||||||
<dict>
|
<dict>
|
||||||
<key>NSAllowsArbitraryLoads</key>
|
<key>NSAllowsArbitraryLoads</key>
|
||||||
<true/>
|
<true/>
|
||||||
<key>NSExceptionDomains</key>
|
<key>NSExceptionDomains</key>
|
||||||
<dict>
|
<dict>
|
||||||
<key>localhost</key>
|
<key>localhost</key>
|
||||||
|
@ -69,7 +69,7 @@ RCT_ENUM_CONVERTER(PHAssetCollectionSubtype, (@{
|
|||||||
|
|
||||||
@implementation RNCCameraRollManager
|
@implementation RNCCameraRollManager
|
||||||
|
|
||||||
RCT_EXPORT_MODULE()
|
RCT_EXPORT_MODULE(CameraRollManager)
|
||||||
|
|
||||||
@synthesize bridge = _bridge;
|
@synthesize bridge = _bridge;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user