Skip to content

Commit

Permalink
Rename findHostInstance_deprecated to findHostInstance_DEPRECATED (#1…
Browse files Browse the repository at this point in the history
  • Loading branch information
elicwhite authored and yungsters committed Oct 30, 2019
1 parent 515746c commit bdcdb69
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 24 deletions.
6 changes: 3 additions & 3 deletions packages/react-native-renderer/src/ReactFabric.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ import warningWithoutStack from 'shared/warningWithoutStack';

const ReactCurrentOwner = ReactSharedInternals.ReactCurrentOwner;

function findHostInstance_deprecated(
function findHostInstance_DEPRECATED(
componentOrHandle: any,
): ?HostComponent<mixed> {
if (__DEV__) {
Expand Down Expand Up @@ -76,7 +76,7 @@ function findHostInstance_deprecated(
if (__DEV__) {
hostInstance = findHostInstanceWithWarning(
componentOrHandle,
'findHostInstance_deprecated',
'findHostInstance_DEPRECATED',
);
} else {
hostInstance = findHostInstance(componentOrHandle);
Expand Down Expand Up @@ -158,7 +158,7 @@ const ReactFabric: ReactFabricType = {

// This is needed for implementation details of TouchableNativeFeedback
// Remove this once TouchableNativeFeedback doesn't use cloneElement
findHostInstance_deprecated,
findHostInstance_DEPRECATED,
findNodeHandle,

dispatchCommand(handle: any, command: string, args: Array<any>) {
Expand Down
6 changes: 3 additions & 3 deletions packages/react-native-renderer/src/ReactNativeRenderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ import warningWithoutStack from 'shared/warningWithoutStack';

const ReactCurrentOwner = ReactSharedInternals.ReactCurrentOwner;

function findHostInstance_deprecated(
function findHostInstance_DEPRECATED(
componentOrHandle: any,
): ?HostComponent<mixed> {
if (__DEV__) {
Expand Down Expand Up @@ -79,7 +79,7 @@ function findHostInstance_deprecated(
if (__DEV__) {
hostInstance = findHostInstanceWithWarning(
componentOrHandle,
'findHostInstance_deprecated',
'findHostInstance_DEPRECATED',
);
} else {
hostInstance = findHostInstance(componentOrHandle);
Expand Down Expand Up @@ -167,7 +167,7 @@ const ReactNativeRenderer: ReactNativeType = {

// This is needed for implementation details of TouchableNativeFeedback
// Remove this once TouchableNativeFeedback doesn't use cloneElement
findHostInstance_deprecated,
findHostInstance_DEPRECATED,
findNodeHandle,

dispatchCommand(handle: any, command: string, args: Array<any>) {
Expand Down
2 changes: 2 additions & 0 deletions packages/react-native-renderer/src/ReactNativeTypes.js
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ type SecretInternalsFabricType = {
*/
export type ReactNativeType = {
NativeComponent: typeof ReactNativeComponent,
findHostInstance_DEPRECATED(componentOrHandle: any): ?HostComponent<mixed>,
findNodeHandle(componentOrHandle: any): ?number,
dispatchCommand(handle: any, command: string, args: Array<any>): void,
render(
Expand All @@ -157,6 +158,7 @@ export type ReactNativeType = {

export type ReactFabricType = {
NativeComponent: typeof ReactNativeComponent,
findHostInstance_DEPRECATED(componentOrHandle: any): ?HostComponent<mixed>,
findNodeHandle(componentOrHandle: any): ?number,
dispatchCommand(handle: any, command: string, args: Array<any>): void,
render(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -779,7 +779,7 @@ describe('ReactFabric', () => {
expect(touchStart2).toBeCalled();
});

it('findHostInstance_deprecated should warn if used to find a host component inside StrictMode', () => {
it('findHostInstance_DEPRECATED should warn if used to find a host component inside StrictMode', () => {
const View = createReactNativeComponentClass('RCTView', () => ({
validAttributes: {foo: true},
uiViewClassName: 'RCTView',
Expand All @@ -802,10 +802,10 @@ describe('ReactFabric', () => {

let match;
expect(
() => (match = ReactFabric.findHostInstance_deprecated(parent)),
() => (match = ReactFabric.findHostInstance_DEPRECATED(parent)),
).toWarnDev([
'Warning: findHostInstance_deprecated is deprecated in StrictMode. ' +
'findHostInstance_deprecated was passed an instance of ContainsStrictModeChild which renders StrictMode children. ' +
'Warning: findHostInstance_DEPRECATED is deprecated in StrictMode. ' +
'findHostInstance_DEPRECATED was passed an instance of ContainsStrictModeChild which renders StrictMode children. ' +
'Instead, add a ref directly to the element you want to reference. ' +
'Learn more about using refs safely here: ' +
'https://fb.me/react-strict-mode-find-node' +
Expand All @@ -816,7 +816,7 @@ describe('ReactFabric', () => {
expect(match).toBe(child);
});

it('findHostInstance_deprecated should warn if passed a component that is inside StrictMode', () => {
it('findHostInstance_DEPRECATED should warn if passed a component that is inside StrictMode', () => {
const View = createReactNativeComponentClass('RCTView', () => ({
validAttributes: {foo: true},
uiViewClassName: 'RCTView',
Expand All @@ -840,10 +840,10 @@ describe('ReactFabric', () => {

let match;
expect(
() => (match = ReactFabric.findHostInstance_deprecated(parent)),
() => (match = ReactFabric.findHostInstance_DEPRECATED(parent)),
).toWarnDev([
'Warning: findHostInstance_deprecated is deprecated in StrictMode. ' +
'findHostInstance_deprecated was passed an instance of IsInStrictMode which is inside StrictMode. ' +
'Warning: findHostInstance_DEPRECATED is deprecated in StrictMode. ' +
'findHostInstance_DEPRECATED was passed an instance of IsInStrictMode which is inside StrictMode. ' +
'Instead, add a ref directly to the element you want to reference. ' +
'Learn more about using refs safely here: ' +
'https://fb.me/react-strict-mode-find-node' +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ describe('created with ReactFabric called with ReactNative', () => {

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

let instance = ReactNative.findHostInstance_deprecated(ref.current);
let instance = ReactNative.findHostInstance_DEPRECATED(ref.current);
expect(instance._nativeTag).toBe(2);
});

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

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

let instance = ReactFabric.findHostInstance_deprecated(ref.current);
let instance = ReactFabric.findHostInstance_DEPRECATED(ref.current);
expect(instance._nativeTag).toBe(3);
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -541,7 +541,7 @@ describe('ReactNative', () => {
);
});

it('findHostInstance_deprecated should warn if used to find a host component inside StrictMode', () => {
it('findHostInstance_DEPRECATED should warn if used to find a host component inside StrictMode', () => {
const View = createReactNativeComponentClass('RCTView', () => ({
validAttributes: {foo: true},
uiViewClassName: 'RCTView',
Expand All @@ -564,10 +564,10 @@ describe('ReactNative', () => {

let match;
expect(
() => (match = ReactNative.findHostInstance_deprecated(parent)),
() => (match = ReactNative.findHostInstance_DEPRECATED(parent)),
).toWarnDev([
'Warning: findHostInstance_deprecated is deprecated in StrictMode. ' +
'findHostInstance_deprecated was passed an instance of ContainsStrictModeChild which renders StrictMode children. ' +
'Warning: findHostInstance_DEPRECATED is deprecated in StrictMode. ' +
'findHostInstance_DEPRECATED was passed an instance of ContainsStrictModeChild which renders StrictMode children. ' +
'Instead, add a ref directly to the element you want to reference. ' +
'Learn more about using refs safely here: ' +
'https://fb.me/react-strict-mode-find-node' +
Expand All @@ -578,7 +578,7 @@ describe('ReactNative', () => {
expect(match).toBe(child);
});

it('findHostInstance_deprecated should warn if passed a component that is inside StrictMode', () => {
it('findHostInstance_DEPRECATED should warn if passed a component that is inside StrictMode', () => {
const View = createReactNativeComponentClass('RCTView', () => ({
validAttributes: {foo: true},
uiViewClassName: 'RCTView',
Expand All @@ -602,10 +602,10 @@ describe('ReactNative', () => {

let match;
expect(
() => (match = ReactNative.findHostInstance_deprecated(parent)),
() => (match = ReactNative.findHostInstance_DEPRECATED(parent)),
).toWarnDev([
'Warning: findHostInstance_deprecated is deprecated in StrictMode. ' +
'findHostInstance_deprecated was passed an instance of IsInStrictMode which is inside StrictMode. ' +
'Warning: findHostInstance_DEPRECATED is deprecated in StrictMode. ' +
'findHostInstance_DEPRECATED was passed an instance of IsInStrictMode which is inside StrictMode. ' +
'Instead, add a ref directly to the element you want to reference. ' +
'Learn more about using refs safely here: ' +
'https://fb.me/react-strict-mode-find-node' +
Expand Down

0 comments on commit bdcdb69

Please sign in to comment.