Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

how to align text inside react component

'use strict';

var React = require('react-native');
var {
  AppRegistry,
  StyleSheet,
  Text,
  Image,
  View,
} = React;

var SampleApp = React.createClass({
  render: function() {
    return (
            <View style={styles.container}>
                <View style={styles.topBox}>
                    <Text style={styles.headline}>lorem ipsum{'
'}ipsum lorem lorem</Text>

                </View>
                <View style={styles.otherContainer}>
                </View>
            </View>
    );
  }
});

var styles = StyleSheet.create({

    container: {
        flex: 1,
        flexDirection: 'column',
        backgroundColor: 'red',
        justifyContent: 'center',
        alignItems: 'center',
    },

    topBox: {
        flex: 1,
        flexDirection: 'row',
        backgroundColor: 'lightgray',
        justifyContent: 'center',
        alignItems: 'center',
    },
    headline: {
        fontWeight: 'bold',
        fontSize: 18,
    marginTop: 0,
        width: 200,
        height: 80,
    backgroundColor: 'yellow',
        justifyContent: 'center',
        alignItems: 'center',
    },

  otherContainer: {
        flex: 4,
        justifyContent: 'center',
        alignItems: 'center',
    backgroundColor: 'green',
    },


});

AppRegistry.registerComponent('SampleApp', () => SampleApp);

module.exports = SampleApp;
Comment

PREVIOUS NEXT
Code Example
Javascript :: condition inner populate mongoose 
Javascript :: send mail in node js without password 
Javascript :: angular 6 key value pair getvalue example 
Javascript :: Xpath select Parent Node Based On Child Node 
Javascript :: next day date javascript 
Javascript :: install php7 runtime brackets 
Javascript :: bcrypt nodejs hash password 
Javascript :: how to login with api in react js 
Javascript :: firebase admin delete user 
Javascript :: how to get day, month and year javascript 
Javascript :: javascript window 
Javascript :: javascript resize window 
Javascript :: clearing cookie in js 
Javascript :: react useid hook 
Javascript :: lodash sort json 
Javascript :: react-dom and babel cdn 
Javascript :: array join 
Javascript :: how to change the first 3 letters from a string toupper case 
Javascript :: window on resize 
Javascript :: innertext javascript 
Javascript :: jquery multiple div click 
Javascript :: react hooks component re render when button press 
Javascript :: JavaScript Split the string into an array of characters 
Javascript :: iterate through an array 
Javascript :: react-native date time picker 
Javascript :: Error: ENOENT: no such file or directory, mkdir 
Javascript :: javascript hello world program 
Javascript :: unique array in javascript 
Javascript :: image view component react js 
Javascript :: react scroll direction 
ADD CONTENT
Topic
Content
Source link
Name
8+2 =