Test and document Image resizeMode=center on iOS

Summary:
`<Image resizeMode="center">` already works on iOS (implemented in #8792), but is neither tested nor documented the way the other `resizeMode` values are.

This PR primarily enables the relevant RNTester case on iOS, and secondarily copies over the doc comment from `Image.android.js` to `Image.ios.js`. A PR to `react-native-website` will follow shortly and it is there I will try and revise the wording a bit.

Updated RNTester screenshot (iOS):

<img src=https://user-images.githubusercontent.com/2246565/35470720-44b38282-0357-11e8-941c-1b3c5a1b2f3b.png width=300>

react-native-website PR coming soon.

[IOS] [MINOR] [Image] - Include resizeMode=center in RNTester
Closes https://github.com/facebook/react-native/pull/17759

Differential Revision: D6829051

Pulled By: hramos

fbshipit-source-id: c6e0000a75765e8bf3a1d0306aaafad002b14a58
This commit is contained in:
Moti Zilberman 2018-01-27 11:29:52 -08:00 committed by Facebook Github Bot
parent 29f8354c19
commit be7037fd8e
2 changed files with 14 additions and 12 deletions

View File

@ -241,6 +241,10 @@ const Image = createReactClass({
* *
* - `repeat`: Repeat the image to cover the frame of the view. The * - `repeat`: Repeat the image to cover the frame of the view. The
* image will keep it's size and aspect ratio. (iOS only) * image will keep it's size and aspect ratio. (iOS only)
*
* - 'center': Scale the image down so that it is completely visible,
* if bigger than the area of the view.
* The image will not be scaled up.
*/ */
resizeMode: PropTypes.oneOf([ resizeMode: PropTypes.oneOf([
'cover', 'cover',

View File

@ -572,18 +572,16 @@ exports.examples = [
/> />
</View> </View>
: null } : null }
{ Platform.OS === 'android' ? <View style={styles.leftMargin}>
<View style={styles.leftMargin}> <Text style={[styles.resizeModeText]}>
<Text style={[styles.resizeModeText]}> Center
Center </Text>
</Text> <Image
<Image style={styles.resizeMode}
style={styles.resizeMode} resizeMode={Image.resizeMode.center}
resizeMode={Image.resizeMode.center} source={image}
source={image} />
/> </View>
</View>
: null }
</View> </View>
</View> </View>
); );