Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to blur text in React Native

The question is simple. I have a View with a Text component in it. I just want this text to be blurred initially. The only solution I saw to blur something in React Native is for an Image via this "react-native-blur".

How can we blur a Text component in React Native?

Info: I just want to make an app where the user does not see the answer directly (via blurring).

like image 598
Jan D.M. Avatar asked Oct 23 '25 17:10

Jan D.M.


2 Answers

If you don't want to install react-native-blur / expo-blur or it's not working for you, this is a workaround/hack that mimics the look of blurred text in a View. The values can be adjusted as necessary.

<View
  style={{
    height: 3,
    width: 70,
    shadowOpacity: 1,
    shadowColor: '#000',
    shadowOffset: { width: 10, height: 10 },
    shadowRadius: 5,
    elevation: 5,
    borderWidth: 0.5,
    borderColor: "white",
    backgroundColor: "rgba(255, 255, 255, 1)"
  }}
/>

like image 74
Scott Avatar answered Oct 26 '25 05:10

Scott


You can simply use css to do it, feel free you change the amount of opacity, offset, color, radius as your requirement

        <Text
          style={{
            color: "#fff0",
            textShadowColor: "rgba(255,255,255,0.8)",
            textShadowOffset: {
              width: 0,
              height: 0,
            },
            textShadowRadius: 10,
            fontSize: 14,
            fontWeight: "600",
            textTransform: "capitalize",
          }}
        >
         Blurred

        </Text>
like image 31
Rahul Shakya Avatar answered Oct 26 '25 07:10

Rahul Shakya



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!