Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3180003
D10020.id33903.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
2 KB
Referenced Files
None
Subscribers
None
D10020.id33903.diff
View Options
diff --git a/native/navigation/nav-from-redux-handler.react.js b/native/navigation/nav-from-redux-handler.react.js
--- a/native/navigation/nav-from-redux-handler.react.js
+++ b/native/navigation/nav-from-redux-handler.react.js
@@ -4,13 +4,16 @@
import { setNavStateActionType } from './action-types.js';
import { NavContext } from './navigation-context.js';
+import type { MonitorActionState } from '../redux/dev-tools.react.js';
import { useSelector } from '../redux/redux-utils.js';
const NavFromReduxHandler: React.ComponentType<{}> = React.memo<{}>(
function NavFromReduxHandler() {
const navContext = React.useContext(NavContext);
- const navStateInRedux = useSelector(state => state.navState);
+ const navStateInRedux = useSelector(
+ (state: MonitorActionState) => state.navState,
+ );
const dispatch = React.useMemo(() => {
if (!navContext) {
diff --git a/native/redux/dev-tools.react.js b/native/redux/dev-tools.react.js
--- a/native/redux/dev-tools.react.js
+++ b/native/redux/dev-tools.react.js
@@ -1,5 +1,6 @@
// @flow
+import type { NavigationState } from '@react-navigation/core';
import * as React from 'react';
import { actionLogger } from 'lib/utils/action-logger.js';
@@ -7,9 +8,18 @@
import { setReduxStateActionType } from './action-types.js';
import { useSelector } from './redux-utils.js';
+import type { AppState } from './state-types.js';
import { setNavStateActionType } from '../navigation/action-types.js';
import { NavContext } from '../navigation/navigation-context.js';
+type MonitorAction =
+ | { +type: 'DISPATCH', +state: string, ... }
+ | { +type: 'IMPORT', ... };
+export type MonitorActionState = $ReadOnly<{
+ ...AppState,
+ +navState: NavigationState,
+}>;
+
const DevTools: React.ComponentType<{}> = React.memo<{}>(function DevTools() {
const devToolsRef = React.useRef();
if (
@@ -79,7 +89,7 @@
);
const setInternalState = React.useCallback(
- state => {
+ (state: MonitorActionState) => {
const { navState, ...reduxState } = state;
if (navDispatch) {
navDispatch({
@@ -104,7 +114,7 @@
);
const handleActionFromMonitor = React.useCallback(
- monitorAction => {
+ (monitorAction: MonitorAction) => {
if (!devTools) {
return;
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Nov 9, 3:59 AM (20 h, 46 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2448418
Default Alt Text
D10020.id33903.diff (2 KB)
Attached To
Mode
D10020: [Flow202][native][skip-ci] [36/x] Type Redux state when it includes navState from dev tools
Attached
Detach File
Event Timeline
Log In to Comment