I am adding two element on the row
render() {
return (
<View style={{ flexDirection: 'row', justifyContent: 'center' }}>
<Icon
name='person'
color='#98999c'
onPress={this.handleClick.bind(this)} />
<Text style={ styles.header }>
{ 'User Name' }
</Text>
</View>
)
}
How can I add a space between them?
EDIT:
I also have the same problem here:
const AppNavigator = StackNavigator({
Home: {
screen: AppDrawer,
navigationOptions: ({navigation}) => ({
headerLeft:
<View style={{ flexDirection: 'row', justifyContent: 'space-between' }}>
<Icon name="menu" size={35} margin={30} padding={30} onPress={ () => navigation.navigate('DrawerOpen') } />
<ChangeLanguage style={{ margin: 30 , padding: 30}} />
</View>,
headerRight:
<HeaderUserInformation />,
})
}
Creating extra spaces before or after text To create extra spaces before, after, or in-between your text, use the (non-breaking space) extended HTML character. For example, with the phrasing "extra space" using a double space, we have the following code in our HTML.
character. The character creates a space that does not break into a new line. Two words that are separated by a non-breaking space always appear on the same line. The 	 and 	 characters create tab spaces in HTML.
The CSS padding properties are used to generate space around an element's content, inside of any defined borders. With CSS, you have full control over the padding. There are properties for setting the padding for each side of an element (top, right, bottom, and left).
You can use curly braces like an expression with both double quotes and single quotes for space i.e.,
{" "} or {' '}
You can also use ES6 template literals i.e.,
` <li></li>` or ` ${value}`
You can also use   like below
<span>sample text <span>
You can also use   in dangerouslySetInnerHTML when printing html content
<div dangerouslySetInnerHTML={{__html: 'sample html text: '}} />
Option 1:
justifyContent: 'space-between'
to the View
Option 2:
padding
/ margin
to either your Icon
or your Text
componentsI quite like using the short syntax for fragments:
<><strong>Foo</strong> </>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With