Here is a simple workaround to fix this problem of text border going throughout the screen width. Wrap it in a View with flexDirection:"row".
<View style={{
flexDirection:"row"
}}>
<Text
style={{
borderBottomWidth:1,
paddingBottom:3
}}
>
My Text
</Text>
</View>
https://snack.expo.io/@ammarahmed/grounded-watermelon
For it to work on android and ios use the following method. You need to use TextInput for it to work. Whatever you want to write, write it in value and set editable to false
<View style={{
flexDirection:"row"
}}>
<TextInput
style={{
borderBottomWidth:1,
paddingBottom:3,
borderBottomColor:"black",
}}
editable={false}
value="My Text"
/>
</View>