Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to create text border in React Native?

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?

like image 211
henkimon Avatar asked Oct 03 '15 16:10

henkimon


People also ask

How do I add a border to text in react native?

To set a border, you must first set borderWidth. borderWidth is the size of the border, and it's always a number. You can either set a borderWidth that applies to the entire component or choose which borderWidth you want to set specifically (top, right, bottom, or left).

How do I add a border in React?

Use the border css property to set the border style of an element in React, e.g. <div style={{border: '1px solid rgba(0,255,0,0.3)'}}> . If you only need to style a specific border, use the corresponding property, e.g. borderBottom . Copied!

How do I show borders in react native?

In react native there are view's style property to set individual side width. You can use borderTopWidth for Top Border. borderBottomWidth for bottom border, borderLeftWidth for left border and borderRightWidth for right border. If you use single property borderWidth then it will apply to all four side of view.


2 Answers

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:

borderColor string borderTopColor string borderRightColor string borderBottomColor string borderLeftColor string borderRadius number borderTopLeftRadius number borderTopRightRadius number borderBottomLeftRadius number borderBottomRightRadius number borderStyle enum('solid', 'dotted', 'dashed') borderWidth number borderTopWidth number borderRightWidth number borderBottomWidth number borderLeftWidth number 
like image 90
webwelten Avatar answered Sep 23 '22 06:09

webwelten


you can emulator border as two attributes :

textShadowColor color textShadowOffset {width: number, height: number} 

Ex:

textshadow:{     fontSize:100,     color:'#FFFFFF',     fontFamily:'Times New Roman',     paddingLeft:30,     paddingRight:30,     textShadowColor:'#585858',     textShadowOffset:{width: 5, height: 5},     textShadowRadius:10,   },
like image 44
Trần Hồng Điệp Avatar answered Sep 23 '22 06:09

Trần Hồng Điệp