How to add a button in React Native?

后端 未结 9 688
暖寄归人
暖寄归人 2021-01-31 07:46

I´m confused with this whole \"no CSS\" thing, but I understand why it\'s beneficial. All I want to do is place a button in the middle of the screen but I don\'t understand how

9条回答
  •  遇见更好的自我
    2021-01-31 08:31

    import React, { Component } from 'react';
    import { StyleSheet, View, TouchableOpacity, Text} from 'react-native';
    var tapSpeed = React.createClass({
      render: function() {
        return (
          
            
              
                Tap me as fast as you can!
              
            
            
              !
            
          
        );
      }
    });
    
    var styles = StyleSheet.create({
      container: {
        flex: 1,
        justifyContent: 'center',
        flexDirection: 'column',
        alignItems: 'center',
        backgroundColor: '#FFCCCC'
      },
      welcome: {
        fontSize: 20,
        textAlign: 'center',
        margin: 10,
        alignSelf: 'center'
      },
      button: {
        justifyContent: 'center',
        alignItems: 'center',
        marginBottom: 7,
        border: 1px solid blue,
        borderRadius: 2px
      }
    });
    
    

提交回复
热议问题