File tree Expand file tree Collapse file tree 1 file changed +8
-5
lines changed Expand file tree Collapse file tree 1 file changed +8
-5
lines changed Original file line number Diff line number Diff line change @@ -122,13 +122,16 @@ extension UIKitBackend {
122122 }
123123
124124 public func naturalSize( of widget: Widget ) -> SIMD2 < Int > {
125- let size = widget. view. intrinsicContentSize
126- return SIMD2 (
127- Int ( size. width. rounded ( . awayFromZero) ) ,
128- Int ( size. height. rounded ( . awayFromZero) )
129- )
125+ let view = widget. view
126+
127+ // Use bounds if non-zero, otherwise fallback to screen size
128+ let width = view. bounds. width > 0 ? view. bounds. width : UIScreen . main. bounds. width
129+ let height = view. bounds. height > 0 ? view. bounds. height : UIScreen . main. bounds. height
130+
131+ return SIMD2 ( Int ( width. rounded ( . awayFromZero) ) , Int ( height. rounded ( . awayFromZero) ) )
130132 }
131133
134+
132135 public func setSize( of widget: Widget , to size: SIMD2 < Int > ) {
133136 widget. width = 1000
134137 widget. height = 1000
You can’t perform that action at this time.
0 commit comments