mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Merge pull request #31492 from nadiia/0.65-stable-roottag-context
[AppContainer] Add back legacy rootTag childContex
This commit is contained in:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user