Releases: NoriginMedia/react-spatial-navigation
Improvements for Throttle behaviour
Fixed
- Key up triggers .cancel() instead of .flush()
Added
- Throttling now applies leading/trailing options
Throttle Improvements
Fixed:
- Throttling is now only applied if the throttle option supplied was greater than 0
Added: - Key up now flushes any throttled input
Added onArrowPress prop
Added onArrowPress
property, which enables to add a custom behaviour when arrows are pressed and can prevent the default navigation.
Fixes for lastFocusedChildKey
Previously lastFocusedChildKey
was saved for the parent only during the directional navigation, but not when you manually set focus to some another component with setFocus
. Now is saved for all parents on any navigation event .
Throttle
Added support for Native environments
In this release we added support for native environments. This service might be used in the "sync" mode, to trigger "focused" state changes after native engine sets the focus to some elements. In this mode the only way to set the focus is to use stealFocus
method. setFocus
method is disabled. Also certain "imperative" features like layout measurements, coordinates calculations etc. are disabled because the native engine is the only one who decides what to focus. Please read the documentation for examples of usage in Native mode.
Patch: improvements for adjacent elements priority
Small improvement to apply adjacent slice priority to the elements with zero distance from the current one.
New navigation algorithm
In this release we improved the navigation algorithm and made it even smarter. Also we removed the "propagateFocus" prop since it was always used for items with focusable children in most of the cases anyway.
Added Preferred Child focus key
- Added
preferredChildFocusKey
property to set focus on a specific component during focus propagation - Save parent
lastFocusedChildKey
when a new component is focused
Fixed implicit logic for setFocus()
Before if we are setting focus and explicitly specifying focus key, if that component didn't exist in the focusableComponents, it was falling back to own focus key. This logic is not necessary.