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\'
Is currently not working for android. Try wrap it within a <View style={{borderWidth: 1}}/>
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').
import React, { Component } from 'react';
import { AppRegistry, StyleSheet, ScrollView, Image, Text } from 'react-native';
export default class HelloWorldWithBorder extends Component {
render() {
return (
<ScrollView>
<Text style={styles.bigblue}>HelloWorld WithBorder</Text>
<Text style={styles.bigblue}>HelloWorld WithBorder</Text>
<Text style={styles.bigblue}>HelloWorld WithBorder</Text>
<Text style={styles.bigblue}>HelloWorld WithBorder</Text>
<Text style={styles.bigblue}>HelloWorld WithBorder</Text>
<Text style={styles.bigblue}>HelloWorld WithBorder</Text>
<Text style={styles.bigblue}>HelloWorld WithBorder</Text>
<Text style={styles.bigblue}>HelloWorld WithBorder</Text>
<Text style={styles.bigblue}>HelloWorld WithBorder</Text>
</ScrollView>
);
}
}
const styles = StyleSheet.create({
bigblue: {
color: 'blue',
fontWeight: 'bold',
fontSize: 20,
borderColor: 'black',
borderWidth: 1
}
});
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:
textshadow:{
fontSize:100,
color:'#FFFFFF',
fontFamily:'Times New Roman',
paddingLeft:30,
paddingRight:30,
textShadowColor:'#585858',
textShadowOffset:{width: 5, height: 5},
textShadowRadius:10,
},