-
Notifications
You must be signed in to change notification settings - Fork 382
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of https://github.com/didi/mpx
- Loading branch information
Showing
13 changed files
with
180 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
import { envError, defineUnsupportedProps, successHandle, failHandle } from '../../../common/js' | ||
import { Image } from 'react-native' | ||
|
||
const previewImage = envError('previewImage') | ||
|
||
const compressImage = envError('compressImage') | ||
|
||
const getImageInfo = function (options = {}) { | ||
const { src, success, fail, complete } = options | ||
if (src === undefined) { | ||
const result = { | ||
errMsg: 'getImageInfo:fail parameter error: parameter.src should be String instead of Undefined;', | ||
errno: 1001 | ||
} | ||
failHandle(result, fail, complete) | ||
return | ||
} | ||
if (src === '') { | ||
const result = { | ||
errMsg: 'getImageInfo:fail image not found' | ||
} | ||
failHandle(result, fail, complete) | ||
return | ||
} | ||
Image.getSize(src, (width, height) => { | ||
const result = { | ||
errMsg: 'getImageInfo:ok', | ||
width, | ||
height | ||
} | ||
defineUnsupportedProps(result, ['path', 'orientation', 'type']) | ||
successHandle(result, success, complete) | ||
}, (err) => { | ||
const result = { | ||
errMsg: 'getImageInfo:fail download image fail. reason: ' + err | ||
} | ||
failHandle(result, fail, complete) | ||
}) | ||
} | ||
|
||
export { | ||
previewImage, | ||
compressImage, | ||
getImageInfo | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import { ENV_OBJ, envError } from '../../../common/js' | ||
|
||
const getSetting = ENV_OBJ.getSetting || envError('getSetting') | ||
|
||
const openSetting = ENV_OBJ.openSetting || envError('openSetting') | ||
|
||
const enableAlertBeforeUnload = ENV_OBJ.enableAlertBeforeUnload || envError('enableAlertBeforeUnload') | ||
|
||
const disableAlertBeforeUnload = ENV_OBJ.disableAlertBeforeUnload || envError('disableAlertBeforeUnload') | ||
|
||
const getMenuButtonBoundingClientRect = ENV_OBJ.getMenuButtonBoundingClientRect || envError('getMenuButtonBoundingClientRect') | ||
|
||
export { | ||
getSetting, | ||
openSetting, | ||
enableAlertBeforeUnload, | ||
disableAlertBeforeUnload, | ||
getMenuButtonBoundingClientRect | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters