gpt4 book ai didi

css - react-native: 仅适用于 android/ios 的平台特定样式代码

转载 作者:行者123 更新时间:2023-11-28 00:05:11 25 4
gpt4 key购买 nike

我需要一个特定的样式来仅适用于 android 并且需要在 iOS 上无效。

我的代码片段有点像这样:

<CardItem
style={{
borderWidth: 0,
borderLeftWidth: 0,
borderRightWidth: 0,
borderTopLeftRadius: 10,
borderTopRightRadius: 10,
borderBottomLeftRadius: 0,
borderBottomRightRadius: 0,
backgroundColor: "#fff",
overflow: Platform.OS == "ios" ? "hidden":"auto"
}}
cardBody
>

我需要仅在 iOS 上 overflow hidden ,而在 android 上不需要任何影响。我使用过溢出:Platform.OS == "ios"吗? "hidden":"auto" ,但看起来不适合这种情况。

在这方面需要帮助。

最佳答案

Overflow 属性在 react-native 上没有 auto 值。那是枚举,有这些:

enum('visible', 'hidden', 'scroll')

为 android 设置可见而不是自动。 (这是默认值)

overflow: Platform.OS == "ios" ? "hidden": "visible"

应该可以。

关于css - react-native: 仅适用于 android/ios 的平台特定样式代码,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55743424/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com