Rename findHostInstance_deprecated to findHostInstance_DEPRECATED (#17228)
Eli White committed
Oct 30, 2019 at 13:10 UTC
bdcdb69a24612a4a6d88c39937968c32066ed5a6
6 files changed
+26
-24
packages/react-native-renderer/src/ReactFabric.js
+3
-3
@@ -44,7 +44,7 @@ import warningWithoutStack from 'shared/warningWithoutStack';
44
45
const ReactCurrentOwner = ReactSharedInternals.ReactCurrentOwner;
46
47
-function findHostInstance_deprecated(
47
+function findHostInstance_DEPRECATED(
48
componentOrHandle: any,
49
): ?HostComponent<mixed> {
50
if (__DEV__) {
@@ -76,7 +76,7 @@ function findHostInstance_deprecated(
76
if (__DEV__) {
77
hostInstance = findHostInstanceWithWarning(
78
componentOrHandle,
79
- 'findHostInstance_deprecated',
79
+ 'findHostInstance_DEPRECATED',
80
);
81
} else {
82
hostInstance = findHostInstance(componentOrHandle);
@@ -158,7 +158,7 @@ const ReactFabric: ReactFabricType = {
158
159
// This is needed for implementation details of TouchableNativeFeedback
160
// Remove this once TouchableNativeFeedback doesn't use cloneElement
161
- findHostInstance_deprecated,
161
+ findHostInstance_DEPRECATED,
162
findNodeHandle,
163
164
dispatchCommand(handle: any, command: string, args: Array<any>) {
packages/react-native-renderer/src/ReactNativeRenderer.js
+3
-3
@@ -47,7 +47,7 @@ import warningWithoutStack from 'shared/warningWithoutStack';
47
48
const ReactCurrentOwner = ReactSharedInternals.ReactCurrentOwner;
49
50
-function findHostInstance_deprecated(
50
+function findHostInstance_DEPRECATED(
51
componentOrHandle: any,
52
): ?HostComponent<mixed> {
53
if (__DEV__) {
@@ -79,7 +79,7 @@ function findHostInstance_deprecated(
79
if (__DEV__) {
80
hostInstance = findHostInstanceWithWarning(
81
componentOrHandle,
82
- 'findHostInstance_deprecated',
82
+ 'findHostInstance_DEPRECATED',
83
);
84
} else {
85
hostInstance = findHostInstance(componentOrHandle);
@@ -167,7 +167,7 @@ const ReactNativeRenderer: ReactNativeType = {
167
168
// This is needed for implementation details of TouchableNativeFeedback
169
// Remove this once TouchableNativeFeedback doesn't use cloneElement
170
- findHostInstance_deprecated,
170
+ findHostInstance_DEPRECATED,
171
findNodeHandle,
172
173
dispatchCommand(handle: any, command: string, args: Array<any>) {
packages/react-native-renderer/src/ReactNativeTypes.js
+2
@@ -141,6 +141,7 @@ type SecretInternalsFabricType = {
141
*/
142
export type ReactNativeType = {
143
NativeComponent: typeof ReactNativeComponent,
144
+ findHostInstance_DEPRECATED(componentOrHandle: any): ?HostComponent<mixed>,
145
findNodeHandle(componentOrHandle: any): ?number,
146
dispatchCommand(handle: any, command: string, args: Array<any>): void,
147
render(
@@ -157,6 +158,7 @@ export type ReactNativeType = {
158
159
export type ReactFabricType = {
160
NativeComponent: typeof ReactNativeComponent,
161
+ findHostInstance_DEPRECATED(componentOrHandle: any): ?HostComponent<mixed>,
162
findNodeHandle(componentOrHandle: any): ?number,
163
dispatchCommand(handle: any, command: string, args: Array<any>): void,
164
render(
packages/react-native-renderer/src/__tests__/ReactFabric-test.internal.js
+8
-8
@@ -779,7 +779,7 @@ describe('ReactFabric', () => {
779
expect(touchStart2).toBeCalled();
780
});
781
782
- it('findHostInstance_deprecated should warn if used to find a host component inside StrictMode', () => {
782
+ it('findHostInstance_DEPRECATED should warn if used to find a host component inside StrictMode', () => {
783
const View = createReactNativeComponentClass('RCTView', () => ({
784
validAttributes: {foo: true},
785
uiViewClassName: 'RCTView',
@@ -802,10 +802,10 @@ describe('ReactFabric', () => {
802
803
let match;
804
expect(
805
- () => (match = ReactFabric.findHostInstance_deprecated(parent)),
805
+ () => (match = ReactFabric.findHostInstance_DEPRECATED(parent)),
806
).toWarnDev([
807
- 'Warning: findHostInstance_deprecated is deprecated in StrictMode. ' +
808
- 'findHostInstance_deprecated was passed an instance of ContainsStrictModeChild which renders StrictMode children. ' +
807
+ 'Warning: findHostInstance_DEPRECATED is deprecated in StrictMode. ' +
808
+ 'findHostInstance_DEPRECATED was passed an instance of ContainsStrictModeChild which renders StrictMode children. ' +
809
'Instead, add a ref directly to the element you want to reference. ' +
810
'Learn more about using refs safely here: ' +
811
'https://fb.me/react-strict-mode-find-node' +
@@ -816,7 +816,7 @@ describe('ReactFabric', () => {
816
expect(match).toBe(child);
817
});
818
819
- it('findHostInstance_deprecated should warn if passed a component that is inside StrictMode', () => {
819
+ it('findHostInstance_DEPRECATED should warn if passed a component that is inside StrictMode', () => {
820
const View = createReactNativeComponentClass('RCTView', () => ({
821
validAttributes: {foo: true},
822
uiViewClassName: 'RCTView',
@@ -840,10 +840,10 @@ describe('ReactFabric', () => {
840
841
let match;
842
expect(
843
- () => (match = ReactFabric.findHostInstance_deprecated(parent)),
843
+ () => (match = ReactFabric.findHostInstance_DEPRECATED(parent)),
844
).toWarnDev([
845
- 'Warning: findHostInstance_deprecated is deprecated in StrictMode. ' +
846
- 'findHostInstance_deprecated was passed an instance of IsInStrictMode which is inside StrictMode. ' +
845
+ 'Warning: findHostInstance_DEPRECATED is deprecated in StrictMode. ' +
846
+ 'findHostInstance_DEPRECATED was passed an instance of IsInStrictMode which is inside StrictMode. ' +
847
'Instead, add a ref directly to the element you want to reference. ' +
848
'Learn more about using refs safely here: ' +
849
'https://fb.me/react-strict-mode-find-node' +
packages/react-native-renderer/src/__tests__/ReactFabricAndNative-test.internal.js
+2
-2
@@ -50,7 +50,7 @@ describe('created with ReactFabric called with ReactNative', () => {
50
51
ReactFabric.render(<Component ref={ref} />, 11);
52
53
- let instance = ReactNative.findHostInstance_deprecated(ref.current);
53
+ let instance = ReactNative.findHostInstance_DEPRECATED(ref.current);
54
expect(instance._nativeTag).toBe(2);
55
});
56
@@ -130,7 +130,7 @@ describe('created with ReactNative called with ReactFabric', () => {
130
131
ReactNative.render(<Component ref={ref} />, 11);
132
133
- let instance = ReactFabric.findHostInstance_deprecated(ref.current);
133
+ let instance = ReactFabric.findHostInstance_DEPRECATED(ref.current);
134
expect(instance._nativeTag).toBe(3);
135
});
136
packages/react-native-renderer/src/__tests__/ReactNativeMount-test.internal.js
+8
-8
@@ -541,7 +541,7 @@ describe('ReactNative', () => {
541
);
542
});
543
544
- it('findHostInstance_deprecated should warn if used to find a host component inside StrictMode', () => {
544
+ it('findHostInstance_DEPRECATED should warn if used to find a host component inside StrictMode', () => {
545
const View = createReactNativeComponentClass('RCTView', () => ({
546
validAttributes: {foo: true},
547
uiViewClassName: 'RCTView',
@@ -564,10 +564,10 @@ describe('ReactNative', () => {
564
565
let match;
566
expect(
567
- () => (match = ReactNative.findHostInstance_deprecated(parent)),
567
+ () => (match = ReactNative.findHostInstance_DEPRECATED(parent)),
568
).toWarnDev([
569
- 'Warning: findHostInstance_deprecated is deprecated in StrictMode. ' +
570
- 'findHostInstance_deprecated was passed an instance of ContainsStrictModeChild which renders StrictMode children. ' +
569
+ 'Warning: findHostInstance_DEPRECATED is deprecated in StrictMode. ' +
570
+ 'findHostInstance_DEPRECATED was passed an instance of ContainsStrictModeChild which renders StrictMode children. ' +
571
'Instead, add a ref directly to the element you want to reference. ' +
572
'Learn more about using refs safely here: ' +
573
'https://fb.me/react-strict-mode-find-node' +
@@ -578,7 +578,7 @@ describe('ReactNative', () => {
578
expect(match).toBe(child);
579
});
580
581
- it('findHostInstance_deprecated should warn if passed a component that is inside StrictMode', () => {
581
+ it('findHostInstance_DEPRECATED should warn if passed a component that is inside StrictMode', () => {
582
const View = createReactNativeComponentClass('RCTView', () => ({
583
validAttributes: {foo: true},
584
uiViewClassName: 'RCTView',
@@ -602,10 +602,10 @@ describe('ReactNative', () => {
602
603
let match;
604
expect(
605
- () => (match = ReactNative.findHostInstance_deprecated(parent)),
605
+ () => (match = ReactNative.findHostInstance_DEPRECATED(parent)),
606
).toWarnDev([
607
- 'Warning: findHostInstance_deprecated is deprecated in StrictMode. ' +
608
- 'findHostInstance_deprecated was passed an instance of IsInStrictMode which is inside StrictMode. ' +
607
+ 'Warning: findHostInstance_DEPRECATED is deprecated in StrictMode. ' +
608
+ 'findHostInstance_DEPRECATED was passed an instance of IsInStrictMode which is inside StrictMode. ' +
609
'Instead, add a ref directly to the element you want to reference. ' +
610
'Learn more about using refs safely here: ' +
611
'https://fb.me/react-strict-mode-find-node' +