react-native-image-picker
Version:
A React Native module that allows you to use native UI to select media from the device library or directly from the camera
29 lines (24 loc) • 730 B
text/typescript
import {Platform} from 'react-native';
import {CameraOptions, ImageLibraryOptions, Callback} from './types';
import {
imageLibrary as nativeImageLibrary,
camera as nativeCamera,
} from './platforms/native';
import {
imageLibrary as webImageLibrary,
camera as webCamera,
} from './platforms/web';
export * from './types';
export function launchCamera(options: CameraOptions, callback?: Callback) {
return Platform.OS === 'web'
? webCamera(options, callback)
: nativeCamera(options, callback);
}
export function launchImageLibrary(
options: ImageLibraryOptions,
callback?: Callback,
) {
return Platform.OS === 'web'
? webImageLibrary(options, callback)
: nativeImageLibrary(options, callback);
}