简体   繁体   English

在 Compose Multiplatform 中,DropDownMenu 在 commonMain 中不可用?

[英]In Compose Multiplatform, DropDownMenu is not available in commonMain?

Do I have to call it from specific platforms (in my case Android and desktop)?我是否必须从特定平台调用它(在我的例子中是 Android 和桌面)?

No, it's not available.不,它不可用。 It's because it has different API on these platforms.这是因为它在这些平台上有不同的 API。

On Android it has popupProperties parameter, which contains a lot of Android specific parameters, .eg dismissOnBackPress is meaningless on Desktop.Android上有popupProperties参数,里面包含了很多 Android 具体的参数, dismissOnBackPress在 Desktop 上是没有意义的。

On Desktop this parameter is replaced with only one of popupProperties properties - focusable .桌面上,此参数仅替换为popupProperties属性之一 - focusable

You can create your own version using expect / actual and reuse platform specific version with the needed parameters您可以使用expect / actual创建自己的版本,并使用所需参数重用平台特定版本

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM