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'
|
||||
# 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=$FlowFixMe
|
||||
|
|
|
@ -43,7 +43,7 @@ title: CameraRoll
|
|||
|
||||
`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
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@ module.exports = {
|
|||
"module-resolver",
|
||||
{
|
||||
alias: {
|
||||
"@react-native-community/cameraroll": "./js"
|
||||
"@react-native-community/cameraroll": "./js/CameraRoll.js"
|
||||
},
|
||||
cwd: "babelrc"
|
||||
}
|
||||
|
|
|
@ -8,23 +8,19 @@
|
|||
*/
|
||||
|
||||
import React, {Component} from 'react';
|
||||
import {Platform, StyleSheet, Text, View} from 'react-native';
|
||||
|
||||
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',
|
||||
});
|
||||
import {StyleSheet, Text, View} from 'react-native';
|
||||
import CameraRoll from '@react-native-community/cameraroll';
|
||||
|
||||
type Props = {};
|
||||
export default class App extends Component<Props> {
|
||||
componentDidMount = async () => {
|
||||
const photos = await CameraRoll.getPhotos({first: 0, assetType: 'Photos'});
|
||||
};
|
||||
|
||||
render() {
|
||||
return (
|
||||
<View style={styles.container}>
|
||||
<Text style={styles.welcome}>Welcome to React Native!</Text>
|
||||
<Text style={styles.instructions}>To get started, edit App.js</Text>
|
||||
<Text style={styles.instructions}>{instructions}</Text>
|
||||
<Text>Welcome</Text>
|
||||
</View>
|
||||
);
|
||||
}
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>NSPhotoLibraryUsageDescription</key>
|
||||
<string>This app wants to see your photos to test the CameraRollManager</string>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>en</string>
|
||||
<key>CFBundleDisplayName</key>
|
||||
|
@ -40,13 +42,10 @@
|
|||
</array>
|
||||
<key>UIViewControllerBasedStatusBarAppearance</key>
|
||||
<false/>
|
||||
<key>NSLocationWhenInUseUsageDescription</key>
|
||||
<string></string>
|
||||
<key>NSAppTransportSecurity</key>
|
||||
<!--See http://ste.vn/2015/06/10/configuring-app-transport-security-ios-9-osx-10-11/ -->
|
||||
<dict>
|
||||
<key>NSAllowsArbitraryLoads</key>
|
||||
<true/>
|
||||
<key>NSAllowsArbitraryLoads</key>
|
||||
<true/>
|
||||
<key>NSExceptionDomains</key>
|
||||
<dict>
|
||||
<key>localhost</key>
|
||||
|
|
|
@ -69,7 +69,7 @@ RCT_ENUM_CONVERTER(PHAssetCollectionSubtype, (@{
|
|||
|
||||
@implementation RNCCameraRollManager
|
||||
|
||||
RCT_EXPORT_MODULE()
|
||||
RCT_EXPORT_MODULE(CameraRollManager)
|
||||
|
||||
@synthesize bridge = _bridge;
|
||||
|
||||
|
|
Loading…
Reference in New Issue