mirror of
https://github.com/zoriya/react-native-web.git
synced 2026-06-05 11:19:34 +00:00
Correct the Image docs
This commit is contained in:
@@ -46,7 +46,7 @@ Invoked when load either succeeds or fails,
|
|||||||
|
|
||||||
Invoked on load start.
|
Invoked on load start.
|
||||||
|
|
||||||
**resizeMode**: oneOf('center', 'contain', 'cover', 'none', 'repeat', 'stretch') = 'stretch'
|
**resizeMode**: oneOf('center', 'contain', 'cover', 'none', 'repeat', 'stretch') = 'cover'
|
||||||
|
|
||||||
Determines how to resize the image when the frame doesn't match the raw image
|
Determines how to resize the image when the frame doesn't match the raw image
|
||||||
dimensions.
|
dimensions.
|
||||||
|
|||||||
@@ -1,12 +1,10 @@
|
|||||||
import keyMirror from 'fbjs/lib/keyMirror';
|
const ImageResizeMode = {
|
||||||
|
center: 'center',
|
||||||
const ImageResizeMode = keyMirror({
|
contain: 'contain',
|
||||||
center: null,
|
cover: 'cover',
|
||||||
contain: null,
|
none: 'none',
|
||||||
cover: null,
|
repeat: 'repeat',
|
||||||
none: null,
|
stretch: 'stretch'
|
||||||
repeat: null,
|
};
|
||||||
stretch: null
|
|
||||||
});
|
|
||||||
|
|
||||||
module.exports = ImageResizeMode;
|
module.exports = ImageResizeMode;
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ import BaseComponentPropTypes from '../../propTypes/BaseComponentPropTypes';
|
|||||||
import createDOMElement from '../../modules/createDOMElement';
|
import createDOMElement from '../../modules/createDOMElement';
|
||||||
import ImageResizeMode from './ImageResizeMode';
|
import ImageResizeMode from './ImageResizeMode';
|
||||||
import ImageStylePropTypes from './ImageStylePropTypes';
|
import ImageStylePropTypes from './ImageStylePropTypes';
|
||||||
import resolveAssetSource from './resolveAssetSource';
|
|
||||||
import StyleSheet from '../../apis/StyleSheet';
|
import StyleSheet from '../../apis/StyleSheet';
|
||||||
import StyleSheetPropType from '../../propTypes/StyleSheetPropType';
|
import StyleSheetPropType from '../../propTypes/StyleSheetPropType';
|
||||||
import View from '../View';
|
import View from '../View';
|
||||||
@@ -23,6 +22,10 @@ const ImageSourcePropType = PropTypes.oneOfType([
|
|||||||
PropTypes.string
|
PropTypes.string
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
const resolveAssetSource = (source) => {
|
||||||
|
return ((typeof source === 'object') ? source.uri : source) || null;
|
||||||
|
};
|
||||||
|
|
||||||
class Image extends Component {
|
class Image extends Component {
|
||||||
static displayName = 'Image';
|
static displayName = 'Image';
|
||||||
|
|
||||||
@@ -35,7 +38,7 @@ class Image extends Component {
|
|||||||
onLoad: PropTypes.func,
|
onLoad: PropTypes.func,
|
||||||
onLoadEnd: PropTypes.func,
|
onLoadEnd: PropTypes.func,
|
||||||
onLoadStart: PropTypes.func,
|
onLoadStart: PropTypes.func,
|
||||||
resizeMode: PropTypes.oneOf([ 'center', 'contain', 'cover', 'none', 'repeat', 'stretch' ]),
|
resizeMode: PropTypes.oneOf(Object.keys(ImageResizeMode)),
|
||||||
source: ImageSourcePropType,
|
source: ImageSourcePropType,
|
||||||
style: StyleSheetPropType(ImageStylePropTypes)
|
style: StyleSheetPropType(ImageStylePropTypes)
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,5 +0,0 @@
|
|||||||
function resolveAssetSource(source) {
|
|
||||||
return ((typeof source === 'object') ? source.uri : source) || null;
|
|
||||||
}
|
|
||||||
|
|
||||||
module.exports = resolveAssetSource;
|
|
||||||
Reference in New Issue
Block a user