default
default

Reputation: 53

When using React Native + Expo, where is the iOS API accessed?

I'm following the Expo tutorial where you build a simple image-sharing application (https://docs.expo.dev/tutorial/image-picker/).

I'm curious where in node_modules is the actual code that accesses the iOS permissions interface.

For example, in app.js I have the following code:

let permissionResult = await ImagePicker.requestMediaLibraryPermissionsAsync();

The requestMediaLibraryPermissionsAsync method is located in node_modules/expo-image-picker/build/ImagePicker.js where I find:

export async function requestMediaLibraryPermissionsAsync(writeOnly = false) {
    const imagePickerMethod = ExponentImagePicker.requestMediaLibraryPermissionsAsync;
    return imagePickerMethod(writeOnly);
}

Going to node_modules/expo-image-picker/build/ExponentImagePicker.js I find:

import { NativeModulesProxy } from 'expo-modules-core';
export default NativeModulesProxy.ExponentImagePicker;
//# sourceMappingURL=ExponentImagePicker.js.map

This is where I'm becoming confused, and I'm not sure how to continue tracing through the modules. I see in node_modules/expo-modules-core/ios/interfaces/Permissions there are objective-c files related to iOS permissions - are these being used in this code example? Where in the code are we actually accessing the iOS API? I have a strong feeling that I'm approaching this question from the wrong angle, so please excuse my ignorance.

Upvotes: 0

Views: 244

Answers (1)

Daniel Rosenberg
Daniel Rosenberg

Reputation: 600

I think you have to look at the repository https://github.com/expo/expo/search?q=ExponentImagePicker

Try to find the API names you need.

Upvotes: 1

Related Questions