MCPcopy Create free account
hub / github.com/Effect-TS/effect / EffectUIHostedView

Interface EffectUIHostedView

packages/ui/native/apple/EffectUIHost.swift:22–44  ·  view source on GitHub ↗

A native view that JS renders by name with `Native.hostedView`. The view fills its element, padding included. Each axis the element's style leaves `auto` takes the view's `intrinsicContentSize`, which the host reads after every `update(_:)`. Call `EffectUIContext.invalidateSize()` when it changes a

Source from the content-addressed store, hash-verified

20/// host reads after every `update(_:)`. Call `EffectUIContext.invalidateSize()`
21/// when it changes at any other time.
22@MainActor
23public protocol EffectUIHostedView: EffectUIPlatformView {
24 /// Applies the props that changed, on the main thread.
25 ///
26 /// The first call has every prop the element sets. A removed prop arrives as
27 /// `NSNull`. A prop named `color` or ending in `Color` arrives as an
28 /// `NSColor` or `UIColor`, and the others as JSON values (`NSNumber`,
29 /// `NSString`, arrays and dictionaries).
30 func update(_ changed: [String: Any])
31
32 /// The view the element's React children mount in. Defaults to `nil`,
33 /// which draws them above the hosted view.
34 ///
35 /// It should hold only those children, as the host inserts each at its
36 /// index among the subviews. React lays them out from the element's
37 /// top-left corner, so the view should fill the hosted view. On macOS it
38 /// must be flipped (`isFlipped` returns `true`).
39 var contentView: EffectUIPlatformView? { get }
40
41 /// Runs a command JS sends with `Native.Host`'s `command`, on the main
42 /// thread. `args` holds JSON values. Does nothing by default.
43 func command(_ name: String, _ args: [Any])
44}
45
46public extension EffectUIHostedView {
47 var contentView: EffectUIPlatformView? {

Callers 15

movedFunction · 0.65
scrollingFunction · 0.65
VirtualList.tsFile · 0.65
releaseFunction · 0.65
compileFunction · 0.65
makeFunction · 0.65
updateMethod · 0.65
killQueryFunction · 0.65
runRawMethod · 0.65
makeRecorderFunction · 0.65

Implementers 11

EffectUICheckboxViewpackages/ui/native/macos/EffectUICheck
EffectUIWindowDragViewpackages/ui/native/macos/EffectUIWindo
EffectUISymbolViewpackages/ui/native/apple/EffectUISymbo
EffectUISwiftUIViewpackages/ui/native/apple/EffectUIHost.
EffectUIGlassViewpackages/ui/native/apple/EffectUIGlass
EffectUIProgressViewpackages/ui/native/apple/EffectUIProgr
EffectUISegmentedViewpackages/ui/native/apple/EffectUISegme
EffectUIButtonViewpackages/ui/native/apple/EffectUIButto
AppBadgeexamples/ui/native-macos/macos/EffectU
AppBadgeexamples/ui/native/plugins/AppBadge.sw
_EffectUIHostSlotpackages/ui/native/apple/EffectUIHost.

Calls

no outgoing calls

Tested by

no test coverage detected