Skip to content

Commit 68a4761

Browse files
Brian Vaughnfacebook-github-bot
Brian Vaughn
authored andcommitted
Name a bunch of anonymous RN contexts
Summary: Changelog: [General] [Changed] - Added (DEV-only) `displayName` to some RN contexts to make them more easy to differentiate when debugging. Reviewed By: lunaleaps Differential Revision: D24993068 fbshipit-source-id: 4904259eda50444c2f74700a3540ff4fd02ac322
1 parent bbd0f03 commit 68a4761

File tree

6 files changed

+24
-2
lines changed

6 files changed

+24
-2
lines changed

Libraries/Components/ScrollView/ScrollViewContext.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@ import * as React from 'react';
1515
type Value = {horizontal: boolean} | null;
1616

1717
const ScrollViewContext: React.Context<Value> = React.createContext(null);
18-
18+
if (__DEV__) {
19+
ScrollViewContext.displayName = 'ScrollViewContext';
20+
}
1921
export default ScrollViewContext;
2022

2123
export const HORIZONTAL: Value = Object.freeze({horizontal: true});

Libraries/Image/ImageAnalyticsTagContext.js

+4
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,8 @@ const Context: React.Context<ContextType> = React.createContext<ContextType>(
1818
null,
1919
);
2020

21+
if (__DEV__) {
22+
Context.displayName = 'ImageAnalyticsTagContext';
23+
}
24+
2125
export default Context;

Libraries/Lists/VirtualizedListContext.js

+3
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,9 @@ type Context = $ReadOnly<{
6969
export const VirtualizedListContext: React.Context<?Context> = React.createContext(
7070
null,
7171
);
72+
if (__DEV__) {
73+
VirtualizedListContext.displayName = 'VirtualizedListContext';
74+
}
7275

7376
/**
7477
* Resets the context. Intended for use by portal-like components (e.g. Modal).

Libraries/ReactNative/RootTag.js

+4
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,10 @@ export const RootTagContext: React$Context<RootTag> = React.createContext<RootTa
1919
0,
2020
);
2121

22+
if (__DEV__) {
23+
RootTagContext.displayName = 'RootTagContext';
24+
}
25+
2226
/**
2327
* Intended to only be used by `AppContainer`.
2428
*/

Libraries/Text/TextAncestor.js

+7-1
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,10 @@ const React = require('react');
1515
/**
1616
* Whether the current element is the descendant of a <Text> element.
1717
*/
18-
module.exports = (React.createContext(false): React$Context<$FlowFixMe>);
18+
const TextAncestorContext = (React.createContext(
19+
false,
20+
): React$Context<$FlowFixMe>);
21+
if (__DEV__) {
22+
TextAncestorContext.displayName = 'TextAncestorContext';
23+
}
24+
module.exports = TextAncestorContext;

Libraries/Utilities/PerformanceLoggerContext.js

+3
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,7 @@ import type {IPerformanceLogger} from './createPerformanceLogger';
2323
const PerformanceLoggerContext: React.Context<IPerformanceLogger> = React.createContext(
2424
GlobalPerformanceLogger,
2525
);
26+
if (__DEV__) {
27+
PerformanceLoggerContext.displayName = 'PerformanceLoggerContext';
28+
}
2629
module.exports = PerformanceLoggerContext;

0 commit comments

Comments
 (0)