Skip to content

Commit bdcdb69

Browse files
elicwhiteyungsters
authored andcommitted
Rename findHostInstance_deprecated to findHostInstance_DEPRECATED (#17228)
1 parent 515746c commit bdcdb69

File tree

6 files changed

+26
-24
lines changed

6 files changed

+26
-24
lines changed

packages/react-native-renderer/src/ReactFabric.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ import warningWithoutStack from 'shared/warningWithoutStack';
4444

4545
const ReactCurrentOwner = ReactSharedInternals.ReactCurrentOwner;
4646

47-
function findHostInstance_deprecated(
47+
function findHostInstance_DEPRECATED(
4848
componentOrHandle: any,
4949
): ?HostComponent<mixed> {
5050
if (__DEV__) {
@@ -76,7 +76,7 @@ function findHostInstance_deprecated(
7676
if (__DEV__) {
7777
hostInstance = findHostInstanceWithWarning(
7878
componentOrHandle,
79-
'findHostInstance_deprecated',
79+
'findHostInstance_DEPRECATED',
8080
);
8181
} else {
8282
hostInstance = findHostInstance(componentOrHandle);
@@ -158,7 +158,7 @@ const ReactFabric: ReactFabricType = {
158158

159159
// This is needed for implementation details of TouchableNativeFeedback
160160
// Remove this once TouchableNativeFeedback doesn't use cloneElement
161-
findHostInstance_deprecated,
161+
findHostInstance_DEPRECATED,
162162
findNodeHandle,
163163

164164
dispatchCommand(handle: any, command: string, args: Array<any>) {

packages/react-native-renderer/src/ReactNativeRenderer.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ import warningWithoutStack from 'shared/warningWithoutStack';
4747

4848
const ReactCurrentOwner = ReactSharedInternals.ReactCurrentOwner;
4949

50-
function findHostInstance_deprecated(
50+
function findHostInstance_DEPRECATED(
5151
componentOrHandle: any,
5252
): ?HostComponent<mixed> {
5353
if (__DEV__) {
@@ -79,7 +79,7 @@ function findHostInstance_deprecated(
7979
if (__DEV__) {
8080
hostInstance = findHostInstanceWithWarning(
8181
componentOrHandle,
82-
'findHostInstance_deprecated',
82+
'findHostInstance_DEPRECATED',
8383
);
8484
} else {
8585
hostInstance = findHostInstance(componentOrHandle);
@@ -167,7 +167,7 @@ const ReactNativeRenderer: ReactNativeType = {
167167

168168
// This is needed for implementation details of TouchableNativeFeedback
169169
// Remove this once TouchableNativeFeedback doesn't use cloneElement
170-
findHostInstance_deprecated,
170+
findHostInstance_DEPRECATED,
171171
findNodeHandle,
172172

173173
dispatchCommand(handle: any, command: string, args: Array<any>) {

packages/react-native-renderer/src/ReactNativeTypes.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,7 @@ type SecretInternalsFabricType = {
141141
*/
142142
export type ReactNativeType = {
143143
NativeComponent: typeof ReactNativeComponent,
144+
findHostInstance_DEPRECATED(componentOrHandle: any): ?HostComponent<mixed>,
144145
findNodeHandle(componentOrHandle: any): ?number,
145146
dispatchCommand(handle: any, command: string, args: Array<any>): void,
146147
render(
@@ -157,6 +158,7 @@ export type ReactNativeType = {
157158

158159
export type ReactFabricType = {
159160
NativeComponent: typeof ReactNativeComponent,
161+
findHostInstance_DEPRECATED(componentOrHandle: any): ?HostComponent<mixed>,
160162
findNodeHandle(componentOrHandle: any): ?number,
161163
dispatchCommand(handle: any, command: string, args: Array<any>): void,
162164
render(

packages/react-native-renderer/src/__tests__/ReactFabric-test.internal.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -779,7 +779,7 @@ describe('ReactFabric', () => {
779779
expect(touchStart2).toBeCalled();
780780
});
781781

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', () => {
783783
const View = createReactNativeComponentClass('RCTView', () => ({
784784
validAttributes: {foo: true},
785785
uiViewClassName: 'RCTView',
@@ -802,10 +802,10 @@ describe('ReactFabric', () => {
802802

803803
let match;
804804
expect(
805-
() => (match = ReactFabric.findHostInstance_deprecated(parent)),
805+
() => (match = ReactFabric.findHostInstance_DEPRECATED(parent)),
806806
).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. ' +
809809
'Instead, add a ref directly to the element you want to reference. ' +
810810
'Learn more about using refs safely here: ' +
811811
'https://fb.me/react-strict-mode-find-node' +
@@ -816,7 +816,7 @@ describe('ReactFabric', () => {
816816
expect(match).toBe(child);
817817
});
818818

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', () => {
820820
const View = createReactNativeComponentClass('RCTView', () => ({
821821
validAttributes: {foo: true},
822822
uiViewClassName: 'RCTView',
@@ -840,10 +840,10 @@ describe('ReactFabric', () => {
840840

841841
let match;
842842
expect(
843-
() => (match = ReactFabric.findHostInstance_deprecated(parent)),
843+
() => (match = ReactFabric.findHostInstance_DEPRECATED(parent)),
844844
).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. ' +
847847
'Instead, add a ref directly to the element you want to reference. ' +
848848
'Learn more about using refs safely here: ' +
849849
'https://fb.me/react-strict-mode-find-node' +

packages/react-native-renderer/src/__tests__/ReactFabricAndNative-test.internal.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ describe('created with ReactFabric called with ReactNative', () => {
5050

5151
ReactFabric.render(<Component ref={ref} />, 11);
5252

53-
let instance = ReactNative.findHostInstance_deprecated(ref.current);
53+
let instance = ReactNative.findHostInstance_DEPRECATED(ref.current);
5454
expect(instance._nativeTag).toBe(2);
5555
});
5656

@@ -130,7 +130,7 @@ describe('created with ReactNative called with ReactFabric', () => {
130130

131131
ReactNative.render(<Component ref={ref} />, 11);
132132

133-
let instance = ReactFabric.findHostInstance_deprecated(ref.current);
133+
let instance = ReactFabric.findHostInstance_DEPRECATED(ref.current);
134134
expect(instance._nativeTag).toBe(3);
135135
});
136136

packages/react-native-renderer/src/__tests__/ReactNativeMount-test.internal.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -541,7 +541,7 @@ describe('ReactNative', () => {
541541
);
542542
});
543543

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', () => {
545545
const View = createReactNativeComponentClass('RCTView', () => ({
546546
validAttributes: {foo: true},
547547
uiViewClassName: 'RCTView',
@@ -564,10 +564,10 @@ describe('ReactNative', () => {
564564

565565
let match;
566566
expect(
567-
() => (match = ReactNative.findHostInstance_deprecated(parent)),
567+
() => (match = ReactNative.findHostInstance_DEPRECATED(parent)),
568568
).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. ' +
571571
'Instead, add a ref directly to the element you want to reference. ' +
572572
'Learn more about using refs safely here: ' +
573573
'https://fb.me/react-strict-mode-find-node' +
@@ -578,7 +578,7 @@ describe('ReactNative', () => {
578578
expect(match).toBe(child);
579579
});
580580

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', () => {
582582
const View = createReactNativeComponentClass('RCTView', () => ({
583583
validAttributes: {foo: true},
584584
uiViewClassName: 'RCTView',
@@ -602,10 +602,10 @@ describe('ReactNative', () => {
602602

603603
let match;
604604
expect(
605-
() => (match = ReactNative.findHostInstance_deprecated(parent)),
605+
() => (match = ReactNative.findHostInstance_DEPRECATED(parent)),
606606
).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. ' +
609609
'Instead, add a ref directly to the element you want to reference. ' +
610610
'Learn more about using refs safely here: ' +
611611
'https://fb.me/react-strict-mode-find-node' +

0 commit comments

Comments
 (0)