* fix: stop leaking CSS rules from dynamic position styles * Fix floating surfaces on web * Stop diff controls growing Unistyles rules * Use inline style escape hatch in diff pane * Centralize dynamic style escape hatches * Restore startup workspace navigation * Upgrade Unistyles for web cleanup fix * Update review style test for inline styles * Use redirect for startup workspace restore * Update startup redirect test
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
const UNISTYLES_INLINE_STYLE_KEY = "unistyles_inline_style";
|
||||
|
||||
/**
|
||||
* Forces a style object through Unistyles' inline/animated-style lane.
|
||||
*
|
||||
* Unistyles web sends ordinary style objects to the CSS registry. Styles that
|
||||
* look like animated styles stay in React Native's style array instead. Use
|
||||
* this only for high-churn values, such as measured dimensions, drag
|
||||
* transforms, and pressed/hovered state.
|
||||
*/
|
||||
export function inlineUnistylesStyle<TStyle extends object>(style: TStyle): TStyle {
|
||||
if (!Object.isExtensible(style) || UNISTYLES_INLINE_STYLE_KEY in style) {
|
||||
return style;
|
||||
}
|
||||
|
||||
Object.defineProperty(style, UNISTYLES_INLINE_STYLE_KEY, {
|
||||
value: {},
|
||||
enumerable: true,
|
||||
configurable: true,
|
||||
});
|
||||
|
||||
return style;
|
||||
}
|
||||
Reference in New Issue
Block a user