In React-Native, how do I add font borders to Text-components?
I've tried using border
and shadow{Color, Radius, Opacity, Offset}
, but haven't gotten that to work. Any suggestions?
In React-Native, how do I add font borders to Text-components?
I've tried using border
and shadow{Color, Radius, Opacity, Offset}
, but haven't gotten that to work. Any suggestions?
You need to at least set the borderWidth, it must be set to an integer. The default border color is black, you can change the color with borderColor
I needed to add a bottom border to
Text
component like this:I did the following:
the border is a
<View/>
inside another one withflexDirection : 'row'
here is my code:
and the style:
you can modify border size with flex.
The official docs have this information for you. You can find it on this site: Text Component. There it shows which props you can use to change the behaviour and style of the component. As you can see there are some specific Text styles but also the styles you can apply on a View Component. And if you follow that link it shows you the border styles. So, what you're looking for is maybe:
You need to set
borderColor
andborderWidth
.As noted by KChen, you need to add both borderColor and borderWidth. Just updating this answer for later versions of ReactNative (note the usage of 'styles.bigblue').
This was using a combination of the tutorial from Styles and ScrollView
you can emulator border as two attributes : textShadowColor color textShadowOffset {width: number, height: number}
Ex: