diff --git a/Libraries/Components/ScrollView/ScrollView.js b/Libraries/Components/ScrollView/ScrollView.js index fdca28932f2..ad5e9edbf96 100644 --- a/Libraries/Components/ScrollView/ScrollView.js +++ b/Libraries/Components/ScrollView/ScrollView.js @@ -24,7 +24,6 @@ const StyleSheetPropType = require('StyleSheetPropType'); const View = require('View'); const ViewStylePropTypes = require('ViewStylePropTypes'); -const deprecatedPropType = require('deprecatedPropType'); const dismissKeyboard = require('dismissKeyboard'); const flattenStyle = require('flattenStyle'); const invariant = require('fbjs/lib/invariant'); @@ -311,14 +310,6 @@ const ScrollView = React.createClass({ */ refreshControl: PropTypes.element, - /** - * @platform ios - */ - onRefreshStart: deprecatedPropType( - PropTypes.func, - 'Use the `refreshControl` prop instead.' - ), - /** * Sometimes a scrollview takes up more space than its content fills. When this is * the case, this prop will fill the rest of the scrollview with a color to avoid setting @@ -348,15 +339,6 @@ const ScrollView = React.createClass({ this._scrollViewRef && this._scrollViewRef.setNativeProps(props); }, - /** - * Deprecated. Use `RefreshControl` instead. - */ - endRefreshing: function() { - RCTScrollViewManager.endRefreshing( - ReactNative.findNodeHandle(this) - ); - }, - /** * Returns a reference to the underlying scroll responder, which supports * operations like `scrollTo`. All ScrollView-like components should @@ -510,14 +492,6 @@ const ScrollView = React.createClass({ sendMomentumEvents: (this.props.onMomentumScrollBegin || this.props.onMomentumScrollEnd) ? true : false, }; - const onRefreshStart = this.props.onRefreshStart; - if (onRefreshStart) { - // this is necessary because if we set it on props, even when empty, - // it'll trigger the default pull-to-refresh behavior on native. - props.onRefreshStart = - function() { onRefreshStart && onRefreshStart(this.endRefreshing); }.bind(this); - } - const { decelerationRate } = this.props; if (decelerationRate) { props.decelerationRate = processDecelerationRate(decelerationRate); diff --git a/Libraries/PullToRefresh/PullToRefreshViewAndroid.android.js b/Libraries/PullToRefresh/PullToRefreshViewAndroid.android.js deleted file mode 100644 index ea7d5e25c41..00000000000 --- a/Libraries/PullToRefresh/PullToRefreshViewAndroid.android.js +++ /dev/null @@ -1,107 +0,0 @@ -/** - * Copyright (c) 2015-present, Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. - * - * @providesModule PullToRefreshViewAndroid - */ -'use strict'; - -var ColorPropType = require('ColorPropType'); -var React = require('React'); -var RefreshLayoutConsts = require('UIManager').AndroidSwipeRefreshLayout.Constants; -var View = require('View'); - -var onlyChild = require('onlyChild'); -var requireNativeComponent = require('requireNativeComponent'); - -var NATIVE_REF = 'native_swiperefreshlayout'; - -/** - * Deprecated. Use `RefreshControl` instead. - * - * React view that supports a single scrollable child view (e.g. `ScrollView`). When this child - * view is at `scrollY: 0`, swiping down triggers an `onRefresh` event. - * - * The style `{flex: 1}` might be required to ensure the expected behavior of the child component - * (e.g. when the child is expected to scroll with `ScrollView` or `ListView`). - */ -var PullToRefreshViewAndroid = React.createClass({ - statics: { - SIZE: RefreshLayoutConsts.SIZE, - }, - - propTypes: { - ...View.propTypes, - /** - * Whether the pull to refresh functionality is enabled - */ - enabled: React.PropTypes.bool, - /** - * The colors (at least one) that will be used to draw the refresh indicator - */ - colors: React.PropTypes.arrayOf(ColorPropType), - /** - * The background color of the refresh indicator - */ - progressBackgroundColor: ColorPropType, - /** - * Progress view top offset - * @platform android - */ - progressViewOffset: React.PropTypes.number, - /** - * Whether the view should be indicating an active refresh - */ - refreshing: React.PropTypes.bool, - /** - * Size of the refresh indicator, see PullToRefreshViewAndroid.SIZE - */ - size: React.PropTypes.oneOf(RefreshLayoutConsts.SIZE.DEFAULT, RefreshLayoutConsts.SIZE.LARGE), - }, - - componentDidMount: function() { - console.warn('`PullToRefreshViewAndroid` is deprecated. Use `RefreshControl` instead.'); - }, - - getInnerViewNode: function() { - return this.refs[NATIVE_REF]; - }, - - setNativeProps: function(props) { - let innerViewNode = this.getInnerViewNode(); - return innerViewNode && innerViewNode.setNativeProps(props); - }, - - render: function() { - return ( - - {onlyChild(this.props.children)} - - ); - }, - - _onRefresh: function() { - this.props.onRefresh && this.props.onRefresh(); - this.setNativeProps({refreshing: !!this.props.refreshing}); - } -}); - -var NativePullToRefresh = requireNativeComponent( - 'AndroidSwipeRefreshLayout', - PullToRefreshViewAndroid -); - -module.exports = PullToRefreshViewAndroid; diff --git a/Libraries/PullToRefresh/PullToRefreshViewAndroid.ios.js b/Libraries/PullToRefresh/PullToRefreshViewAndroid.ios.js deleted file mode 100644 index 2a16f851b82..00000000000 --- a/Libraries/PullToRefresh/PullToRefreshViewAndroid.ios.js +++ /dev/null @@ -1,13 +0,0 @@ -/** - * Copyright (c) 2015-present, Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. - * - * @providesModule PullToRefreshViewAndroid - */ - 'use strict'; - - module.exports = require('UnimplementedView'); diff --git a/Libraries/react-native/react-native.js b/Libraries/react-native/react-native.js index 8519008320f..d867bd59581 100644 --- a/Libraries/react-native/react-native.js +++ b/Libraries/react-native/react-native.js @@ -49,7 +49,6 @@ var ReactNative = { get SliderIOS() { return require('SliderIOS'); }, get SnapshotViewIOS() { return require('SnapshotViewIOS'); }, get Switch() { return require('Switch'); }, - get PullToRefreshViewAndroid() { return require('PullToRefreshViewAndroid'); }, get RecyclerViewBackedScrollView() { return require('RecyclerViewBackedScrollView'); }, get RefreshControl() { return require('RefreshControl'); }, get StatusBar() { return require('StatusBar'); }, diff --git a/Libraries/react-native/react-native.js.flow b/Libraries/react-native/react-native.js.flow index 0bb568e5cd2..d300af0c4d0 100644 --- a/Libraries/react-native/react-native.js.flow +++ b/Libraries/react-native/react-native.js.flow @@ -48,7 +48,6 @@ var ReactNative = Object.assign(Object.create(require('ReactNative')), { SnapshotViewIOS: require('SnapshotViewIOS'), StatusBar: require('StatusBar'), Switch: require('Switch'), - PullToRefreshViewAndroid: require('PullToRefreshViewAndroid'), RecyclerViewBackedScrollView: require('RecyclerViewBackedScrollView'), RefreshControl: require('RefreshControl'), SwitchAndroid: require('SwitchAndroid'), diff --git a/React/Views/RCTScrollView.h b/React/Views/RCTScrollView.h index 7bc9c617c36..c688fbf1ff0 100644 --- a/React/Views/RCTScrollView.h +++ b/React/Views/RCTScrollView.h @@ -58,10 +58,6 @@ @property (nonatomic, copy) RCTDirectEventBlock onMomentumScrollEnd; @property (nonatomic, copy) RCTDirectEventBlock onScrollAnimationEnd; -// Pull-to-refresh support (deprecated - use RCTPullToRefreshControl instead) -@property (nonatomic, copy) RCTDirectEventBlock onRefreshStart; -- (void)endRefreshing; - @end @interface RCTEventDispatcher (RCTScrollView) diff --git a/React/Views/RCTScrollView.m b/React/Views/RCTScrollView.m index 33db538abc4..18aa3c952c9 100644 --- a/React/Views/RCTScrollView.m +++ b/React/Views/RCTScrollView.m @@ -934,34 +934,6 @@ RCT_SET_AND_PRESERVE_OFFSET(setShowsVerticalScrollIndicator, showsVerticalScroll RCT_SET_AND_PRESERVE_OFFSET(setZoomScale, zoomScale, CGFloat); RCT_SET_AND_PRESERVE_OFFSET(setScrollIndicatorInsets, scrollIndicatorInsets, UIEdgeInsets); -- (void)setOnRefreshStart:(RCTDirectEventBlock)onRefreshStart -{ - if (!onRefreshStart) { - _onRefreshStart = nil; - _scrollView.refreshControl = nil; - return; - } - _onRefreshStart = [onRefreshStart copy]; - - if (!_scrollView.refreshControl) { - RCTRefreshControl *refreshControl = [RCTRefreshControl new]; - [refreshControl addTarget:self action:@selector(refreshControlValueChanged) forControlEvents:UIControlEventValueChanged]; - _scrollView.refreshControl = refreshControl; - } -} - -- (void)refreshControlValueChanged -{ - if (self.onRefreshStart) { - self.onRefreshStart(nil); - } -} - -- (void)endRefreshing -{ - [_scrollView.refreshControl endRefreshing]; -} - - (void)sendScrollEventWithName:(NSString *)eventName scrollView:(UIScrollView *)scrollView userData:(NSDictionary *)userData diff --git a/React/Views/RCTScrollViewManager.m b/React/Views/RCTScrollViewManager.m index 2261c4ba88d..9eb99a7c53d 100644 --- a/React/Views/RCTScrollViewManager.m +++ b/React/Views/RCTScrollViewManager.m @@ -72,7 +72,6 @@ RCT_EXPORT_VIEW_PROPERTY(scrollIndicatorInsets, UIEdgeInsets) RCT_EXPORT_VIEW_PROPERTY(snapToInterval, int) RCT_EXPORT_VIEW_PROPERTY(snapToAlignment, NSString) RCT_REMAP_VIEW_PROPERTY(contentOffset, scrollView.contentOffset, CGPoint) -RCT_EXPORT_VIEW_PROPERTY(onRefreshStart, RCTDirectEventBlock) RCT_EXPORT_VIEW_PROPERTY(onScrollBeginDrag, RCTDirectEventBlock) RCT_EXPORT_VIEW_PROPERTY(onScroll, RCTDirectEventBlock) RCT_EXPORT_VIEW_PROPERTY(onScrollEndDrag, RCTDirectEventBlock) @@ -119,21 +118,6 @@ RCT_EXPORT_METHOD(calculateChildFrames:(nonnull NSNumber *)reactTag }]; } -RCT_EXPORT_METHOD(endRefreshing:(nonnull NSNumber *)reactTag) -{ - [self.bridge.uiManager addUIBlock: - ^(__unused RCTUIManager *uiManager, NSDictionary *viewRegistry) { - - RCTScrollView *view = viewRegistry[reactTag]; - if (!view || ![view isKindOfClass:[RCTScrollView class]]) { - RCTLogError(@"Cannot find RCTScrollView with tag #%@", reactTag); - return; - } - - [view endRefreshing]; - }]; -} - RCT_EXPORT_METHOD(scrollTo:(nonnull NSNumber *)reactTag offsetX:(CGFloat)x offsetY:(CGFloat)y diff --git a/ReactAndroid/src/androidTest/js/SwipeRefreshLayoutTestModule.js b/ReactAndroid/src/androidTest/js/SwipeRefreshLayoutTestModule.js index 7a8e6f5224c..3c1c289a47b 100644 --- a/ReactAndroid/src/androidTest/js/SwipeRefreshLayoutTestModule.js +++ b/ReactAndroid/src/androidTest/js/SwipeRefreshLayoutTestModule.js @@ -15,7 +15,7 @@ var BatchedBridge = require('BatchedBridge'); var React = require('React'); var RecordingModule = require('NativeModules').SwipeRefreshLayoutRecordingModule; var ScrollView = require('ScrollView'); -var PullToRefreshViewAndroid = require('PullToRefreshViewAndroid'); +var RefreshControl = require('RefreshControl'); var Text = require('Text'); var TouchableWithoutFeedback = require('TouchableWithoutFeedback'); var View = require('View'); @@ -62,13 +62,17 @@ var SwipeRefreshLayoutTestApp = React.createClass({ rows.push(); } return ( - RecordingModule.onRefresh()}> - - {rows} - - + refreshControl={ + RecordingModule.onRefresh()} + /> + }> + {rows} + ); }, });