This code snippet will create a smooth triangle shape on various platforms:
https://i.sstatic.net/m3TFb.png
You can customize the borderWidth and borderColor properties to achieve different triangle styles.
Sample
<View style={{
width: 0,
height: 0,
borderStyle: 'solid',
overflow: 'hidden',
borderTopWidth: 6,
borderRightWidth: 4,
borderBottomWidth: 0,
borderLeftWidth: 4,
borderTopColor:'blue',
borderRightColor: 'transparent',
borderBottomColor: 'transparent',
borderLeftColor: 'transparent',)}
}} />
Example
const CustomMarker = () => (
<View style={styles.shadowWrapper}>
<View
style={styles.backgroundMarkerView()}>
<Text
style={styles.selectedText()}>
CUSTOM_TEXT
</Text>
</View>
<View style={styles.arrowDown()} />
<View
style={styles.arrowDown2()}
/>
</View>
)
const styles = StyleSheet.create({
shadowWrapper: {alignItems: 'center', },
selectedText: (marginStart = 0, color = COLOR_BLACK_100) => ({
color,
...fontSize.fontSizeExtraSmall(),
...fonts.fontFamilyBold(),
lineHeight: 16,
marginStart,
}),
backgroundMarkerView: (backgroundColor = COLOR_SECONDARY) => ({
padding: 4,
borderRadius: 8,
backgroundColor,
borderWidth: 1,
borderColor: COLOR_WHITE,
}),
arrowDown: (borderTopColor = 'blue') => ({
width: 0,
height: 0,
borderStyle: 'solid',
overflow: 'hidden',
borderTopWidth: 6,
borderRightWidth: 4,
borderBottomWidth: 0,
borderLeftWidth: 4,
borderTopColor,
borderRightColor: 'transparent',
borderBottomColor: 'transparent',
borderLeftColor: 'transparent',
}),
arrowDown2: (borderTopColor = 'blue') => ({
width: 0,
height: 0,
borderStyle: 'solid',
overflow: 'hidden',
borderTopWidth: 5,
borderRightWidth: 3,
borderBottomWidth: 0,
borderLeftWidth: 3,
borderTopColor,
borderRightColor: 'transparent',
borderBottomColor: 'transparent',
borderLeftColor: 'transparent',
marginTop: -7,
}),
})