【问题标题】:Correct Way of Calculating the iOS Content Inset in React NativeReact Native中计算iOS Content Inset的正确方法
【发布时间】:2021-04-17 14:01:22
【问题描述】:

在 react native 项目中计算内容插入 (https://developer.apple.com/documentation/uikit/uiscrollview/1619406-contentinset) 的正确方法是什么?

例如当您在应用程序/屏幕的根视图上使用 padding: 20 时,它与 iPhone 11 上的本机导航标题对齐。另一方面,在 iPhone 12 Pro 上,这些内容插图似乎不同,并且内容有偏移量:

我还发现了一个使用设备宽度的 5% 作为内容插入/填充的示例,但这仍然不适用于所有设备。

这是苹果设计指南(边距)中的外观:

https://developer.apple.com/design/human-interface-guidelines/ios/visual-design/adaptivity-and-layout/

【问题讨论】:

    标签: ios react-native


    【解决方案1】:

    由于我没有找到任何解决方案,因此我为它创建了一个小型库:https://github.com/dioncodes/react-native-layout-margins

    【讨论】:

    • 我实际上还不需要这个,但我想表达对创建一个库来解决您的问题的尊重。
    猜你喜欢
    • 2022-12-22
    • 2013-07-29
    • 1970-01-01
    • 2017-10-20
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多