fix: try to fix #9631

This commit is contained in:
Satyajit Sahoo
2021-05-29 16:02:40 +02:00
parent a184ce24b3
commit b4d7b0ee86
3 changed files with 15 additions and 24 deletions

View File

@@ -18,6 +18,15 @@ import useDocumentTitle from './useDocumentTitle';
import useLinking from './useLinking';
import useThenable from './useThenable';
declare global {
var REACT_NAVIGATION_DEVTOOLS: WeakMap<
NavigationContainerRef<any>,
{ readonly linking: LinkingOptions<any> }
>;
}
global.REACT_NAVIGATION_DEVTOOLS = new WeakMap();
type Props<ParamList extends {}> = NavigationContainerProps & {
theme?: Theme;
linking?: LinkingOptions<ParamList>;
@@ -70,8 +79,8 @@ function NavigationContainerInner(
// This will be used by the devtools
React.useEffect(() => {
if (refContainer.current) {
Object.defineProperty(refContainer.current, '__linking', {
get() {
REACT_NAVIGATION_DEVTOOLS.set(refContainer.current, {
get linking() {
return {
...linking,
enabled: isLinkingEnabled,
@@ -82,7 +91,6 @@ function NavigationContainerInner(
linking?.getActionFromState ?? getActionFromState,
};
},
enumerable: false,
});
}
});