From 65b6d209d9095efba2bc1d6f2098fae8b127e1c7 Mon Sep 17 00:00:00 2001 From: Spencer Ahrens Date: Fri, 17 Apr 2015 15:37:07 -0700 Subject: [PATCH] [ReactNative] cleanup some requireNativeComponent cruft --- Libraries/Components/ScrollView/ScrollView.js | 4 --- Libraries/Components/SliderIOS/SliderIOS.js | 21 +----------- Libraries/Image/Image.ios.js | 34 ++----------------- 3 files changed, 3 insertions(+), 56 deletions(-) diff --git a/Libraries/Components/ScrollView/ScrollView.js b/Libraries/Components/ScrollView/ScrollView.js index 0308688b5..e66612b22 100644 --- a/Libraries/Components/ScrollView/ScrollView.js +++ b/Libraries/Components/ScrollView/ScrollView.js @@ -371,10 +371,6 @@ if (Platform.OS === 'android') { uiViewClassName: 'AndroidHorizontalScrollView', }); } else if (Platform.OS === 'ios') { - var RCTScrollView = createReactIOSNativeComponentClass({ - validAttributes: validAttributes, - uiViewClassName: 'RCTScrollView', - }); var RCTScrollView = requireNativeComponent('RCTScrollView', ScrollView); } diff --git a/Libraries/Components/SliderIOS/SliderIOS.js b/Libraries/Components/SliderIOS/SliderIOS.js index 81815ba34..0c2d02da0 100644 --- a/Libraries/Components/SliderIOS/SliderIOS.js +++ b/Libraries/Components/SliderIOS/SliderIOS.js @@ -12,16 +12,11 @@ 'use strict'; var NativeMethodsMixin = require('NativeMethodsMixin'); -var Platform = require('Platform'); var PropTypes = require('ReactPropTypes'); var React = require('React'); -var ReactIOSViewAttributes = require('ReactIOSViewAttributes'); var StyleSheet = require('StyleSheet'); var View = require('View'); -var createReactIOSNativeComponentClass = - require('createReactIOSNativeComponentClass'); -var merge = require('merge'); var requireNativeComponent = require('requireNativeComponent'); type Event = Object; @@ -98,20 +93,6 @@ var styles = StyleSheet.create({ }, }); -if (Platform.OS === 'ios') { - var RCTSlider = requireNativeComponent('RCTSlider', SliderIOS); -} else { - var validAttributes = { - ...ReactIOSViewAttributes.UIView, - value: true, - minimumValue: true, - maximumValue: true, - }; - - var RCTSlider = createReactIOSNativeComponentClass({ - validAttributes: validAttributes, - uiViewClassName: 'RCTSlider', - }); -} +var RCTSlider = requireNativeComponent('RCTSlider', SliderIOS); module.exports = SliderIOS; diff --git a/Libraries/Image/Image.ios.js b/Libraries/Image/Image.ios.js index fed358e13..d519c1ac5 100644 --- a/Libraries/Image/Image.ios.js +++ b/Libraries/Image/Image.ios.js @@ -14,7 +14,6 @@ var EdgeInsetsPropType = require('EdgeInsetsPropType'); var NativeMethodsMixin = require('NativeMethodsMixin'); var NativeModules = require('NativeModules'); -var Platform = require('Platform'); var PropTypes = require('ReactPropTypes'); var ImageResizeMode = require('ImageResizeMode'); var ImageStylePropTypes = require('ImageStylePropTypes'); @@ -23,9 +22,7 @@ var ReactIOSViewAttributes = require('ReactIOSViewAttributes'); var StyleSheet = require('StyleSheet'); var StyleSheetPropType = require('StyleSheetPropType'); -var createReactIOSNativeComponentClass = require('createReactIOSNativeComponentClass'); var flattenStyle = require('flattenStyle'); -var insetsDiffer = require('insetsDiffer'); var invariant = require('invariant'); var merge = require('merge'); var requireNativeComponent = require('requireNativeComponent'); @@ -156,12 +153,6 @@ var Image = React.createClass({ contentMode, tintColor: style.tintColor, }); - if (Platform.OS === 'android') { - // TODO: update android native code to not need this - nativeProps.resizeMode = contentMode; - delete nativeProps.contentMode; - } - if (isStored) { nativeProps.imageTag = source.uri; } else { @@ -180,30 +171,9 @@ var styles = StyleSheet.create({ }, }); -if (Platform.OS === 'android') { - var CommonImageViewAttributes = merge(ReactIOSViewAttributes.UIView, { - accessible: true, - accessibilityLabel: true, - capInsets: {diff: insetsDiffer}, // UIEdgeInsets=UIEdgeInsetsZero - imageTag: true, - resizeMode: true, - src: true, - testID: PropTypes.string, - }); +var RCTStaticImage = requireNativeComponent('RCTStaticImage', null); +var RCTNetworkImage = requireNativeComponent('RCTNetworkImageView', null); - var RCTStaticImage = createReactIOSNativeComponentClass({ - validAttributes: merge(CommonImageViewAttributes, { tintColor: true }), - uiViewClassName: 'RCTStaticImage', - }); - - var RCTNetworkImage = createReactIOSNativeComponentClass({ - validAttributes: merge(CommonImageViewAttributes, { defaultImageSrc: true }), - uiViewClassName: 'RCTNetworkImageView', - }); -} else { - var RCTStaticImage = requireNativeComponent('RCTStaticImage', null); - var RCTNetworkImage = requireNativeComponent('RCTNetworkImageView', null); -} var nativeOnlyProps = { src: true, defaultImageSrc: true,