How to add a button in React Native?

后端 未结 9 677
暖寄归人
暖寄归人 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:39

    The react-native-button package provides a button that is styled like a native button. Install it with npm install react-native-button and use it in your component like this:

    var Button = require('react-native-button');
    
    var ExampleComponent = React.createClass({
      render() {
        return (
          
        );
      },
    
      _handlePress(event) {
        console.log('Pressed!');
      },
    });
    

提交回复
热议问题