I'm new to NativeBase and I'm overriding the default theme to obtain a custom one where I would like to use rem
units. I'm using the extendTheme
function as described in the docs:
const myCustomTheme = extendTheme({
sizes: {
0: 0,
1: 16,
2: 32,
// and so on
}
})
However, if I try to use it in an element, the sizing stays the same.
At the moment I created a workaround by using a function to mimic the same effect:
const rem = (r: number) => `${r * 16}px`
So I can
<Button mb={rem(2)}>My Button</Button>
But this is not very nice to use.
Do you know how could I use rem
units in a similar way without requiring this function, with a syntax like this
<Button mb={2}>My Button</Button>
or even better like this
<Button mb="2rem">My Button</Button>
that uses rem units?
I tested this only using the iOS simulator, so I don't know if it would have worked worked differently on Android or Web.