Don't pass additional args to requireNativeComponent in .android.js files

Reviewed By: sahrens

Differential Revision: D8345921

fbshipit-source-id: 187048ad4c1b361f0b99b993052bdcaf47a266db
This commit is contained in:
Eli White 2018-06-10 15:34:37 -07:00 committed by Facebook Github Bot
parent 6b1bb01804
commit a51e8b19cc
11 changed files with 17 additions and 100 deletions

View File

@ -18,6 +18,8 @@ const ViewPropTypes = require('ViewPropTypes');
const createReactClass = require('create-react-class');
const requireNativeComponent = require('requireNativeComponent');
const RCTCheckBox = requireNativeComponent('AndroidCheckBox');
type DefaultProps = {
value: boolean,
disabled: boolean,
@ -155,12 +157,4 @@ let styles = StyleSheet.create({
},
});
let RCTCheckBox = requireNativeComponent('AndroidCheckBox', CheckBox, {
nativeOnly: {
onChange: true,
on: true,
enabled: true,
},
});
module.exports = CheckBox;

View File

@ -321,9 +321,6 @@ const styles = StyleSheet.create({
});
// The View that contains both the actual drawer and the main view
const AndroidDrawerLayout = requireNativeComponent(
'AndroidDrawerLayout',
DrawerLayoutAndroid,
);
const AndroidDrawerLayout = requireNativeComponent('AndroidDrawerLayout');
module.exports = DrawerLayoutAndroid;

View File

@ -21,6 +21,9 @@ const ViewStylePropTypes = require('ViewStylePropTypes');
const processColor = require('processColor');
const requireNativeComponent = require('requireNativeComponent');
const DropdownPicker = requireNativeComponent('AndroidDropdownPicker');
const DialogPicker = requireNativeComponent('AndroidDialogPicker');
const REF_PICKER = 'picker';
const MODE_DROPDOWN = 'dropdown';
@ -158,22 +161,4 @@ const styles = StyleSheet.create({
},
});
const cfg = {
nativeOnly: {
items: true,
selected: true,
},
};
const DropdownPicker = requireNativeComponent(
'AndroidDropdownPicker',
PickerAndroid,
cfg,
);
const DialogPicker = requireNativeComponent(
'AndroidDialogPicker',
PickerAndroid,
cfg,
);
module.exports = PickerAndroid;

View File

@ -12,7 +12,6 @@
const ColorPropType = require('ColorPropType');
const PropTypes = require('prop-types');
const React = require('React');
const ReactNative = require('ReactNative');
const ViewPropTypes = require('ViewPropTypes');
const requireNativeComponent = require('requireNativeComponent');
@ -115,15 +114,7 @@ class ProgressBarAndroid extends React.Component {
}
}
const AndroidProgressBar = requireNativeComponent(
'AndroidProgressBar',
ProgressBarAndroid,
{
nativeOnly: {
animating: true,
},
},
);
const AndroidProgressBar = requireNativeComponent('AndroidProgressBar');
module.exports = React.forwardRef((props, ref) => (
<ProgressBarAndroid {...props} forwardedRef={ref} />

View File

@ -143,6 +143,6 @@ const styles = StyleSheet.create({
},
});
const RCTTabBarItem = requireNativeComponent('RCTTabBarItem', TabBarItemIOS);
const RCTTabBarItem = requireNativeComponent('RCTTabBarItem');
module.exports = TabBarItemIOS;

View File

@ -13,7 +13,6 @@ const Image = require('Image');
const NativeMethodsMixin = require('NativeMethodsMixin');
const React = require('React');
const PropTypes = require('prop-types');
const ReactNativeViewAttributes = require('ReactNativeViewAttributes');
const UIManager = require('UIManager');
const ViewPropTypes = require('ViewPropTypes');
const ColorPropType = require('ColorPropType');
@ -207,10 +206,6 @@ const ToolbarAndroid = createReactClass({
},
});
const NativeToolbar = requireNativeComponent('ToolbarAndroid', ToolbarAndroid, {
nativeOnly: {
nativeActions: true,
},
});
const NativeToolbar = requireNativeComponent('ToolbarAndroid');
module.exports = ToolbarAndroid;

View File

@ -19,6 +19,8 @@ const ViewPropTypes = require('ViewPropTypes');
const dismissKeyboard = require('dismissKeyboard');
const requireNativeComponent = require('requireNativeComponent');
const NativeAndroidViewPager = requireNativeComponent('AndroidViewPager');
const VIEWPAGER_REF = 'viewPager';
type Event = Object;
@ -255,9 +257,4 @@ class ViewPagerAndroid extends React.Component<{
}
}
const NativeAndroidViewPager = requireNativeComponent(
'AndroidViewPager',
ViewPagerAndroid,
);
module.exports = ViewPagerAndroid;

View File

@ -43,14 +43,6 @@ const defaultRenderLoading = () => (
* Renders a native WebView.
*/
class WebView extends React.Component {
static get extraNativeComponentConfig() {
return {
nativeOnly: {
messagingEnabled: PropTypes.bool,
},
};
}
static propTypes = {
...ViewPropTypes,
renderError: PropTypes.func,
@ -464,11 +456,7 @@ class WebView extends React.Component {
};
}
const RCTWebView = requireNativeComponent(
'RCTWebView',
WebView,
WebView.extraNativeComponentConfig,
);
const RCTWebView = requireNativeComponent('RCTWebView');
const styles = StyleSheet.create({
container: {

View File

@ -109,18 +109,6 @@ const defaultRenderError = (errorDomain, errorCode, errorDesc) => (
class WebView extends React.Component {
static JSNavigationScheme = JSNavigationScheme;
static NavigationType = NavigationType;
static get extraNativeComponentConfig() {
return {
nativeOnly: {
onLoadingStart: true,
onLoadingError: true,
onLoadingFinish: true,
onMessage: true,
messagingEnabled: PropTypes.bool,
},
};
}
static propTypes = {
...ViewPropTypes,
@ -651,11 +639,7 @@ class WebView extends React.Component {
};
}
const RCTWebView = requireNativeComponent(
'RCTWebView',
WebView,
WebView.extraNativeComponentConfig,
);
const RCTWebView = requireNativeComponent('RCTWebView');
const styles = StyleSheet.create({
container: {

View File

@ -29,6 +29,9 @@ const resolveAssetSource = require('resolveAssetSource');
const {ImageLoader} = NativeModules;
const RKImage = requireNativeComponent('RCTImageView');
const RCTTextInlineImage = requireNativeComponent('RCTTextInlineImage');
let _requestId = 1;
function generateRequestId() {
return _requestId++;
@ -278,20 +281,4 @@ const styles = StyleSheet.create({
},
});
const cfg = {
nativeOnly: {
src: true,
headers: true,
defaultSrc: true,
loadingIndicatorSrc: true,
shouldNotifyLoadEvents: true,
},
};
const RKImage = requireNativeComponent('RCTImageView', Image, cfg);
const RCTTextInlineImage = requireNativeComponent(
'RCTTextInlineImage',
Image,
cfg,
);
module.exports = Image;

View File

@ -11,14 +11,13 @@
var BatchedBridge = require('BatchedBridge');
var React = require('React');
var ReactNativeViewAttributes = require('ReactNativeViewAttributes');
var ScrollView = require('ScrollView');
var StyleSheet = require('StyleSheet');
var View = require('View');
var requireNativeComponent = require('requireNativeComponent');
var ClippableView = requireNativeComponent('ClippableView', null);
var ClippableView = requireNativeComponent('ClippableView');
class ClippingSample1 extends React.Component {
render() {