我正在尝试改善自定义模态视图的动画性能。
通过使用.drawingGroup(),我设法做到了,但是我的TextField被禁用了。像这样:
并且我得到错误:'无法呈现PlatformViewRepresentableAdaptor <>的展平版本。
是否有解决此问题的方法?
注意:我使用的是标准TextField。
谢谢!
/// Composites this view's contents into an offscreen image before final
/// display.
///
/// Views backed by native platform views don't render into the image.
/// Instead, they log a warning and display a placeholder image to highlight
/// the error.
///
/// - Parameters:
/// - opaque: A Boolean value that indicates whether the image is opaque.
/// If `true`, the alpha channel of the image must be one.
/// - colorMode: The working color space and storage format of the image.
/// - Returns: A view that composites this view's contents into an offscreen
/// image before display.
public func drawingGroup(opaque: Bool = false, colorMode: ColorRenderingMode = .nonLinear) -> some View
解决方案不是将.drawingGroup
用于活动控件,而仅用于没有用户交互的UI元素。