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>
);