How to create button in React Native

In this React Native source code example, we are going to learn how to create a button in React Native.

This is a source code example you can copy and adopt to your React Native project without reinventing the wheels.

import React, {Component} from 'react';
import {StyleSheet,View, Button} from 'react-native';

export default class App extends Component {
  render() {
    return (
      <View style={styles.container}>
          <Button
            title="MyButton"
            color="hotpink"
            />
      </View>
    );
  }
}

const styles = StyleSheet.create({
  container: {
    flex: 1,
    justifyContent: 'center',
    alignItems: 'center',
    backgroundColor: '#ddd',
  },
});

If you have any questions or suggestions kindly use the comment box or you can contact us directly through our contact page below.

 

Add a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.