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 createReactClass = require('create-react-class');
const requireNativeComponent = require('requireNativeComponent'); const requireNativeComponent = require('requireNativeComponent');
const RCTCheckBox = requireNativeComponent('AndroidCheckBox');
type DefaultProps = { type DefaultProps = {
value: boolean, value: boolean,
disabled: 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; 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 // The View that contains both the actual drawer and the main view
const AndroidDrawerLayout = requireNativeComponent( const AndroidDrawerLayout = requireNativeComponent('AndroidDrawerLayout');
'AndroidDrawerLayout',
DrawerLayoutAndroid,
);
module.exports = DrawerLayoutAndroid; module.exports = DrawerLayoutAndroid;

View File

@ -21,6 +21,9 @@ const ViewStylePropTypes = require('ViewStylePropTypes');
const processColor = require('processColor'); const processColor = require('processColor');
const requireNativeComponent = require('requireNativeComponent'); const requireNativeComponent = require('requireNativeComponent');
const DropdownPicker = requireNativeComponent('AndroidDropdownPicker');
const DialogPicker = requireNativeComponent('AndroidDialogPicker');
const REF_PICKER = 'picker'; const REF_PICKER = 'picker';
const MODE_DROPDOWN = 'dropdown'; 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; module.exports = PickerAndroid;

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -29,6 +29,9 @@ const resolveAssetSource = require('resolveAssetSource');
const {ImageLoader} = NativeModules; const {ImageLoader} = NativeModules;
const RKImage = requireNativeComponent('RCTImageView');
const RCTTextInlineImage = requireNativeComponent('RCTTextInlineImage');
let _requestId = 1; let _requestId = 1;
function generateRequestId() { function generateRequestId() {
return _requestId++; 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; module.exports = Image;

View File

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