Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to apply styles on Alert.alert() in react native?

Tags:

react-native

I have this small segment of code

const createTwoButtonAlert = () =>
    Alert.alert(
      "Delete from store",
      "Are you sure you want to delete the product?",
      [
        {
          text: "Cancel",
          onPress: () => console.log("Cancel Pressed"),
          style: "cancel",
        },
        { text: "OK", onPress: () => deleteProduct() },
      ],
      { cancelable: false }
    );

And just wanna apply styles on "Delete from store", this line. Here is what I want to do :

style={{
                fontFamily: allFont.SFUI,
                color: allColor.blue,
                fontSize: wp(4.5),
              }}

Your help will be highly appreciated.

like image 338
STBox Avatar asked Oct 27 '25 04:10

STBox


1 Answers

Alert,Toast are native components that have limited styling on the js side of react native if you are insisting on using those you have to change Native code. my advise is either use a custom alert component or use react-native-modal

like image 118
Alireza tk Avatar answered Oct 29 '25 07:10

Alireza tk



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!