I'm a bit confused with handling different size of screens for app.
in android there is a unit named dp
that seems to handle screen size and resolution variation. i expect when i use this unit instead of pixels, i see same size component
(like button, ...) in every screen. e.g a button with size 20dp
must look same size in all screens.
in articles i read that React-Native uses dp
as its main unit as well. so expected the same thing here, but it's not working as i expected. a button with 20dp
aren't looking the same in different screens.
also there are articles in which they show how to handle different screen sizes, although they say RN using dp
they use some arithmetic logic to scale their components to each screen size.
e.g const scaleX = Dimension.getWidth() / baseWdith
=> simplified code
the flow is that, we make a UI with an specific base screen and make it look how we want it to be, and then we scale components later in new screens.
my question is that isn't dp
unit supposed to do the same thing!? why RN didn't handle autoscaling itself? if there is sth named dp
to manage screen sizes-ratio then why they doing manual scaling?