Delete ensureComponentIsNative.js

Summary:
This function was used by Touchable*. It was removed from the Touchables in D6494579 in 2017. The only remaining callsite was ImageBackground which is attaching a ref directly to the View so we know it is a native component.

This is needed for some setNativeProps cleanup

Reviewed By: sahrens

Differential Revision: D16796973

fbshipit-source-id: 19379094b3b91920efac4bf1969fc22d4b80bcc6
This commit is contained in:
Eli White
2019-08-14 11:46:58 -07:00
committed by Facebook Github Bot
parent d00f0882fb
commit 9a31fa5fd6
4 changed files with 0 additions and 35 deletions
@@ -1,23 +0,0 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @format
* @flow
*/
'use strict';
const invariant = require('invariant');
const ensureComponentIsNative = function(component: any) {
invariant(
component && typeof component.setNativeProps === 'function',
'Touchable child must either be native or forward setNativeProps to a ' +
'native component',
);
};
module.exports = ensureComponentIsNative;
@@ -17,12 +17,6 @@ const StyleSheet = require('../../StyleSheet/StyleSheet');
* View component and renders its children.
*/
class UnimplementedView extends React.Component<$FlowFixMeProps> {
setNativeProps() {
// Do nothing.
// This method is required in order to use this view as a Touchable* child.
// See ensureComponentIsNative.js for more info
}
render(): React.Node {
// Workaround require cycle from requireNativeComponent
const View = require('../View/View');
-3
View File
@@ -14,8 +14,6 @@ const React = require('react');
const StyleSheet = require('../StyleSheet/StyleSheet');
const View = require('../Components/View/View');
const ensureComponentIsNative = require('../Components/Touchable/ensureComponentIsNative');
/**
* Very simple drop-in replacement for <Image> which supports nesting views.
*
@@ -45,7 +43,6 @@ class ImageBackground extends React.Component<$FlowFixMeProps> {
// Work-around flow
const viewRef = this._viewRef;
if (viewRef) {
ensureComponentIsNative(viewRef);
viewRef.setNativeProps(props);
}
}
-3
View File
@@ -172,9 +172,6 @@ jest
return ReactNative;
})
.mock('../Libraries/Components/Touchable/ensureComponentIsNative', () => () =>
true,
)
// Mock modules defined by the native layer (ex: Objective-C, Java)
.mock('../Libraries/BatchedBridge/NativeModules', () => ({
AlertManager: {