mirror of
https://github.com/zhigang1992/react-native-web.git
synced 2026-03-26 09:14:15 +08:00
Update presentation of Image docs
This commit is contained in:
@@ -31,7 +31,7 @@ class NetworkImageExample extends PureComponent {
|
||||
) : null;
|
||||
|
||||
return (
|
||||
<View style={[helpers.styles.row, helpers.styles.centerRow]}>
|
||||
<View>
|
||||
<Image
|
||||
defaultSource={sources.placeholder}
|
||||
onError={this._handleError}
|
||||
@@ -43,7 +43,7 @@ class NetworkImageExample extends PureComponent {
|
||||
>
|
||||
{loader}
|
||||
</Image>
|
||||
{this.state.message && <Text style={helpers.styles.marginLeft}>{this.state.message}</Text>}
|
||||
{this.state.message && <Text style={helpers.styles.marginTop}>{this.state.message}</Text>}
|
||||
</View>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -8,21 +8,25 @@ import { Image, StyleSheet, Text } from 'react-native';
|
||||
|
||||
const ImageChildrenExample = () => (
|
||||
<Image source={sources.large} style={styles.image}>
|
||||
<Text style={styles.text}>React</Text>
|
||||
<Text style={styles.text}>Child content</Text>
|
||||
</Image>
|
||||
);
|
||||
|
||||
const styles = StyleSheet.create({
|
||||
image: {
|
||||
width: 60,
|
||||
height: 60,
|
||||
width: 300,
|
||||
height: 200,
|
||||
backgroundColor: 'transparent',
|
||||
justifyContent: 'center',
|
||||
alignItems: 'center'
|
||||
},
|
||||
text: {
|
||||
backgroundColor: 'transparent',
|
||||
color: 'white'
|
||||
color: 'white',
|
||||
fontWeight: 'bold',
|
||||
fontSize: 18,
|
||||
position: 'relative',
|
||||
top: 50
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -8,11 +8,7 @@ import React from 'react';
|
||||
import { Image } from 'react-native';
|
||||
|
||||
const ImageDefaultSourceExample = () => (
|
||||
<Image
|
||||
defaultSource={sources.placeholder}
|
||||
source={sources.largeAlt}
|
||||
style={helpers.styles.base}
|
||||
/>
|
||||
<Image defaultSource={sources.placeholder} style={helpers.styles.base} />
|
||||
);
|
||||
|
||||
export default ImageDefaultSourceExample;
|
||||
|
||||
@@ -17,8 +17,8 @@ const styles = StyleSheet.create({
|
||||
flexDirection: 'row'
|
||||
},
|
||||
image: {
|
||||
width: 60,
|
||||
height: 60,
|
||||
width: 300,
|
||||
height: 200,
|
||||
backgroundColor: 'transparent',
|
||||
marginRight: 10
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ import React from 'react';
|
||||
import sources from '../sources';
|
||||
|
||||
const ImageOnLoadExample = () => (
|
||||
<NetworkImage logMethod="onLoad" source={createUncachedURI(sources.small)} />
|
||||
<NetworkImage logMethod="onLoad" source={createUncachedURI(sources.largeAlt)} />
|
||||
);
|
||||
|
||||
export default ImageOnLoadExample;
|
||||
|
||||
@@ -8,7 +8,7 @@ import React from 'react';
|
||||
import sources from '../sources';
|
||||
|
||||
const ImageOnLoadEndExample = () => (
|
||||
<NetworkImage logMethod="onLoadEnd" source={createUncachedURI(sources.small)} />
|
||||
<NetworkImage logMethod="onLoadEnd" source={createUncachedURI(sources.largeAlt)} />
|
||||
);
|
||||
|
||||
export default ImageOnLoadEndExample;
|
||||
|
||||
@@ -8,7 +8,7 @@ import React from 'react';
|
||||
import sources from '../sources';
|
||||
|
||||
const ImageOnLoadStartExample = () => (
|
||||
<NetworkImage logMethod="onLoadStart" source={createUncachedURI(sources.small)} />
|
||||
<NetworkImage logMethod="onLoadStart" source={createUncachedURI(sources.largeAlt)} />
|
||||
);
|
||||
|
||||
export default ImageOnLoadStartExample;
|
||||
|
||||
@@ -8,7 +8,7 @@ import { Image, StyleSheet, Text, View } from 'react-native';
|
||||
|
||||
const ImageResizeModeExample = () => (
|
||||
<View>
|
||||
{[sources.small, sources.large].map((source, i) => {
|
||||
{[sources.small].map((source, i) => {
|
||||
return (
|
||||
<View key={i}>
|
||||
<View style={styles.horizontal}>
|
||||
@@ -60,12 +60,11 @@ const styles = StyleSheet.create({
|
||||
resizeMode: {
|
||||
borderColor: 'black',
|
||||
borderWidth: 0.5,
|
||||
height: 60,
|
||||
width: 90
|
||||
height: 120,
|
||||
width: 120
|
||||
},
|
||||
resizeModeText: {
|
||||
fontSize: 11,
|
||||
marginBottom: 3
|
||||
marginBottom: '0.5rem'
|
||||
},
|
||||
leftMargin: {
|
||||
marginLeft: 10
|
||||
|
||||
@@ -30,18 +30,22 @@ const ImageSourceExample = () => (
|
||||
const styles = StyleSheet.create({
|
||||
row: {
|
||||
flexDirection: 'row',
|
||||
flexWrap: 'wrap'
|
||||
flexWrap: 'wrap',
|
||||
justifyContent: 'space-between'
|
||||
},
|
||||
column: {
|
||||
marginRight: '1rem'
|
||||
alignItems: 'flex-start',
|
||||
marginBottom: '1rem'
|
||||
},
|
||||
text: {
|
||||
marginBottom: '0.5rem'
|
||||
},
|
||||
image: {
|
||||
flex: 1,
|
||||
height: 50,
|
||||
resizeMode: 'contain'
|
||||
borderColor: 'black',
|
||||
borderWidth: 0.5,
|
||||
height: 120,
|
||||
width: 120,
|
||||
resizeMode: 'cover'
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -13,8 +13,8 @@ const createUncachedURI = source => {
|
||||
|
||||
const styles = StyleSheet.create({
|
||||
base: {
|
||||
height: 38,
|
||||
width: 38
|
||||
height: 200,
|
||||
width: 300
|
||||
},
|
||||
row: {
|
||||
flexDirection: 'row'
|
||||
@@ -22,8 +22,8 @@ const styles = StyleSheet.create({
|
||||
centerRow: {
|
||||
alignItems: 'center'
|
||||
},
|
||||
marginLeft: {
|
||||
marginLeft: '1rem'
|
||||
marginTop: {
|
||||
marginTop: '1rem'
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 18 KiB |
@@ -1,5 +1,5 @@
|
||||
import placeholder from './bunny.png';
|
||||
import staticImage from './uie_thumb_normal@2x.png';
|
||||
import placeholder from './placeholder.jpg';
|
||||
import staticImage from './ladybug.jpg';
|
||||
|
||||
const dataPng =
|
||||
'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEsAAABLCAQAAACSR7JhAAADtUlE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bV1zh3hYkgyFGSTKPfRVbRqWWVReaxYeSLarYv1Qqsmh1s95S7G+eEWK0f3jYKTbV6bOwepjfhtafsvUsqrQvrGC8YhmnO9cSCk3yuY984F1vesdHYhWJ5FvASlacshUsajFt2mUM9pqzvKGcyNJW0arTKN1GGGzQlH0tXwLDgQTurS8eIQAAAABJRU5ErkJggg==';
|
||||
@@ -12,11 +12,27 @@ const sources = {
|
||||
'http://38.media.tumblr.com/9e9bd08c6e2d10561dd1fb4197df4c4e/tumblr_mfqekpMktw1rn90umo1_500.gif'
|
||||
},
|
||||
broken: { uri: 'http://TYPO_ERROR.github.io/image.png' },
|
||||
small: { uri: 'http://facebook.github.io/react/img/logo_small_2x.png' },
|
||||
large: { uri: 'http://facebook.github.io/react/img/logo_og.png' },
|
||||
largeAlt: { uri: 'http://facebook.github.io/origami/public/images/birds.jpg' },
|
||||
small: {
|
||||
uri:
|
||||
'https://images.unsplash.com/photo-1488584585634-35fc98ccb808?dpr=1&auto=format&fit=crop&w=100&h=66&q=60&cs=tinysrgb'
|
||||
},
|
||||
smallAlt: {
|
||||
uri:
|
||||
'https://images.unsplash.com/photo-1481595357459-84468f6eeaac?dpr=1&auto=format&fit=crop&w=100&h=66&q=60&cs=tinysrgb'
|
||||
},
|
||||
large: {
|
||||
uri:
|
||||
'https://images.unsplash.com/photo-1481595357459-84468f6eeaac?dpr=1&auto=format&fit=crop&w=376&h=251&q=60&cs=tinysrgb'
|
||||
},
|
||||
largeAlt: {
|
||||
uri:
|
||||
'https://images.unsplash.com/photo-1471145653077-54c6f0aae511?dpr=1&auto=format&fit=crop&w=376&h=251&q=60&cs=tinysrgb'
|
||||
},
|
||||
placeholder,
|
||||
prefetchable: { uri: 'http://origami.design/public/images/bird-logo.png' },
|
||||
prefetchable: {
|
||||
uri:
|
||||
'https://images.unsplash.com/photo-1471145653077-54c6f0aae511?dpr=1&auto=format&fit=crop&w=376&h=251&q=60&cs=tinysrgb'
|
||||
},
|
||||
static: staticImage,
|
||||
huge: {
|
||||
uri: 'https://upload.wikimedia.org/wikipedia/commons/d/d7/Chestnut-mandibled_Toucan.jpg'
|
||||
|
||||
BIN
docs/storybook/1-components/Image/sources/ladybug.jpg
Normal file
BIN
docs/storybook/1-components/Image/sources/ladybug.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 77 KiB |
BIN
docs/storybook/1-components/Image/sources/placeholder.jpg
Normal file
BIN
docs/storybook/1-components/Image/sources/placeholder.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 19 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 850 B |
Binary file not shown.
|
Before Width: | Height: | Size: 1.1 KiB |
Reference in New Issue
Block a user