I am working a easy app in React Native for each Android and IOS. I’ve a Textual content component inside a View component, the place the textual content component incorporates a star image within the type of a conditional string {merchandise.isFavourite ? “u2605”: “u2606”}. I need to middle this textual content inside the View with just one fashion between Android and IOS, however cannot discover a answer.
This is the present code I’ve acquired:
<View fashion={types.menuFavouriteStar} >
<Textual content
fashion={types.favouriteStar}
onPress={() => {
const newData = toggleFavourite(merchandise, information);
saveFavourites(newData.favouritesData);
setData(newData);
}}
>{merchandise.isFavourite ? "u2605": "u2606"}</Textual content>
</View>
with the types as follows:
menuFavouriteStar: {
width: 40,
top: 40,
place: "absolute",
high: "82%",
proper: "2%",
backgroundColor: "white",
borderRadius: 3
},
favouriteStar: {
fontSize: 25,
textAlign: "middle",
textAlignVertical: "middle"
}
I’ve messed round quite a bit with the css properties, but I can not discover one thing that works for each Android and IOs. Any suggestions? Or ought to I simply make 2 types for every OS?