Merge pull request #31492 from nadiia/0.65-stable-roottag-context

[AppContainer] Add back legacy rootTag childContex
This commit is contained in:
Eli White
2021-05-07 15:37:56 -07:00
committed by GitHub
+15
View File
@@ -14,8 +14,11 @@ import StyleSheet from '../StyleSheet/StyleSheet';
import {type EventSubscription} from '../vendor/emitter/EventEmitter';
import {RootTagContext, createRootTag} from './RootTag';
import type {RootTag} from './RootTag';
import PropTypes from 'prop-types';
import * as React from 'react';
type Context = {rootTag: number | RootTag, ...};
type Props = $ReadOnly<{|
children?: React.Node,
fabric?: boolean,
@@ -43,6 +46,18 @@ class AppContainer extends React.Component<Props, State> {
static getDerivedStateFromError: any = undefined;
static childContextTypes:
| any
| {|rootTag: React$PropType$Primitive<number>|} = {
rootTag: PropTypes.number,
};
getChildContext(): Context {
return {
rootTag: this.props.rootTag,
};
}
componentDidMount(): void {
if (__DEV__) {
if (!global.__RCTProfileIsProfiling) {