what dimension units are used in React Native?

前端 未结 1 1965

When using React Native to define some styling dimensions do not have any units:

welcome: {
  fontSize: 20,
  margin: 10,
}

I assume the reason

1条回答
  •  执笔经年
    2021-02-07 14:15

    The units are logical pixels for iOS. See SO question here, which was answered by a contributor to React Native.

    For Android, the units are in DIP which is kinda similar to logical points in iOS (There is a nice write up on the subject). If you look at the source code here, you'll see that they convert the supplied value toPixelFromDIP.

    0 讨论(0)
提交回复
热议问题