mirror of https://git.lenooby09.tech/LeNooby09/social-app.git
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

at quote-hover 40 lines 953 B view raw
1import {Image as RNImage} from 'react-native-image-crop-picker' 2import RNFS from 'react-native-fs' 3import {CropperOptions} from './types' 4import {compressIfNeeded} from './manip' 5 6async function getFile() { 7 let files = await RNFS.readDir( 8 RNFS.LibraryDirectoryPath.split('/') 9 .slice(0, -5) 10 .concat(['Media', 'DCIM', '100APPLE']) 11 .join('/'), 12 ) 13 files = files.filter(file => file.path.endsWith('.JPG')) 14 const file = files[0] 15 return await compressIfNeeded({ 16 path: file.path, 17 mime: 'image/jpeg', 18 size: file.size, 19 width: 4288, 20 height: 2848, 21 }) 22} 23 24export async function openPicker(): Promise<RNImage[]> { 25 return [await getFile()] 26} 27 28export async function openCamera(): Promise<RNImage> { 29 return await getFile() 30} 31 32export async function openCropper(opts: CropperOptions): Promise<RNImage> { 33 return { 34 path: opts.path, 35 mime: 'image/jpeg', 36 size: 123, 37 width: 4288, 38 height: 2848, 39 } 40}