diff --git a/Libraries/Components/RefreshControl/RefreshControl.js b/Libraries/Components/RefreshControl/RefreshControl.js index 319f054c3..1ae8119a1 100644 --- a/Libraries/Components/RefreshControl/RefreshControl.js +++ b/Libraries/Components/RefreshControl/RefreshControl.js @@ -13,6 +13,7 @@ const React = require('React'); const Platform = require('Platform'); const ColorPropType = require('ColorPropType'); +const View = require('View'); const requireNativeComponent = require('requireNativeComponent'); @@ -33,6 +34,7 @@ const RefreshControl = React.createClass({ }, propTypes: { + ...View.propTypes, /** * Called when the view starts refreshing. */ @@ -74,15 +76,7 @@ const RefreshControl = React.createClass({ }, render() { - if (Platform.OS === 'ios') { - return ; - } else { - // On Android the ScrollView is wrapped so this component doesn't render - // anything and only acts as a way to configure the wrapper view. - // ScrollView will wrap itself in a AndroidSwipeRefreshLayout using props - // from this. - return null; - } + return ; }, }); @@ -91,6 +85,11 @@ if (Platform.OS === 'ios') { 'RCTRefreshControl', RefreshControl ); +} else if (Platform.OS === 'android') { + var NativeRefreshControl = requireNativeComponent( + 'AndroidSwipeRefreshLayout', + RefreshControl + ); } module.exports = RefreshControl; diff --git a/Libraries/Components/ScrollView/ScrollView.js b/Libraries/Components/ScrollView/ScrollView.js index 89cc17921..623951b5e 100644 --- a/Libraries/Components/ScrollView/ScrollView.js +++ b/Libraries/Components/ScrollView/ScrollView.js @@ -32,7 +32,6 @@ var insetsDiffer = require('insetsDiffer'); var invariant = require('invariant'); var pointsDiffer = require('pointsDiffer'); var requireNativeComponent = require('requireNativeComponent'); -var processColor = require('processColor'); var processDecelerationRate = require('processDecelerationRate'); var PropTypes = React.PropTypes; @@ -507,16 +506,12 @@ var ScrollView = React.createClass({ // On Android wrap the ScrollView with a AndroidSwipeRefreshLayout. // Since the ScrollView is wrapped add the style props to the // AndroidSwipeRefreshLayout and use flex: 1 for the ScrollView. - var refreshProps = refreshControl.props; - return ( - - - {contentContainer} - - + return React.cloneElement( + refreshControl, + {style: this.props.style}, + + {contentContainer} + ); } } @@ -574,7 +569,6 @@ if (Platform.OS === 'android') { 'AndroidHorizontalScrollView', ScrollView ); - var AndroidSwipeRefreshLayout = requireNativeComponent('AndroidSwipeRefreshLayout'); } else if (Platform.OS === 'ios') { var RCTScrollView = requireNativeComponent('RCTScrollView', ScrollView); } diff --git a/Libraries/PullToRefresh/PullToRefreshViewAndroid.android.js b/Libraries/PullToRefresh/PullToRefreshViewAndroid.android.js index 1c37d2ec9..c0f498ba2 100644 --- a/Libraries/PullToRefresh/PullToRefreshViewAndroid.android.js +++ b/Libraries/PullToRefresh/PullToRefreshViewAndroid.android.js @@ -16,7 +16,6 @@ var RefreshLayoutConsts = require('UIManager').AndroidSwipeRefreshLayout.Constan var View = require('View'); var onlyChild = require('onlyChild'); -var processColor = require('processColor'); var requireNativeComponent = require('requireNativeComponent'); var NATIVE_REF = 'native_swiperefreshlayout'; @@ -68,7 +67,7 @@ var PullToRefreshViewAndroid = React.createClass({ render: function() { return (