UNPKG

2.01 kBSource Map (JSON)View Raw
1{"version":3,"file":"ImageManipulator.js","sourceRoot":"","sources":["../src/ImageManipulator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAE7C,MAAM,EAAE,wBAAwB,EAAE,GAAG,aAAa,CAAC;AA6BnD,MAAM,CAAC,KAAK,UAAU,UAAU,CAC9B,GAAW,EACX,UAAsC,EAAE,EACxC,cAA2B,EAAE;IAE7B,oBAAoB;IACpB,OAAO,CAAC,IAAI,CAAC,0HAA0H,CAAC,CAAC;IACzI,OAAO,eAAe,CAAC,GAAG,EAAE,OAAO,EAAE,WAAW,CAAC,CAAC;AACpD,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,eAAe,CACnC,GAAW,EACX,UAAsC,EAAE,EACxC,cAA2B,EAAE;IAE7B,IAAI,CAAC,CAAC,OAAO,GAAG,KAAK,QAAQ,CAAC,EAAE;QAC9B,MAAM,IAAI,SAAS,CAAC,qCAAqC,CAAC,CAAC;KAC5D;IACD,OAAO,wBAAwB,CAAC,UAAU,CAAC,GAAG,EAAE,OAAO,EAAE,WAAW,CAAC,CAAC;AACxE,CAAC","sourcesContent":["import { NativeModules } from 'react-native';\n\nconst { ExponentImageManipulator } = NativeModules;\n\ntype ImageResult = {\n uri: string,\n width: number,\n height: number,\n base64?: string,\n};\n\ntype CropParameters = {\n originX: number,\n originY: number,\n width: number,\n height: number,\n};\n\ntype ImageManipulationActions = {\n resize?: { width?: number, height?: number },\n rotate?: number,\n flip?: { vertical?: boolean, horizontal?: boolean },\n crop?: CropParameters,\n};\n\ntype SaveOptions = {\n base64?: boolean,\n compress?: number,\n format?: 'jpeg' | 'png',\n};\n\nexport async function manipulate(\n uri: string,\n actions: ImageManipulationActions[] = [],\n saveOptions: SaveOptions = {}\n): Promise<ImageResult> {\n // Remove in SDK 32+\n console.warn(`ImageManipulator.manipulate is deprecated in favor of manipulateAsync, which has the same API except for the method name`);\n return manipulateAsync(uri, actions, saveOptions);\n}\n\nexport async function manipulateAsync(\n uri: string,\n actions: ImageManipulationActions[] = [],\n saveOptions: SaveOptions = {}\n): Promise<ImageResult> {\n if (!(typeof uri === 'string')) {\n throw new TypeError(`The \"uri\" argument must be a string`);\n }\n return ExponentImageManipulator.manipulate(uri, actions, saveOptions);\n}\n"]}
\No newline at end of file