I am trying to horizontally centre an absolutely positioned component in React-Native which I do not know the width of.
In css I can do this with:
position: absolute;
left: 50%,
transform: translateX(-50%);
But when I do the equivalent in React-Native it only transforms left by 50 instead of 50%. Also because I'm trying to centre the navigation bar in Tab.Navigator I don't think I can wrap it in a parent component:
<Tab.Navigator
barStyle={{
position: "absolute",
width: "95%",
left: "50%",
transform: [{ translateX: "-200" }],
bottom: 5,
overflow: "hidden",
borderRadius: "50%",
}}
>
EDIT The component I am trying to centre is the <Tab.Navigator> navigation bar.