Skip to content

Rename findHostInstance_deprecated to findHostInstance_DEPRECATED #17228

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 30, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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