mirror of
https://github.com/zhigang1992/react-native-web.git
synced 2026-04-24 04:25:27 +08:00
58 lines
1.4 KiB
JavaScript
58 lines
1.4 KiB
JavaScript
/* eslint-disable react/prop-types */
|
|
|
|
/**
|
|
* @flow
|
|
*/
|
|
|
|
import React from 'react';
|
|
import { Image, Text, View } from 'react-native';
|
|
|
|
const Entity = ({ children }) => (
|
|
<Text style={{ fontWeight: '500', color: '#527fe4' }}>{children}</Text>
|
|
);
|
|
|
|
const TextChildrenExample = () => (
|
|
<View>
|
|
<Text>
|
|
This text contains an inline blue view{' '}
|
|
<View style={{ width: 25, height: 25, backgroundColor: 'steelblue' }} /> and an inline image{' '}
|
|
<Image
|
|
source={{ uri: 'http://lorempixel.com/30/11' }}
|
|
style={{ width: 30, height: 11, resizeMode: 'cover' }}
|
|
/>
|
|
. Neat, huh?
|
|
</Text>
|
|
|
|
<View>
|
|
<Text>
|
|
(Normal text,
|
|
<Text style={{ fontWeight: 'bold' }}>
|
|
(and bold
|
|
<Text style={{ fontSize: 11, color: '#527fe4' }}>(and tiny inherited bold blue)</Text>
|
|
)
|
|
</Text>
|
|
)
|
|
</Text>
|
|
<Text style={{ opacity: 0.7 }}>
|
|
(opacity
|
|
<Text>
|
|
(is inherited
|
|
<Text style={{ opacity: 0.7 }}>
|
|
{'\n'}
|
|
(and accumulated
|
|
<Text style={{ backgroundColor: '#ffaaaa' }}>(and also applies to the background)</Text>
|
|
)
|
|
</Text>
|
|
)
|
|
</Text>
|
|
)
|
|
</Text>
|
|
<Text style={{ fontSize: 12 }}>
|
|
<Entity>Entity Name</Entity>
|
|
</Text>
|
|
</View>
|
|
</View>
|
|
);
|
|
|
|
export default TextChildrenExample;
|