Prefix _context property on returned ReactContext from createContext - it's private (#12501)

This commit is contained in:
Mateusz Burzyński
2018-04-03 01:47:25 +01:00
committed by Dan Abramov
parent 6f2ea73978
commit ba245f6f9b
5 changed files with 7 additions and 7 deletions
+2 -2
View File
@@ -675,7 +675,7 @@ class ReactDOMServerRenderer {
pushProvider<T>(provider: ReactProvider<T>): void {
this.providerIndex += 1;
this.providerStack[this.providerIndex] = provider;
const context: ReactContext<any> = provider.type.context;
const context: ReactContext<any> = provider.type._context;
context._currentValue = provider.props.value;
}
@@ -689,7 +689,7 @@ class ReactDOMServerRenderer {
}
this.providerStack[this.providerIndex] = null;
this.providerIndex -= 1;
const context: ReactContext<any> = provider.type.context;
const context: ReactContext<any> = provider.type._context;
if (this.providerIndex < 0) {
context._currentValue = context._defaultValue;
} else {
+1 -1
View File
@@ -868,7 +868,7 @@ export default function<T, P, I, TI, HI, PI, C, CC, CX, PL>(
renderExpirationTime,
) {
const providerType: ReactProviderType<any> = workInProgress.type;
const context: ReactContext<any> = providerType.context;
const context: ReactContext<any> = providerType._context;
const newProps = workInProgress.pendingProps;
const oldProps = workInProgress.memoizedProps;
+2 -2
View File
@@ -32,7 +32,7 @@ export default function(stack: Stack) {
}
function pushProvider(providerFiber: Fiber): void {
const context: ReactContext<any> = providerFiber.type.context;
const context: ReactContext<any> = providerFiber.type._context;
push(changedBitsCursor, context._changedBits, providerFiber);
push(valueCursor, context._currentValue, providerFiber);
@@ -60,7 +60,7 @@ export default function(stack: Stack) {
pop(valueCursor, providerFiber);
pop(changedBitsCursor, providerFiber);
const context: ReactContext<any> = providerFiber.type.context;
const context: ReactContext<any> = providerFiber.type._context;
context._currentValue = currentValue;
context._changedBits = changedBits;
}
+1 -1
View File
@@ -44,7 +44,7 @@ export function createContext<T>(
context.Provider = {
$$typeof: REACT_PROVIDER_TYPE,
context,
_context: context,
};
context.Consumer = context;
+1 -1
View File
@@ -62,7 +62,7 @@ export type ReactProvider<T> = {
export type ReactProviderType<T> = {
$$typeof: Symbol | number,
context: ReactContext<T>,
_context: ReactContext<T>,
};
export type ReactConsumer<T> = {