Minor Changes
-
#1883
0c0bdffThanks @bataevvlad! - Resolve component styles on demand instead of expanding every appearance, variant and state combination whenApplicationProvidermounts.Runtime mapping processing used to build all 4051 style entries of the Eva mapping (about 1.8 MB) before the first frame, which took ~350 ms on a Pixel 7 emulator with Hermes and seconds on low-end Android phones.
ApplicationProvidernow builds a per-component resolver that compiles a single combination the first time a component asks for it and memoizes it. Startup cost drops to under 10 ms; the compiled styles are identical, and thestylesprop produced by@ui-kitten/metro-configkeeps working unchanged.@ui-kitten/processornow exportscreateStyle,needsAllVariantCasesandMetaProcessor, which the resolver uses.Per-render work is reduced as well:
-
Every interactive component now presses through
Pressableinstead ofTouchableOpacity. UI Kitten paints its own press, hover and focus states, so the opacity animationTouchableOpacityset up on every render did nothing visible and cost up to a quarter of render time. Public props are unchanged (onMouseEnter/onMouseLeavemap to Pressable's hover events); refs now point at aView, andactiveOpacityis ignored. -
Exported components are wrapped in
React.memo. A parent re-render with referentially equal props no longer re-renders them; theme changes still reach them. Inline callbacks, element children and render-prop accessories keep re-rendering as before, so hoist or memoize those to benefit.Check for in-place mutation. Because props are compared shallowly, a component whose data is mutated in place no longer re-renders:
items.push(item); setCount(count + 1)leaves aList,Menu,SelectorDrawershowing the olditems, andrange.endDate = dateleaves aRangeCalendarunchanged. Create a new array or object instead (setItems([...items, item]),setRange({ ...range, endDate: date })), which is how React expects state to change anyway. Code that already follows that rule needs no change. -
Theme compilation and style resolution use plain loops instead of
reducewith object spread. -
Component trees are shallower:
TouchableWebrenders thePressableitself, a label whose parent already resolved the full text style (Button, CheckBox, Toggle, Radio, ...) is a plain React NativeTextinstead of a second styledText, and empty accessory or label slots render nothing. Refs fromTouchableWebkeep pointing at the same class instance. -
Popover(andTooltip,Select,Datepicker,OverflowMenuthrough it) mounts its measurement and modal machinery the first time it becomes visible, so a screen full of closed popovers costs only the anchors.
-
Patch Changes
-
#1883
2e817dbThanks @bataevvlad! - Keepfocusable={false}touchables out of the keyboard tab order on web. react-native-web'sPressablealways sets an explicittabIndex, which overrodefocusable, so the tap-forwarding wrapper aroundInputhad become an extra Tab stop before the text field. -
Updated dependencies [
0c0bdff]:- @ui-kitten/processor@6.1.0