mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-05-18 04:13:51 +08:00
NavigationExperimental: Avoid double push on double-tap in UIExplorer
Reviewed By: javache Differential Revision: D3033918 fb-gh-sync-id: 9085db138754f1aa557f0190456529e5e71ac27b shipit-source-id: 9085db138754f1aa557f0190456529e5e71ac27b
This commit is contained in:
committed by
Facebook Github Bot 1
parent
c304364af4
commit
30166c52cb
@@ -36,8 +36,12 @@ export type UIExplorerNavigationState = {
|
||||
};
|
||||
|
||||
const UIExplorerStackReducer = StackReducer({
|
||||
getPushedReducerForAction: (action) => {
|
||||
getPushedReducerForAction: (action, lastState) => {
|
||||
if (action.type === 'UIExplorerExampleAction' && UIExplorerList.Modules[action.openExample]) {
|
||||
if (lastState.children.find(child => child.key === action.openExample)) {
|
||||
// The example is already open, we should avoid pushing examples twice
|
||||
return null;
|
||||
}
|
||||
return (state) => state || {key: action.openExample};
|
||||
}
|
||||
return null;
|
||||
|
||||
Reference in New Issue
Block a user