2015-02-20 04:10:52 +00:00
|
|
|
|
/**
|
2015-03-23 20:35:08 +00:00
|
|
|
|
* 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.
|
2015-02-20 04:10:52 +00:00
|
|
|
|
*
|
|
|
|
|
* @providesModule ScrollView
|
2015-03-25 19:55:10 +00:00
|
|
|
|
* @flow
|
2015-02-20 04:10:52 +00:00
|
|
|
|
*/
|
|
|
|
|
'use strict';
|
|
|
|
|
|
2016-05-11 09:59:25 +00:00
|
|
|
|
const ColorPropType = require('ColorPropType');
|
|
|
|
|
const EdgeInsetsPropType = require('EdgeInsetsPropType');
|
|
|
|
|
const Platform = require('Platform');
|
|
|
|
|
const PointPropType = require('PointPropType');
|
|
|
|
|
const React = require('React');
|
2016-10-15 01:50:14 +00:00
|
|
|
|
const ReactNative = require('ReactNative');
|
2016-05-11 09:59:25 +00:00
|
|
|
|
const ScrollResponder = require('ScrollResponder');
|
|
|
|
|
const StyleSheet = require('StyleSheet');
|
|
|
|
|
const StyleSheetPropType = require('StyleSheetPropType');
|
|
|
|
|
const View = require('View');
|
|
|
|
|
const ViewStylePropTypes = require('ViewStylePropTypes');
|
|
|
|
|
|
|
|
|
|
const dismissKeyboard = require('dismissKeyboard');
|
|
|
|
|
const flattenStyle = require('flattenStyle');
|
|
|
|
|
const invariant = require('fbjs/lib/invariant');
|
|
|
|
|
const processDecelerationRate = require('processDecelerationRate');
|
|
|
|
|
const PropTypes = React.PropTypes;
|
|
|
|
|
const requireNativeComponent = require('requireNativeComponent');
|
2015-02-20 04:10:52 +00:00
|
|
|
|
|
|
|
|
|
/**
|
2015-03-09 16:28:51 +00:00
|
|
|
|
* Component that wraps platform ScrollView while providing
|
2015-02-20 04:10:52 +00:00
|
|
|
|
* integration with touch locking "responder" system.
|
|
|
|
|
*
|
2015-06-16 22:40:52 +00:00
|
|
|
|
* Keep in mind that ScrollViews must have a bounded height in order to work,
|
|
|
|
|
* since they contain unbounded-height children into a bounded container (via
|
|
|
|
|
* a scroll interaction). In order to bound the height of a ScrollView, either
|
|
|
|
|
* set the height of the view directly (discouraged) or make sure all parent
|
|
|
|
|
* views have bounded height. Forgetting to transfer `{flex: 1}` down the
|
|
|
|
|
* view stack can lead to errors here, which the element inspector makes
|
|
|
|
|
* easy to debug.
|
|
|
|
|
*
|
2015-02-20 04:10:52 +00:00
|
|
|
|
* Doesn't yet support other contained responders from blocking this scroll
|
|
|
|
|
* view from becoming the responder.
|
2016-12-07 18:40:59 +00:00
|
|
|
|
*
|
|
|
|
|
*
|
|
|
|
|
* `<ScrollView>` vs `<ListView>` - which one to use?
|
|
|
|
|
* ScrollView simply renders all its react child components at once. That
|
|
|
|
|
* makes it very easy to understand and use.
|
|
|
|
|
* On the other hand, this has a performance downside. Imagine you have a very
|
|
|
|
|
* long list of items you want to display, worth of couple of your ScrollView’s
|
|
|
|
|
* heights. Creating JS components and native views upfront for all its items,
|
|
|
|
|
* which may not even be shown, will contribute to slow rendering of your
|
|
|
|
|
* screen and increased memory usage.
|
|
|
|
|
*
|
|
|
|
|
* This is where ListView comes into play. ListView renders items lazily,
|
|
|
|
|
* just when they are about to appear. This laziness comes at cost of a more
|
|
|
|
|
* complicated API, which is worth it unless you are rendering a small fixed
|
|
|
|
|
* set of items.
|
2015-02-20 04:10:52 +00:00
|
|
|
|
*/
|
2016-05-11 09:59:25 +00:00
|
|
|
|
const ScrollView = React.createClass({
|
2015-03-04 16:02:34 +00:00
|
|
|
|
propTypes: {
|
2015-11-18 16:24:26 +00:00
|
|
|
|
...View.propTypes,
|
2015-07-23 13:36:37 +00:00
|
|
|
|
/**
|
|
|
|
|
* Controls whether iOS should automatically adjust the content inset
|
|
|
|
|
* for scroll views that are placed behind a navigation bar or
|
|
|
|
|
* tab bar/ toolbar. The default value is true.
|
|
|
|
|
* @platform ios
|
|
|
|
|
*/
|
|
|
|
|
automaticallyAdjustContentInsets: PropTypes.bool,
|
|
|
|
|
/**
|
|
|
|
|
* The amount by which the scroll view content is inset from the edges
|
2016-05-01 03:39:53 +00:00
|
|
|
|
* of the scroll view. Defaults to `{top: 0, left: 0, bottom: 0, right: 0}`.
|
2015-07-23 13:36:37 +00:00
|
|
|
|
* @platform ios
|
|
|
|
|
*/
|
|
|
|
|
contentInset: EdgeInsetsPropType,
|
|
|
|
|
/**
|
|
|
|
|
* Used to manually set the starting scroll offset.
|
|
|
|
|
* The default value is `{x: 0, y: 0}`.
|
|
|
|
|
* @platform ios
|
|
|
|
|
*/
|
|
|
|
|
contentOffset: PointPropType,
|
2015-03-31 21:59:14 +00:00
|
|
|
|
/**
|
|
|
|
|
* When true, the scroll view bounces when it reaches the end of the
|
|
|
|
|
* content if the content is larger then the scroll view along the axis of
|
|
|
|
|
* the scroll direction. When false, it disables all bouncing even if
|
|
|
|
|
* the `alwaysBounce*` props are true. The default value is true.
|
2015-07-23 13:36:37 +00:00
|
|
|
|
* @platform ios
|
2015-03-31 21:59:14 +00:00
|
|
|
|
*/
|
|
|
|
|
bounces: PropTypes.bool,
|
2015-04-17 01:17:19 +00:00
|
|
|
|
/**
|
|
|
|
|
* When true, gestures can drive zoom past min/max and the zoom will animate
|
|
|
|
|
* to the min/max value at gesture end, otherwise the zoom will not exceed
|
|
|
|
|
* the limits.
|
2015-07-23 13:36:37 +00:00
|
|
|
|
* @platform ios
|
2015-04-17 01:17:19 +00:00
|
|
|
|
*/
|
|
|
|
|
bouncesZoom: PropTypes.bool,
|
2015-02-20 04:10:52 +00:00
|
|
|
|
/**
|
|
|
|
|
* When true, the scroll view bounces horizontally when it reaches the end
|
|
|
|
|
* even if the content is smaller than the scroll view itself. The default
|
|
|
|
|
* value is true when `horizontal={true}` and false otherwise.
|
2015-07-23 13:36:37 +00:00
|
|
|
|
* @platform ios
|
2015-02-20 04:10:52 +00:00
|
|
|
|
*/
|
2015-03-09 16:29:02 +00:00
|
|
|
|
alwaysBounceHorizontal: PropTypes.bool,
|
2015-02-20 04:10:52 +00:00
|
|
|
|
/**
|
|
|
|
|
* When true, the scroll view bounces vertically when it reaches the end
|
|
|
|
|
* even if the content is smaller than the scroll view itself. The default
|
|
|
|
|
* value is false when `horizontal={true}` and true otherwise.
|
2015-07-23 13:36:37 +00:00
|
|
|
|
* @platform ios
|
2015-02-20 04:10:52 +00:00
|
|
|
|
*/
|
2015-03-09 16:29:02 +00:00
|
|
|
|
alwaysBounceVertical: PropTypes.bool,
|
2015-02-20 04:10:52 +00:00
|
|
|
|
/**
|
|
|
|
|
* When true, the scroll view automatically centers the content when the
|
|
|
|
|
* content is smaller than the scroll view bounds; when the content is
|
|
|
|
|
* larger than the scroll view, this property has no effect. The default
|
|
|
|
|
* value is false.
|
2015-07-23 13:36:37 +00:00
|
|
|
|
* @platform ios
|
2015-02-20 04:10:52 +00:00
|
|
|
|
*/
|
2015-03-09 16:29:02 +00:00
|
|
|
|
centerContent: PropTypes.bool,
|
2015-02-20 04:10:52 +00:00
|
|
|
|
/**
|
|
|
|
|
* These styles will be applied to the scroll view content container which
|
|
|
|
|
* wraps all of the child views. Example:
|
|
|
|
|
*
|
|
|
|
|
* return (
|
|
|
|
|
* <ScrollView contentContainerStyle={styles.contentContainer}>
|
|
|
|
|
* </ScrollView>
|
|
|
|
|
* );
|
|
|
|
|
* ...
|
2016-05-11 09:59:25 +00:00
|
|
|
|
* const styles = StyleSheet.create({
|
2015-02-20 04:10:52 +00:00
|
|
|
|
* contentContainer: {
|
|
|
|
|
* paddingVertical: 20
|
|
|
|
|
* }
|
|
|
|
|
* });
|
|
|
|
|
*/
|
|
|
|
|
contentContainerStyle: StyleSheetPropType(ViewStylePropTypes),
|
|
|
|
|
/**
|
|
|
|
|
* A floating-point number that determines how quickly the scroll view
|
2016-01-28 13:35:14 +00:00
|
|
|
|
* decelerates after the user lifts their finger. You may also use string
|
|
|
|
|
* shortcuts `"normal"` and `"fast"` which match the underlying iOS settings
|
|
|
|
|
* for `UIScrollViewDecelerationRateNormal` and
|
|
|
|
|
* `UIScrollViewDecelerationRateFast` respectively.
|
2016-03-10 18:20:53 +00:00
|
|
|
|
* - normal: 0.998 (the default)
|
|
|
|
|
* - fast: 0.99
|
2015-07-23 13:36:37 +00:00
|
|
|
|
* @platform ios
|
2015-02-20 04:10:52 +00:00
|
|
|
|
*/
|
2016-01-28 13:35:14 +00:00
|
|
|
|
decelerationRate: PropTypes.oneOfType([
|
|
|
|
|
PropTypes.oneOf(['fast', 'normal']),
|
|
|
|
|
PropTypes.number,
|
|
|
|
|
]),
|
2015-02-20 04:10:52 +00:00
|
|
|
|
/**
|
|
|
|
|
* When true, the scroll view's children are arranged horizontally in a row
|
|
|
|
|
* instead of vertically in a column. The default value is false.
|
|
|
|
|
*/
|
|
|
|
|
horizontal: PropTypes.bool,
|
2016-01-27 18:16:10 +00:00
|
|
|
|
/**
|
|
|
|
|
* The style of the scroll indicators.
|
|
|
|
|
* - `default` (the default), same as `black`.
|
|
|
|
|
* - `black`, scroll indicator is black. This style is good against a white content background.
|
|
|
|
|
* - `white`, scroll indicator is white. This style is good against a black content background.
|
|
|
|
|
* @platform ios
|
|
|
|
|
*/
|
|
|
|
|
indicatorStyle: PropTypes.oneOf([
|
|
|
|
|
'default', // default
|
|
|
|
|
'black',
|
|
|
|
|
'white',
|
|
|
|
|
]),
|
2015-04-17 01:17:19 +00:00
|
|
|
|
/**
|
|
|
|
|
* When true, the ScrollView will try to lock to only vertical or horizontal
|
|
|
|
|
* scrolling while dragging. The default value is false.
|
2015-07-23 13:36:37 +00:00
|
|
|
|
* @platform ios
|
2015-04-17 01:17:19 +00:00
|
|
|
|
*/
|
|
|
|
|
directionalLockEnabled: PropTypes.bool,
|
|
|
|
|
/**
|
|
|
|
|
* When false, once tracking starts, won't try to drag if the touch moves.
|
|
|
|
|
* The default value is true.
|
2015-07-23 13:36:37 +00:00
|
|
|
|
* @platform ios
|
2015-04-17 01:17:19 +00:00
|
|
|
|
*/
|
|
|
|
|
canCancelContentTouches: PropTypes.bool,
|
2015-02-20 04:10:52 +00:00
|
|
|
|
/**
|
|
|
|
|
* Determines whether the keyboard gets dismissed in response to a drag.
|
2015-03-03 18:22:29 +00:00
|
|
|
|
* - 'none' (the default), drags do not dismiss the keyboard.
|
2015-07-23 13:36:37 +00:00
|
|
|
|
* - 'on-drag', the keyboard is dismissed when a drag begins.
|
2015-08-14 09:36:00 +00:00
|
|
|
|
* - 'interactive', the keyboard is dismissed interactively with the drag and moves in
|
|
|
|
|
* synchrony with the touch; dragging upwards cancels the dismissal.
|
|
|
|
|
* On android this is not supported and it will have the same behavior as 'none'.
|
2015-02-20 04:10:52 +00:00
|
|
|
|
*/
|
2015-03-03 18:22:29 +00:00
|
|
|
|
keyboardDismissMode: PropTypes.oneOf([
|
|
|
|
|
'none', // default
|
|
|
|
|
'interactive',
|
2015-06-05 15:46:17 +00:00
|
|
|
|
'on-drag',
|
2015-03-03 18:22:29 +00:00
|
|
|
|
]),
|
2015-02-20 04:10:52 +00:00
|
|
|
|
/**
|
2016-12-08 05:39:54 +00:00
|
|
|
|
* Determines when the keyboard should stay visible after a tap.
|
|
|
|
|
*
|
|
|
|
|
* - 'never' (the default), tapping outside of the focused text input when the keyboard
|
|
|
|
|
* is up dismisses the keyboard. When this happens, children won't receive the tap.
|
|
|
|
|
* - 'always', the keyboard will not dismiss automatically, and the scroll view will not
|
|
|
|
|
* catch taps, but children of the scroll view can catch taps.
|
|
|
|
|
* - 'handled', the keyboard will not dismiss automatically when the tap was handled by
|
|
|
|
|
* a children, (or captured by an ancestor).
|
|
|
|
|
* - false, deprecated, use 'never' instead
|
|
|
|
|
* - true, deprecated, use 'always' instead
|
|
|
|
|
*/
|
|
|
|
|
keyboardShouldPersistTaps: PropTypes.oneOf(['always', 'never', 'handled', false, true]),
|
2015-02-20 04:10:52 +00:00
|
|
|
|
/**
|
|
|
|
|
* The maximum allowed zoom scale. The default value is 1.0.
|
2015-07-23 13:36:37 +00:00
|
|
|
|
* @platform ios
|
2015-02-20 04:10:52 +00:00
|
|
|
|
*/
|
2015-03-09 16:29:02 +00:00
|
|
|
|
maximumZoomScale: PropTypes.number,
|
2015-02-20 04:10:52 +00:00
|
|
|
|
/**
|
|
|
|
|
* The minimum allowed zoom scale. The default value is 1.0.
|
2015-07-23 13:36:37 +00:00
|
|
|
|
* @platform ios
|
2015-02-20 04:10:52 +00:00
|
|
|
|
*/
|
2015-03-09 16:29:02 +00:00
|
|
|
|
minimumZoomScale: PropTypes.number,
|
2015-07-23 13:36:37 +00:00
|
|
|
|
/**
|
|
|
|
|
* Fires at most once per frame during scrolling. The frequency of the
|
2015-12-15 17:08:39 +00:00
|
|
|
|
* events can be controlled using the `scrollEventThrottle` prop.
|
2015-07-23 13:36:37 +00:00
|
|
|
|
*/
|
|
|
|
|
onScroll: PropTypes.func,
|
|
|
|
|
/**
|
|
|
|
|
* Called when a scrolling animation ends.
|
|
|
|
|
* @platform ios
|
|
|
|
|
*/
|
|
|
|
|
onScrollAnimationEnd: PropTypes.func,
|
2015-11-20 15:36:23 +00:00
|
|
|
|
/**
|
2016-05-01 01:27:15 +00:00
|
|
|
|
* Called when scrollable content view of the ScrollView changes.
|
|
|
|
|
*
|
|
|
|
|
* Handler function is passed the content width and content height as parameters: `(contentWidth, contentHeight)`
|
|
|
|
|
*
|
|
|
|
|
* It's implemented using onLayout handler attached to the content container
|
2015-11-20 15:36:23 +00:00
|
|
|
|
* which this ScrollView renders.
|
|
|
|
|
*/
|
|
|
|
|
onContentSizeChange: PropTypes.func,
|
2015-02-20 04:10:52 +00:00
|
|
|
|
/**
|
|
|
|
|
* When true, the scroll view stops on multiples of the scroll view's size
|
|
|
|
|
* when scrolling. This can be used for horizontal pagination. The default
|
|
|
|
|
* value is false.
|
|
|
|
|
*/
|
2015-03-09 16:29:02 +00:00
|
|
|
|
pagingEnabled: PropTypes.bool,
|
2015-07-23 13:36:37 +00:00
|
|
|
|
/**
|
|
|
|
|
* When false, the content does not scroll.
|
|
|
|
|
* The default value is true.
|
|
|
|
|
*/
|
|
|
|
|
scrollEnabled: PropTypes.bool,
|
|
|
|
|
/**
|
|
|
|
|
* This controls how often the scroll event will be fired while scrolling
|
Correct scrollEventThrottle docs
Summary:The docs indicated that a higher number was more accurate, however based on the implementation:
```
/**
* TODO: this logic looks wrong, and it may be because it is. Currently, if _scrollEventThrottle
* is set to zero (the default), the "didScroll" event is only sent once per scroll, instead of repeatedly
* while scrolling as expected. However, if you "fix" that bug, ScrollView will generate repeated
* warnings, and behave strangely (ListView works fine however), so don't fix it unless you fix that too!
*/
if (_allowNextScrollNoMatterWhat ||
(_scrollEventThrottle > 0 && _scrollEventThrottle < (now - _lastScrollDispatchTime)))
```
https://github.com/facebook/react-native/blob/master/React/Views/RCTScrollView.m#L564
It appears that only 0 is a special case here, and perhaps a known issue ;)
Closes https://github.com/facebook/react-native/pull/3729
Differential Revision: D3074801
Pulled By: mkonicek
fb-gh-sync-id: f63b00755f7565165cc628085efa5ed96badcfe1
shipit-source-id: f63b00755f7565165cc628085efa5ed96badcfe1
2016-03-20 16:51:21 +00:00
|
|
|
|
* (as a time interval in ms). A lower number yields better accuracy for code
|
2015-07-23 13:36:37 +00:00
|
|
|
|
* that is tracking the scroll position, but can lead to scroll performance
|
|
|
|
|
* problems due to the volume of information being send over the bridge.
|
Correct scrollEventThrottle docs
Summary:The docs indicated that a higher number was more accurate, however based on the implementation:
```
/**
* TODO: this logic looks wrong, and it may be because it is. Currently, if _scrollEventThrottle
* is set to zero (the default), the "didScroll" event is only sent once per scroll, instead of repeatedly
* while scrolling as expected. However, if you "fix" that bug, ScrollView will generate repeated
* warnings, and behave strangely (ListView works fine however), so don't fix it unless you fix that too!
*/
if (_allowNextScrollNoMatterWhat ||
(_scrollEventThrottle > 0 && _scrollEventThrottle < (now - _lastScrollDispatchTime)))
```
https://github.com/facebook/react-native/blob/master/React/Views/RCTScrollView.m#L564
It appears that only 0 is a special case here, and perhaps a known issue ;)
Closes https://github.com/facebook/react-native/pull/3729
Differential Revision: D3074801
Pulled By: mkonicek
fb-gh-sync-id: f63b00755f7565165cc628085efa5ed96badcfe1
shipit-source-id: f63b00755f7565165cc628085efa5ed96badcfe1
2016-03-20 16:51:21 +00:00
|
|
|
|
* You will not notice a difference between values set between 1-16 as the
|
|
|
|
|
* JS run loop is synced to the screen refresh rate. If you do not need precise
|
|
|
|
|
* scroll position tracking, set this value higher to limit the information
|
|
|
|
|
* being sent across the bridge. The default value is zero, which results in
|
|
|
|
|
* the scroll event being sent only once each time the view is scrolled.
|
2015-07-23 13:36:37 +00:00
|
|
|
|
* @platform ios
|
|
|
|
|
*/
|
|
|
|
|
scrollEventThrottle: PropTypes.number,
|
|
|
|
|
/**
|
|
|
|
|
* The amount by which the scroll view indicators are inset from the edges
|
|
|
|
|
* of the scroll view. This should normally be set to the same value as
|
|
|
|
|
* the `contentInset`. Defaults to `{0, 0, 0, 0}`.
|
|
|
|
|
* @platform ios
|
|
|
|
|
*/
|
|
|
|
|
scrollIndicatorInsets: EdgeInsetsPropType,
|
2015-02-20 04:10:52 +00:00
|
|
|
|
/**
|
|
|
|
|
* When true, the scroll view scrolls to top when the status bar is tapped.
|
|
|
|
|
* The default value is true.
|
2015-07-23 13:36:37 +00:00
|
|
|
|
* @platform ios
|
2015-02-20 04:10:52 +00:00
|
|
|
|
*/
|
2015-03-09 16:29:02 +00:00
|
|
|
|
scrollsToTop: PropTypes.bool,
|
2015-07-23 13:36:37 +00:00
|
|
|
|
/**
|
|
|
|
|
* When true, shows a horizontal scroll indicator.
|
2016-10-05 11:53:14 +00:00
|
|
|
|
* The default value is true.
|
2015-07-23 13:36:37 +00:00
|
|
|
|
*/
|
|
|
|
|
showsHorizontalScrollIndicator: PropTypes.bool,
|
|
|
|
|
/**
|
|
|
|
|
* When true, shows a vertical scroll indicator.
|
2016-10-05 11:53:14 +00:00
|
|
|
|
* The default value is true.
|
2015-07-23 13:36:37 +00:00
|
|
|
|
*/
|
|
|
|
|
showsVerticalScrollIndicator: PropTypes.bool,
|
2015-02-20 04:10:52 +00:00
|
|
|
|
/**
|
|
|
|
|
* An array of child indices determining which children get docked to the
|
|
|
|
|
* top of the screen when scrolling. For example, passing
|
|
|
|
|
* `stickyHeaderIndices={[0]}` will cause the first child to be fixed to the
|
|
|
|
|
* top of the scroll view. This property is not supported in conjunction
|
|
|
|
|
* with `horizontal={true}`.
|
2016-09-15 19:01:25 +00:00
|
|
|
|
* @platform ios
|
2015-02-20 04:10:52 +00:00
|
|
|
|
*/
|
2015-03-09 16:29:02 +00:00
|
|
|
|
stickyHeaderIndices: PropTypes.arrayOf(PropTypes.number),
|
2015-07-23 13:36:37 +00:00
|
|
|
|
style: StyleSheetPropType(ViewStylePropTypes),
|
2015-09-23 18:43:57 +00:00
|
|
|
|
/**
|
|
|
|
|
* When set, causes the scroll view to stop at multiples of the value of
|
|
|
|
|
* `snapToInterval`. This can be used for paginating through children
|
|
|
|
|
* that have lengths smaller than the scroll view. Used in combination
|
|
|
|
|
* with `snapToAlignment`.
|
|
|
|
|
* @platform ios
|
|
|
|
|
*/
|
|
|
|
|
snapToInterval: PropTypes.number,
|
|
|
|
|
/**
|
|
|
|
|
* When `snapToInterval` is set, `snapToAlignment` will define the relationship
|
2016-02-07 15:12:42 +00:00
|
|
|
|
* of the snapping to the scroll view.
|
2015-09-23 18:43:57 +00:00
|
|
|
|
* - `start` (the default) will align the snap at the left (horizontal) or top (vertical)
|
|
|
|
|
* - `center` will align the snap in the center
|
|
|
|
|
* - `end` will align the snap at the right (horizontal) or bottom (vertical)
|
|
|
|
|
* @platform ios
|
|
|
|
|
*/
|
|
|
|
|
snapToAlignment: PropTypes.oneOf([
|
|
|
|
|
'start', // default
|
|
|
|
|
'center',
|
|
|
|
|
'end',
|
|
|
|
|
]),
|
2015-02-20 04:10:52 +00:00
|
|
|
|
/**
|
|
|
|
|
* Experimental: When true, offscreen child views (whose `overflow` value is
|
|
|
|
|
* `hidden`) are removed from their native backing superview when offscreen.
|
2015-05-03 02:51:18 +00:00
|
|
|
|
* This can improve scrolling performance on long lists. The default value is
|
2015-11-24 15:04:35 +00:00
|
|
|
|
* true.
|
2015-02-20 04:10:52 +00:00
|
|
|
|
*/
|
|
|
|
|
removeClippedSubviews: PropTypes.bool,
|
|
|
|
|
/**
|
|
|
|
|
* The current scale of the scroll view content. The default value is 1.0.
|
2015-07-23 13:36:37 +00:00
|
|
|
|
* @platform ios
|
2015-02-20 04:10:52 +00:00
|
|
|
|
*/
|
2015-03-09 16:29:02 +00:00
|
|
|
|
zoomScale: PropTypes.number,
|
2015-11-19 19:13:42 +00:00
|
|
|
|
|
|
|
|
|
/**
|
2016-01-04 15:59:10 +00:00
|
|
|
|
* A RefreshControl component, used to provide pull-to-refresh
|
2017-02-03 20:23:18 +00:00
|
|
|
|
* functionality for the ScrollView. Only works for vertical ScrollViews
|
|
|
|
|
* (`horizontal` prop must be `false`).
|
2016-01-13 19:33:37 +00:00
|
|
|
|
*
|
2016-02-11 14:16:34 +00:00
|
|
|
|
* See [RefreshControl](docs/refreshcontrol.html).
|
2016-01-04 15:59:10 +00:00
|
|
|
|
*/
|
|
|
|
|
refreshControl: PropTypes.element,
|
|
|
|
|
|
2016-03-31 01:05:06 +00:00
|
|
|
|
/**
|
|
|
|
|
* 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
|
|
|
|
|
* a background and creating unnecessary overdraw. This is an advanced optimization
|
|
|
|
|
* that is not needed in the general case.
|
|
|
|
|
* @platform android
|
|
|
|
|
*/
|
|
|
|
|
endFillColor: ColorPropType,
|
2016-05-13 18:22:27 +00:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Tag used to log scroll performance on this scroll view. Will force
|
|
|
|
|
* momentum events to be turned on (see sendMomentumEvents). This doesn't do
|
|
|
|
|
* anything out of the box and you need to implement a custom native
|
|
|
|
|
* FpsListener for it to be useful.
|
|
|
|
|
* @platform android
|
|
|
|
|
*/
|
|
|
|
|
scrollPerfTag: PropTypes.string,
|
2017-02-02 12:13:20 +00:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Used to override default value of overScroll mode.
|
|
|
|
|
*
|
|
|
|
|
* Possible values:
|
|
|
|
|
*
|
|
|
|
|
* - `'auto'` - Default value, allow a user to over-scroll
|
|
|
|
|
* this view only if the content is large enough to meaningfully scroll.
|
|
|
|
|
* - `'always'` - Always allow a user to over-scroll this view.
|
|
|
|
|
* - `'never'` - Never allow a user to over-scroll this view.
|
|
|
|
|
*
|
|
|
|
|
* @platform android
|
|
|
|
|
*/
|
|
|
|
|
overScrollMode: PropTypes.oneOf([
|
|
|
|
|
'auto',
|
|
|
|
|
'always',
|
|
|
|
|
'never',
|
|
|
|
|
]),
|
2015-02-20 04:10:52 +00:00
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
mixins: [ScrollResponder.Mixin],
|
|
|
|
|
|
|
|
|
|
getInitialState: function() {
|
|
|
|
|
return this.scrollResponderMixinGetInitialState();
|
|
|
|
|
},
|
|
|
|
|
|
2015-03-25 19:55:10 +00:00
|
|
|
|
setNativeProps: function(props: Object) {
|
2016-05-11 09:59:25 +00:00
|
|
|
|
this._scrollViewRef && this._scrollViewRef.setNativeProps(props);
|
2015-02-20 04:10:52 +00:00
|
|
|
|
},
|
|
|
|
|
|
2015-06-12 18:17:46 +00:00
|
|
|
|
/**
|
|
|
|
|
* Returns a reference to the underlying scroll responder, which supports
|
|
|
|
|
* operations like `scrollTo`. All ScrollView-like components should
|
|
|
|
|
* implement this method so that they can be composed while providing access
|
|
|
|
|
* to the underlying scroll responder's methods.
|
|
|
|
|
*/
|
2016-05-11 09:59:25 +00:00
|
|
|
|
getScrollResponder: function(): ScrollView {
|
2015-06-12 18:17:46 +00:00
|
|
|
|
return this;
|
|
|
|
|
},
|
|
|
|
|
|
2016-02-03 19:12:58 +00:00
|
|
|
|
getScrollableNode: function(): any {
|
2016-05-11 09:59:25 +00:00
|
|
|
|
return ReactNative.findNodeHandle(this._scrollViewRef);
|
2016-02-03 19:12:58 +00:00
|
|
|
|
},
|
|
|
|
|
|
2015-03-25 19:55:10 +00:00
|
|
|
|
getInnerViewNode: function(): any {
|
2016-05-11 09:59:25 +00:00
|
|
|
|
return ReactNative.findNodeHandle(this._innerViewRef);
|
2015-02-20 04:10:52 +00:00
|
|
|
|
},
|
|
|
|
|
|
2016-02-03 11:59:20 +00:00
|
|
|
|
/**
|
|
|
|
|
* Scrolls to a given x, y offset, either immediately or with a smooth animation.
|
2016-04-09 18:12:46 +00:00
|
|
|
|
*
|
2017-01-27 18:09:20 +00:00
|
|
|
|
* Example:
|
2016-02-03 11:59:20 +00:00
|
|
|
|
*
|
2017-01-27 18:09:20 +00:00
|
|
|
|
* `scrollTo({x: 0; y: 0; animated: true})`
|
2016-02-03 11:59:20 +00:00
|
|
|
|
*
|
2017-01-27 18:09:20 +00:00
|
|
|
|
* Note: The weird function signature is due to the fact that, for historical reasons,
|
2016-02-03 11:59:20 +00:00
|
|
|
|
* the function also accepts separate arguments as as alternative to the options object.
|
|
|
|
|
* This is deprecated due to ambiguity (y before x), and SHOULD NOT BE USED.
|
|
|
|
|
*/
|
|
|
|
|
scrollTo: function(
|
|
|
|
|
y?: number | { x?: number, y?: number, animated?: boolean },
|
|
|
|
|
x?: number,
|
|
|
|
|
animated?: boolean
|
|
|
|
|
) {
|
|
|
|
|
if (typeof y === 'number') {
|
|
|
|
|
console.warn('`scrollTo(y, x, animated)` is deprecated. Use `scrollTo({x: 5, y: 5, animated: true})` instead.');
|
|
|
|
|
} else {
|
|
|
|
|
({x, y, animated} = y || {});
|
|
|
|
|
}
|
|
|
|
|
this.getScrollResponder().scrollResponderScrollTo({x: x || 0, y: y || 0, animated: animated !== false});
|
2015-02-20 04:10:52 +00:00
|
|
|
|
},
|
|
|
|
|
|
2016-01-14 15:41:24 +00:00
|
|
|
|
/**
|
2017-01-27 18:09:20 +00:00
|
|
|
|
* If this is a vertical ScrollView scrolls to the bottom.
|
|
|
|
|
* If this is a horizontal ScrollView scrolls to the right.
|
|
|
|
|
*
|
|
|
|
|
* Use `scrollToEnd({animated: true})` for smooth animated scrolling,
|
|
|
|
|
* `scrollToEnd({animated: false})` for immediate scrolling.
|
|
|
|
|
* If no options are passed, `animated` defaults to true.
|
|
|
|
|
*/
|
|
|
|
|
scrollToEnd: function(
|
|
|
|
|
options?: { animated?: boolean },
|
|
|
|
|
) {
|
|
|
|
|
// Default to true
|
|
|
|
|
const animated = (options && options.animated) !== false;
|
2017-01-30 18:15:18 +00:00
|
|
|
|
this.getScrollResponder().scrollResponderScrollToEnd({
|
|
|
|
|
animated: animated,
|
|
|
|
|
});
|
2017-01-27 18:09:20 +00:00
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Deprecated, use `scrollTo` instead.
|
2016-01-14 15:41:24 +00:00
|
|
|
|
*/
|
2016-02-03 11:59:20 +00:00
|
|
|
|
scrollWithoutAnimationTo: function(y: number = 0, x: number = 0) {
|
2016-01-14 15:41:24 +00:00
|
|
|
|
console.warn('`scrollWithoutAnimationTo` is deprecated. Use `scrollTo` instead');
|
2016-02-03 11:59:20 +00:00
|
|
|
|
this.scrollTo({x, y, animated: false});
|
2015-03-31 23:04:48 +00:00
|
|
|
|
},
|
|
|
|
|
|
2016-04-09 18:12:46 +00:00
|
|
|
|
_handleScroll: function(e: Object) {
|
2015-07-24 00:50:16 +00:00
|
|
|
|
if (__DEV__) {
|
2016-09-22 20:44:27 +00:00
|
|
|
|
if (this.props.onScroll && this.props.scrollEventThrottle == null && Platform.OS === 'ios') {
|
2016-05-11 09:59:25 +00:00
|
|
|
|
console.log( // eslint-disable-line no-console-disallow
|
2015-07-24 00:50:16 +00:00
|
|
|
|
'You specified `onScroll` on a <ScrollView> but not ' +
|
|
|
|
|
'`scrollEventThrottle`. You will only receive one event. ' +
|
|
|
|
|
'Using `16` you get all the events but be aware that it may ' +
|
|
|
|
|
'cause frame drops, use a bigger number if you don\'t need as ' +
|
|
|
|
|
'much precision.'
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|
2015-08-14 09:36:00 +00:00
|
|
|
|
if (Platform.OS === 'android') {
|
|
|
|
|
if (this.props.keyboardDismissMode === 'on-drag') {
|
|
|
|
|
dismissKeyboard();
|
|
|
|
|
}
|
|
|
|
|
}
|
2015-07-24 00:50:16 +00:00
|
|
|
|
this.scrollResponderHandleScroll(e);
|
|
|
|
|
},
|
|
|
|
|
|
2015-11-20 17:51:58 +00:00
|
|
|
|
_handleContentOnLayout: function(e: Object) {
|
2016-05-11 09:59:25 +00:00
|
|
|
|
const {width, height} = e.nativeEvent.layout;
|
2015-11-20 15:36:23 +00:00
|
|
|
|
this.props.onContentSizeChange && this.props.onContentSizeChange(width, height);
|
|
|
|
|
},
|
|
|
|
|
|
2016-05-11 09:59:25 +00:00
|
|
|
|
_scrollViewRef: (null: ?ScrollView),
|
|
|
|
|
_setScrollViewRef: function(ref: ?ScrollView) {
|
|
|
|
|
this._scrollViewRef = ref;
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
_innerViewRef: (null: ?View),
|
|
|
|
|
_setInnerViewRef: function(ref: ?View) {
|
|
|
|
|
this._innerViewRef = ref;
|
|
|
|
|
},
|
|
|
|
|
|
2015-02-20 04:10:52 +00:00
|
|
|
|
render: function() {
|
2017-02-02 17:51:19 +00:00
|
|
|
|
let ScrollViewClass;
|
|
|
|
|
let ScrollContentContainerViewClass;
|
|
|
|
|
if (Platform.OS === 'ios') {
|
|
|
|
|
ScrollViewClass = RCTScrollView;
|
|
|
|
|
ScrollContentContainerViewClass = RCTScrollContentView;
|
|
|
|
|
} else if (Platform.OS === 'android') {
|
|
|
|
|
if (this.props.horizontal) {
|
|
|
|
|
ScrollViewClass = AndroidHorizontalScrollView;
|
|
|
|
|
} else {
|
|
|
|
|
ScrollViewClass = AndroidScrollView;
|
|
|
|
|
}
|
|
|
|
|
ScrollContentContainerViewClass = View;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
invariant(
|
|
|
|
|
ScrollViewClass !== undefined,
|
|
|
|
|
'ScrollViewClass must not be undefined'
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
invariant(
|
|
|
|
|
ScrollContentContainerViewClass !== undefined,
|
|
|
|
|
'ScrollContentContainerViewClass must not be undefined'
|
|
|
|
|
);
|
|
|
|
|
|
2016-05-11 09:59:25 +00:00
|
|
|
|
const contentContainerStyle = [
|
2015-02-20 04:10:52 +00:00
|
|
|
|
this.props.horizontal && styles.contentContainerHorizontal,
|
|
|
|
|
this.props.contentContainerStyle,
|
|
|
|
|
];
|
2016-05-11 09:59:25 +00:00
|
|
|
|
let style, childLayoutProps;
|
2015-02-20 04:10:52 +00:00
|
|
|
|
if (__DEV__ && this.props.style) {
|
2016-05-11 09:59:25 +00:00
|
|
|
|
style = flattenStyle(this.props.style);
|
|
|
|
|
childLayoutProps = ['alignItems', 'justifyContent']
|
2015-03-25 19:55:10 +00:00
|
|
|
|
.filter((prop) => style && style[prop] !== undefined);
|
2015-02-20 04:10:52 +00:00
|
|
|
|
invariant(
|
|
|
|
|
childLayoutProps.length === 0,
|
|
|
|
|
'ScrollView child layout (' + JSON.stringify(childLayoutProps) +
|
2016-03-14 21:34:35 +00:00
|
|
|
|
') must be applied through the contentContainerStyle prop.'
|
2015-02-20 04:10:52 +00:00
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2016-05-11 09:59:25 +00:00
|
|
|
|
let contentSizeChangeProps = {};
|
2015-11-20 15:36:23 +00:00
|
|
|
|
if (this.props.onContentSizeChange) {
|
|
|
|
|
contentSizeChangeProps = {
|
|
|
|
|
onLayout: this._handleContentOnLayout,
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
2016-05-11 09:59:25 +00:00
|
|
|
|
const contentContainer =
|
2017-02-02 17:51:19 +00:00
|
|
|
|
<ScrollContentContainerViewClass
|
2015-11-20 15:36:23 +00:00
|
|
|
|
{...contentSizeChangeProps}
|
2016-05-11 09:59:25 +00:00
|
|
|
|
ref={this._setInnerViewRef}
|
2015-02-20 04:10:52 +00:00
|
|
|
|
style={contentContainerStyle}
|
2015-08-01 05:03:05 +00:00
|
|
|
|
removeClippedSubviews={this.props.removeClippedSubviews}
|
2016-09-15 19:01:25 +00:00
|
|
|
|
collapsable={false}>
|
2015-07-16 23:07:19 +00:00
|
|
|
|
{this.props.children}
|
2017-02-02 17:51:19 +00:00
|
|
|
|
</ScrollContentContainerViewClass>;
|
2015-02-20 04:10:52 +00:00
|
|
|
|
|
2016-05-11 09:59:25 +00:00
|
|
|
|
const alwaysBounceHorizontal =
|
2015-02-20 04:10:52 +00:00
|
|
|
|
this.props.alwaysBounceHorizontal !== undefined ?
|
|
|
|
|
this.props.alwaysBounceHorizontal :
|
|
|
|
|
this.props.horizontal;
|
|
|
|
|
|
2016-05-11 09:59:25 +00:00
|
|
|
|
const alwaysBounceVertical =
|
2015-02-20 04:10:52 +00:00
|
|
|
|
this.props.alwaysBounceVertical !== undefined ?
|
|
|
|
|
this.props.alwaysBounceVertical :
|
|
|
|
|
!this.props.horizontal;
|
|
|
|
|
|
2016-06-01 11:18:36 +00:00
|
|
|
|
const baseStyle = this.props.horizontal ? styles.baseHorizontal : styles.baseVertical;
|
2016-05-11 09:59:25 +00:00
|
|
|
|
const props = {
|
2015-03-09 16:29:02 +00:00
|
|
|
|
...this.props,
|
|
|
|
|
alwaysBounceHorizontal,
|
|
|
|
|
alwaysBounceVertical,
|
2016-06-01 11:18:36 +00:00
|
|
|
|
style: ([baseStyle, this.props.style]: ?Array<any>),
|
2016-10-11 07:02:53 +00:00
|
|
|
|
// Override the onContentSizeChange from props, since this event can
|
|
|
|
|
// bubble up from TextInputs
|
|
|
|
|
onContentSizeChange: null,
|
2015-03-09 16:29:02 +00:00
|
|
|
|
onTouchStart: this.scrollResponderHandleTouchStart,
|
|
|
|
|
onTouchMove: this.scrollResponderHandleTouchMove,
|
|
|
|
|
onTouchEnd: this.scrollResponderHandleTouchEnd,
|
|
|
|
|
onScrollBeginDrag: this.scrollResponderHandleScrollBeginDrag,
|
|
|
|
|
onScrollEndDrag: this.scrollResponderHandleScrollEndDrag,
|
|
|
|
|
onMomentumScrollBegin: this.scrollResponderHandleMomentumScrollBegin,
|
|
|
|
|
onMomentumScrollEnd: this.scrollResponderHandleMomentumScrollEnd,
|
|
|
|
|
onStartShouldSetResponder: this.scrollResponderHandleStartShouldSetResponder,
|
|
|
|
|
onStartShouldSetResponderCapture: this.scrollResponderHandleStartShouldSetResponderCapture,
|
|
|
|
|
onScrollShouldSetResponder: this.scrollResponderHandleScrollShouldSetResponder,
|
2016-04-09 18:12:46 +00:00
|
|
|
|
onScroll: this._handleScroll,
|
2015-03-09 16:29:02 +00:00
|
|
|
|
onResponderGrant: this.scrollResponderHandleResponderGrant,
|
|
|
|
|
onResponderTerminationRequest: this.scrollResponderHandleTerminationRequest,
|
|
|
|
|
onResponderTerminate: this.scrollResponderHandleTerminate,
|
|
|
|
|
onResponderRelease: this.scrollResponderHandleResponderRelease,
|
|
|
|
|
onResponderReject: this.scrollResponderHandleResponderReject,
|
2015-12-16 08:47:43 +00:00
|
|
|
|
sendMomentumEvents: (this.props.onMomentumScrollBegin || this.props.onMomentumScrollEnd) ? true : false,
|
2015-03-09 16:29:02 +00:00
|
|
|
|
};
|
2015-06-10 20:42:41 +00:00
|
|
|
|
|
2016-05-11 09:59:25 +00:00
|
|
|
|
const { decelerationRate } = this.props;
|
2016-01-28 13:35:14 +00:00
|
|
|
|
if (decelerationRate) {
|
|
|
|
|
props.decelerationRate = processDecelerationRate(decelerationRate);
|
|
|
|
|
}
|
2015-11-19 19:13:42 +00:00
|
|
|
|
|
2016-05-11 09:59:25 +00:00
|
|
|
|
const refreshControl = this.props.refreshControl;
|
2016-01-04 15:59:10 +00:00
|
|
|
|
if (refreshControl) {
|
|
|
|
|
if (Platform.OS === 'ios') {
|
|
|
|
|
// On iOS the RefreshControl is a child of the ScrollView.
|
|
|
|
|
return (
|
2016-05-11 09:59:25 +00:00
|
|
|
|
<ScrollViewClass {...props} ref={this._setScrollViewRef}>
|
2016-01-04 15:59:10 +00:00
|
|
|
|
{refreshControl}
|
|
|
|
|
{contentContainer}
|
|
|
|
|
</ScrollViewClass>
|
|
|
|
|
);
|
|
|
|
|
} else if (Platform.OS === 'android') {
|
|
|
|
|
// 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.
|
2016-11-15 01:52:13 +00:00
|
|
|
|
// Note: we should only apply props.style on the wrapper
|
|
|
|
|
// however, the ScrollView still needs the baseStyle to be scrollable
|
|
|
|
|
|
2016-02-02 15:11:41 +00:00
|
|
|
|
return React.cloneElement(
|
|
|
|
|
refreshControl,
|
2016-02-06 00:24:48 +00:00
|
|
|
|
{style: props.style},
|
2016-11-15 01:52:13 +00:00
|
|
|
|
<ScrollViewClass {...props} style={baseStyle} ref={this._setScrollViewRef}>
|
2016-02-02 15:11:41 +00:00
|
|
|
|
{contentContainer}
|
|
|
|
|
</ScrollViewClass>
|
2016-01-04 15:59:10 +00:00
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|
2015-02-20 04:10:52 +00:00
|
|
|
|
return (
|
2016-05-11 09:59:25 +00:00
|
|
|
|
<ScrollViewClass {...props} ref={this._setScrollViewRef}>
|
2015-02-20 04:10:52 +00:00
|
|
|
|
{contentContainer}
|
2015-03-09 16:28:54 +00:00
|
|
|
|
</ScrollViewClass>
|
2015-02-20 04:10:52 +00:00
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
2016-05-11 09:59:25 +00:00
|
|
|
|
const styles = StyleSheet.create({
|
2016-06-01 11:18:36 +00:00
|
|
|
|
baseVertical: {
|
2016-09-26 13:11:49 +00:00
|
|
|
|
flexGrow: 1,
|
2016-09-28 17:02:05 +00:00
|
|
|
|
flexShrink: 1,
|
2016-06-10 06:08:05 +00:00
|
|
|
|
flexDirection: 'column',
|
2016-09-26 13:11:49 +00:00
|
|
|
|
overflow: 'scroll',
|
2016-06-01 11:18:36 +00:00
|
|
|
|
},
|
|
|
|
|
baseHorizontal: {
|
2016-09-26 13:11:49 +00:00
|
|
|
|
flexGrow: 1,
|
2016-09-28 17:02:05 +00:00
|
|
|
|
flexShrink: 1,
|
2016-06-01 11:18:36 +00:00
|
|
|
|
flexDirection: 'row',
|
2016-09-26 13:11:49 +00:00
|
|
|
|
overflow: 'scroll',
|
2015-02-20 04:10:52 +00:00
|
|
|
|
},
|
|
|
|
|
contentContainerHorizontal: {
|
|
|
|
|
flexDirection: 'row',
|
|
|
|
|
},
|
|
|
|
|
});
|
|
|
|
|
|
2017-02-02 17:51:19 +00:00
|
|
|
|
let nativeOnlyProps, AndroidScrollView, AndroidHorizontalScrollView, RCTScrollView, RCTScrollContentView;
|
2015-03-09 16:28:54 +00:00
|
|
|
|
if (Platform.OS === 'android') {
|
2016-05-11 09:59:25 +00:00
|
|
|
|
nativeOnlyProps = {
|
2016-04-28 14:43:24 +00:00
|
|
|
|
nativeOnly: {
|
|
|
|
|
sendMomentumEvents: true,
|
|
|
|
|
}
|
|
|
|
|
};
|
2016-05-11 09:59:25 +00:00
|
|
|
|
AndroidScrollView = requireNativeComponent('RCTScrollView', ScrollView, nativeOnlyProps);
|
|
|
|
|
AndroidHorizontalScrollView = requireNativeComponent(
|
2015-11-18 16:24:26 +00:00
|
|
|
|
'AndroidHorizontalScrollView',
|
2016-03-24 12:42:40 +00:00
|
|
|
|
ScrollView,
|
|
|
|
|
nativeOnlyProps
|
2015-11-18 16:24:26 +00:00
|
|
|
|
);
|
2015-03-09 16:28:54 +00:00
|
|
|
|
} else if (Platform.OS === 'ios') {
|
2016-05-11 09:59:25 +00:00
|
|
|
|
nativeOnlyProps = {
|
2016-04-28 14:43:24 +00:00
|
|
|
|
nativeOnly: {
|
|
|
|
|
onMomentumScrollBegin: true,
|
|
|
|
|
onMomentumScrollEnd : true,
|
|
|
|
|
onScrollBeginDrag: true,
|
|
|
|
|
onScrollEndDrag: true,
|
|
|
|
|
}
|
|
|
|
|
};
|
2016-05-11 09:59:25 +00:00
|
|
|
|
RCTScrollView = requireNativeComponent('RCTScrollView', ScrollView, nativeOnlyProps);
|
2017-02-02 17:51:19 +00:00
|
|
|
|
RCTScrollContentView = requireNativeComponent('RCTScrollContentView', View);
|
2015-03-09 16:28:54 +00:00
|
|
|
|
}
|
2015-02-20 04:10:52 +00:00
|
|
|
|
|
|
|
|
|
module.exports = ScrollView;
|