From c72173ff88467dc49ca6c8586a102172194c4df4 Mon Sep 17 00:00:00 2001 From: Nicolas Gallagher Date: Tue, 8 Sep 2015 00:29:53 -0700 Subject: [PATCH] Image: set 'resizeMode' default to 'stretch' Fix #8 --- docs/components/Image.md | 4 ++-- src/components/Image/index.js | 13 ++++++------- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/docs/components/Image.md b/docs/components/Image.md index be0f46a2..f5e8c5bb 100644 --- a/docs/components/Image.md +++ b/docs/components/Image.md @@ -37,10 +37,10 @@ Invoked when load either succeeds or fails, Invoked on load start. -**resizeMode** oneOf('clip', 'contain', 'cover', 'stretch') +**resizeMode** oneOf('contain', 'cover', 'none', 'stretch') Determines how to resize the image when the frame doesn't match the raw image -dimensions. Default: `cover`. +dimensions. Default: `stretch`. **source** { uri: string } diff --git a/src/components/Image/index.js b/src/components/Image/index.js index 32e45e7e..632069a1 100644 --- a/src/components/Image/index.js +++ b/src/components/Image/index.js @@ -17,8 +17,7 @@ const styles = { initial: { alignSelf: 'flex-start', backgroundRepeat: 'no-repeat', - backgroundPosition: 'center', - backgroundSize: 'cover' + backgroundPosition: 'center' }, img: { borderWidth: 0, @@ -35,15 +34,15 @@ const styles = { top: 0 }, resizeMode: { - clip: { - backgroundSize: 'auto' - }, contain: { backgroundSize: 'contain' }, cover: { backgroundSize: 'cover' }, + none: { + backgroundSize: 'auto' + }, stretch: { backgroundSize: '100% 100%' } @@ -71,7 +70,7 @@ class Image extends React.Component { onLoad: PropTypes.func, onLoadEnd: PropTypes.func, onLoadStart: PropTypes.func, - resizeMode: PropTypes.oneOf(['clip', 'contain', 'cover', 'stretch']), + resizeMode: PropTypes.oneOf(['contain', 'cover', 'none', 'stretch']), source: PropTypes.object, style: PropTypes.shape(ImageStylePropTypes), testID: CoreComponent.propTypes.testID @@ -82,7 +81,7 @@ class Image extends React.Component { static defaultProps = { accessible: true, defaultSource: {}, - resizeMode: 'cover', + resizeMode: 'stretch', source: {}, style: styles.initial }