Skip to content
This repository was archived by the owner on May 5, 2023. It is now read-only.

Commit f74bad2

Browse files
authored
Fix scroll animations issue (#66)
* update layouts before navigating * 2.12.2 * updated changelog * typo * updated changelog
1 parent 8620d4a commit f74bad2

File tree

4 files changed

+10
-6
lines changed

4 files changed

+10
-6
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file.
44
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
55
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
66

7+
## [2.12.2]
8+
### Changed
9+
- update layouts at the beginning of smartNavigate instead of after setFocus
10+
711
## [2.12.1]
812
### Fixed
913
- Fixed regression with using `autoRestoreFocus` on components that are focused + getting unmounted and don't have parent

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@noriginmedia/react-spatial-navigation",
3-
"version": "2.12.1",
3+
"version": "2.12.2",
44
"description": "HOC-based Spatial Navigation (key navigation) solution for React",
55
"main": "dist/index.js",
66
"files": [

src/spatialNavigation.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -537,6 +537,10 @@ class SpatialNavigation {
537537
this.log('smartNavigate', 'fromParentFocusKey', fromParentFocusKey);
538538
this.log('smartNavigate', 'this.focusKey', this.focusKey);
539539

540+
if (!this.nativeMode && !fromParentFocusKey) {
541+
this.updateAllLayouts();
542+
}
543+
540544
const currentComponent = this.focusableComponents[fromParentFocusKey || this.focusKey];
541545

542546
this.log(
@@ -946,10 +950,6 @@ class SpatialNavigation {
946950
this.setCurrentFocusedKey(newFocusKey, details);
947951
this.updateParentsHasFocusedChild(newFocusKey, details);
948952
this.updateParentsLastFocusedChild(lastFocusedKey);
949-
950-
if (!this.nativeMode) {
951-
this.updateAllLayouts();
952-
}
953953
}
954954

955955
updateAllLayouts() {

0 commit comments

Comments
 (0)