79745698

Date: 2025-08-25 11:44:18
Score: 1
Natty:
Report link

https://blog.logrocket.com/create-style-custom-buttons-react-native/ use this tutorial, using TouchableOpacity from react-native

Using <TouchableOpacity /> to create custom button components

Now that you’ve set up the main screen, it’s time to turn your attention to the custom button component.

const AppButton = props => (
    // ...
)

Name the custom button component AppButton.

Import the <TouchableOpacity /> and <Text /> components from react-native.

import { View, Button, StyleSheet, TouchableOpacity, Text } from "react-native";

To create custom buttons, you need to customize the <TouchableOpacity /> component and include the <Text /> component inside of it to display the button text.

const AppButton = ({ onPress, title }) => (
  <TouchableOpacity onPress={onPress} style={styles.appButtonContainer}>
    <Text style={styles.appButtonText}>{title}</Text>
  </TouchableOpacity>
);
Reasons:
  • Blacklisted phrase (1): this tutorial
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Low reputation (1):
Posted by: Henrique Vazquez