Update Image docs and examples to the new asset system
Summary: After the release of 0.14, static images should be placed in the source code tree and then required as explained in the [Images guide] (https://facebook.github.io/react-native/docs/images.html). This pull request updates the image documentation and examples to the new asset system. UIExplorer tested on iOS and Android. Closes https://github.com/facebook/react-native/pull/4987 Reviewed By: svcscm Differential Revision: D2796276 Pulled By: bestander fb-gh-sync-id: 732ffa2f136391bb8a3e40a54b5b1ff5022c97f2
@ -148,15 +148,15 @@ exports.examples = [
|
||||
},
|
||||
{
|
||||
title: 'Plain Static Image',
|
||||
description: 'Static assets should be required by prefixing with `image!` ' +
|
||||
'and are located in the app bundle.',
|
||||
description: 'Static assets should be placed in the source code tree, and ' +
|
||||
'required in the same way as JavaScript modules.',
|
||||
render: function() {
|
||||
return (
|
||||
<View style={styles.horizontal}>
|
||||
<Image source={require('image!uie_thumb_normal')} style={styles.icon} />
|
||||
<Image source={require('image!uie_thumb_selected')} style={styles.icon} />
|
||||
<Image source={require('image!uie_comment_normal')} style={styles.icon} />
|
||||
<Image source={require('image!uie_comment_highlighted')} style={styles.icon} />
|
||||
<Image source={require('./uie_thumb_normal.png')} style={styles.icon} />
|
||||
<Image source={require('./uie_thumb_selected.png')} style={styles.icon} />
|
||||
<Image source={require('./uie_comment_normal.png')} style={styles.icon} />
|
||||
<Image source={require('./uie_comment_highlighted.png')} style={styles.icon} />
|
||||
</View>
|
||||
);
|
||||
},
|
||||
@ -320,19 +320,19 @@ exports.examples = [
|
||||
<View>
|
||||
<View style={styles.horizontal}>
|
||||
<Image
|
||||
source={require('image!uie_thumb_normal')}
|
||||
source={require('./uie_thumb_normal.png')}
|
||||
style={[styles.icon, {borderRadius: 5, tintColor: '#5ac8fa' }]}
|
||||
/>
|
||||
<Image
|
||||
source={require('image!uie_thumb_normal')}
|
||||
source={require('./uie_thumb_normal.png')}
|
||||
style={[styles.icon, styles.leftMargin, {borderRadius: 5, tintColor: '#4cd964' }]}
|
||||
/>
|
||||
<Image
|
||||
source={require('image!uie_thumb_normal')}
|
||||
source={require('./uie_thumb_normal.png')}
|
||||
style={[styles.icon, styles.leftMargin, {borderRadius: 5, tintColor: '#ff2d55' }]}
|
||||
/>
|
||||
<Image
|
||||
source={require('image!uie_thumb_normal')}
|
||||
source={require('./uie_thumb_normal.png')}
|
||||
style={[styles.icon, styles.leftMargin, {borderRadius: 5, tintColor: '#8e8e93' }]}
|
||||
/>
|
||||
</View>
|
||||
|
@ -313,7 +313,7 @@ exports.examples = [
|
||||
}}>
|
||||
<Image
|
||||
style={{width:30, height:30}}
|
||||
source={require('image!uie_thumb_selected')}
|
||||
source={require('./uie_thumb_selected.png')}
|
||||
/>
|
||||
</TouchableOpacity>
|
||||
),
|
||||
|
@ -1,21 +0,0 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "2x",
|
||||
"filename" : "uie_comment_highlighted@2x.png"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"version" : 1,
|
||||
"author" : "xcode"
|
||||
}
|
||||
}
|
@ -1,21 +0,0 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "2x",
|
||||
"filename" : "uie_comment_normal@2x.png"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"version" : 1,
|
||||
"author" : "xcode"
|
||||
}
|
||||
}
|
@ -1,21 +0,0 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "2x",
|
||||
"filename" : "uie_thumb_normal@2x.png"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"version" : 1,
|
||||
"author" : "xcode"
|
||||
}
|
||||
}
|
@ -1,21 +0,0 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "2x",
|
||||
"filename" : "uie_thumb_selected@2x.png"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"version" : 1,
|
||||
"author" : "xcode"
|
||||
}
|
||||
}
|
Before Width: | Height: | Size: 403 B |
Before Width: | Height: | Size: 420 B |
Before Width: | Height: | Size: 850 B |
Before Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 403 B After Width: | Height: | Size: 403 B |
Before Width: | Height: | Size: 420 B After Width: | Height: | Size: 420 B |
Before Width: | Height: | Size: 850 B After Width: | Height: | Size: 850 B |
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
@ -38,7 +38,7 @@ var resolveAssetSource = require('resolveAssetSource');
|
||||
* <View>
|
||||
* <Image
|
||||
* style={styles.icon}
|
||||
* source={require('image!myIcon')}
|
||||
* source={require('./myIcon.png')}
|
||||
* />
|
||||
* <Image
|
||||
* style={styles.logo}
|
||||
@ -66,8 +66,8 @@ var Image = React.createClass({
|
||||
style: StyleSheetPropType(ImageStylePropTypes),
|
||||
/**
|
||||
* `uri` is a string representing the resource identifier for the image, which
|
||||
* could be an http address, a local file path, or the name of a static image
|
||||
* resource (which should be wrapped in the `require('image!name')` function).
|
||||
* could be an http address, a local file path, or a static image
|
||||
* resource (which should be wrapped in the `require('./path/to/image.png')` function).
|
||||
*/
|
||||
source: PropTypes.oneOfType([
|
||||
PropTypes.shape({
|
||||
|