Skip to content

Commit

Permalink
Don't pass additional args to requireNativeComponent in .android.js f…
Browse files Browse the repository at this point in the history
…iles

Reviewed By: sahrens

Differential Revision: D8345921

fbshipit-source-id: 187048ad4c1b361f0b99b993052bdcaf47a266db
  • Loading branch information
elicwhite authored and facebook-github-bot committed Jun 10, 2018
1 parent 6b1bb01 commit a51e8b1
Show file tree
Hide file tree
Showing 11 changed files with 17 additions and 100 deletions.
10 changes: 2 additions & 8 deletions Libraries/Components/CheckBox/CheckBox.android.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -155,12 +157,4 @@ let styles = StyleSheet.create({
},
});

let RCTCheckBox = requireNativeComponent('AndroidCheckBox', CheckBox, {
nativeOnly: {
onChange: true,
on: true,
enabled: true,
},
});

module.exports = CheckBox;
Original file line number Diff line number Diff line change
Expand Up @@ -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;
21 changes: 3 additions & 18 deletions Libraries/Components/Picker/PickerAndroid.android.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand Down Expand Up @@ -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;
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down Expand Up @@ -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} />
Expand Down
2 changes: 1 addition & 1 deletion Libraries/Components/TabBarIOS/TabBarItemIOS.ios.js
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,6 @@ const styles = StyleSheet.create({
},
});

const RCTTabBarItem = requireNativeComponent('RCTTabBarItem', TabBarItemIOS);
const RCTTabBarItem = requireNativeComponent('RCTTabBarItem');

module.exports = TabBarItemIOS;
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down Expand Up @@ -207,10 +206,6 @@ const ToolbarAndroid = createReactClass({
},
});

const NativeToolbar = requireNativeComponent('ToolbarAndroid', ToolbarAndroid, {
nativeOnly: {
nativeActions: true,
},
});
const NativeToolbar = requireNativeComponent('ToolbarAndroid');

module.exports = ToolbarAndroid;
7 changes: 2 additions & 5 deletions Libraries/Components/ViewPager/ViewPagerAndroid.android.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -255,9 +257,4 @@ class ViewPagerAndroid extends React.Component<{
}
}

const NativeAndroidViewPager = requireNativeComponent(
'AndroidViewPager',
ViewPagerAndroid,
);

module.exports = ViewPagerAndroid;
14 changes: 1 addition & 13 deletions Libraries/Components/WebView/WebView.android.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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: {
Expand Down
18 changes: 1 addition & 17 deletions Libraries/Components/WebView/WebView.ios.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,

Expand Down Expand Up @@ -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: {
Expand Down
19 changes: 3 additions & 16 deletions Libraries/Image/Image.android.js
Original file line number Diff line number Diff line change
Expand Up @@ -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++;
Expand Down Expand Up @@ -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;
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down

0 comments on commit a51e8b1

Please sign in to comment.