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

Commit

Permalink
Fix scroll animations issue (#66)
Browse files Browse the repository at this point in the history
* update layouts before navigating

* 2.12.2

* updated changelog

* typo

* updated changelog
  • Loading branch information
salvan13 authored May 14, 2020
1 parent 8620d4a commit f74bad2
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 6 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [2.12.2]
### Changed
- update layouts at the beginning of smartNavigate instead of after setFocus

## [2.12.1]
### Fixed
- Fixed regression with using `autoRestoreFocus` on components that are focused + getting unmounted and don't have parent
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@noriginmedia/react-spatial-navigation",
"version": "2.12.1",
"version": "2.12.2",
"description": "HOC-based Spatial Navigation (key navigation) solution for React",
"main": "dist/index.js",
"files": [
Expand Down
8 changes: 4 additions & 4 deletions src/spatialNavigation.js
Original file line number Diff line number Diff line change
Expand Up @@ -537,6 +537,10 @@ class SpatialNavigation {
this.log('smartNavigate', 'fromParentFocusKey', fromParentFocusKey);
this.log('smartNavigate', 'this.focusKey', this.focusKey);

if (!this.nativeMode && !fromParentFocusKey) {
this.updateAllLayouts();
}

const currentComponent = this.focusableComponents[fromParentFocusKey || this.focusKey];

this.log(
Expand Down Expand Up @@ -946,10 +950,6 @@ class SpatialNavigation {
this.setCurrentFocusedKey(newFocusKey, details);
this.updateParentsHasFocusedChild(newFocusKey, details);
this.updateParentsLastFocusedChild(lastFocusedKey);

if (!this.nativeMode) {
this.updateAllLayouts();
}
}

updateAllLayouts() {
Expand Down

0 comments on commit f74bad2

Please sign in to comment.