@@ -34,19 +34,27 @@ enables behavior; Button uses `selected !== undefined` to distinguish an ordinar
3434
3535Do not blindly inherit every root prop when the component owns part of the native contract.
3636
37- 1 . Start with the root native props .
37+ 1 . Start with ` PropsWithRefOf<typeof Root> ` so the native root's ref is part of the public contract .
38382 . Omit props the component controls, such as ` children ` or token-derived ` style ` .
39393 . Reintroduce a narrowed form only when consumers need it.
4040
41- Button uses ` Omit<PressableProps, 'children' | 'style'> ` and adds ` StyleProp<ViewStyle> ` back explicitly. This prevents
42- native children from bypassing slot order while preserving a user style that can be applied after component styles .
41+ Button uses ` OwnedRootProps<PropsWithRefOf<typeof Pressable>> ` . This prevents native children from bypassing slot order,
42+ preserves the native style type, and retains ` ref ` .
4343
4444Compose the final public props with:
4545
4646``` ts
4747export type MyComponentProps = MyComponentStateProps & ComponentProps <MyComponentSlots , ExposedRootProps >;
4848```
4949
50+ This package targets React 19.1.4 or newer, where function components receive ` ref ` as a prop. Let the state hook carry
51+ that prop to the declared root slot; do not wrap the component in ` forwardRef ` . A top-level component ref always targets
52+ the declared root. Consumers that need an inner public slot use that slot's own ` ref ` .
53+
54+ When a component needs an internal root ref as well, keep both refs and pass one through the resolved slot and the other
55+ when rendering the slot so Framework Base composes them. Never overwrite the consumer ref. If a primitive can render
56+ unrelated native instance types, omit a top-level ref unless it can define one sound, stable imperative contract.
57+
5058## Make resolved state complete
5159
5260Build state from:
@@ -89,5 +97,6 @@ internal style definitions.
8997- Variant unions match the spec exactly.
9098- Omitted and false values retain distinct semantics where required.
9199- Root native props cannot bypass owned children or style ordering.
100+ - Stable native roots expose a correctly typed ` ref ` , and the state/render pipeline does not replace it.
92101- Resolved state contains every defaulted and derived value needed downstream.
93102- Public component, state, style-application, render, and resolved-state exports are explicit and tree-shakeable.
0 commit comments