Reputation: 293
In normal css, dimensions like px, %, rem etc. works perfectly. But in react native, it throws an error.
Are there any possible ways to use these dimensions directly in react-native ?
Upvotes: 1
Views: 462
Reputation: 4252
REMs are a way of setting font-sizes based on the font-size of the root HTML element. react native is purely works on pixels. Different mobile screens have different pixel ratio .
pixelRatio documentation in react native
if you want text normalization in react native use my custom function in my open source project.
Upvotes: 2
Reputation: 12235
Suppose you want the width to be 50% of the View
so you can do <View style={{width:'50%'}} />
.
Hope its clear. Feel free for doubts.
Upvotes: 1