In my React Native project, I am aiming to replicate a layout that I successfully implemented in HTML+CSS on the web:
https://i.sstatic.net/vpbER.png
The challenging part is getting the gray breadcrumb element to align horizontally with the description. Here is the code snippet I have for the breadcrumb and description section:
<Text style={styles.description}>
<Text style={styles.quantity}>{quantity}</Text>
{description}
</Text>
styles.ts:
description: {
fontSize: 14,
fontFamily: 'light',
flexDirection: 'row',
flexWrap: 'wrap',
},
quantity: {
fontSize: 13,
color: Color.white,
backgroundColor: Color.placeholder,
borderRadius: 16,
paddingHorizontal: 400,
},
However, this implementation leads to the following outcome:
https://i.sstatic.net/HqTCj.png
Unfortunately, the borderRadius
and padding
properties seem to be disregarded for the quantity
element.
I also experimented with using View
elements instead of Text
, but the description text consistently wrapped onto a new line when it exceeded the container width (displaying typical block behavior).
Is there any clever workaround or method to achieve this desired layout in React Native? Your insights would be greatly appreciated. Thank you.