Skip to content

Instantly share code, notes, and snippets.

@rajivnarayana
Created December 14, 2017 05:27
Show Gist options
  • Save rajivnarayana/2749921c38582ab4f872c31d810242aa to your computer and use it in GitHub Desktop.
Save rajivnarayana/2749921c38582ab4f872c31d810242aa to your computer and use it in GitHub Desktop.
A React native component to horizontally layout flexbox elements.
import React, { Component } from "react";
import { Text, View } from "react-native";
class HelloWorldComponent extends Component {
render() {
return <View style={{
flexDirection:"row",
backgroundColor : 'green',
justifyContent: 'space-around'
}}>
<Text style={{ backgroundColor:'red'}}>Float Left</Text>
<Text style={{}}>Center</Text>
<Text>Float Right</Text>
{/* <Text style={{ width:0, flexGrow: 1, backgroundColor:'yellow'}} numberOfLines={1} ellipsizeMode="middle">The quick brown fox jumped over the lazy dog.</Text> */}
</View>
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment