mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-04-24 04:16:00 +08:00
Add support for flashScrollIndicators on iOS
Summary: Flashing scroll indicators is a standard behavior on iOS to show the user there's more content. Launch RNTester on iOS, go to the ScrollView section, tap the "Flash scroll indicators" button. You'll see this:  I've exposed the method `flashScrollIndicators` on all scrolling components that were already exposing a `scrollToXXX` method so it's usable from those components using a ref. Let me know what you think. Closes https://github.com/facebook/react-native/pull/14058 Differential Revision: D5103239 Pulled By: shergin fbshipit-source-id: caad8474fbe475065418d771b17e4ea9766ffcdc
This commit is contained in:
committed by
Facebook Github Bot
parent
7ee8dd788f
commit
5114b61b5e
@@ -342,6 +342,15 @@ class FlatList<ItemT> extends React.PureComponent<DefaultProps, Props<ItemT>, vo
|
||||
this._listRef.recordInteraction();
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays the scroll indicators momentarily.
|
||||
*
|
||||
* @platform ios
|
||||
*/
|
||||
flashScrollIndicators() {
|
||||
this._listRef.flashScrollIndicators();
|
||||
}
|
||||
|
||||
/**
|
||||
* Provides a handle to the underlying scroll responder.
|
||||
*/
|
||||
|
||||
@@ -292,6 +292,17 @@ var ListView = React.createClass({
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Displays the scroll indicators momentarily.
|
||||
*
|
||||
* @platform ios
|
||||
*/
|
||||
flashScrollIndicators: function() {
|
||||
if (this._scrollComponent && this._scrollComponent.flashScrollIndicators) {
|
||||
this._scrollComponent.flashScrollIndicators();
|
||||
}
|
||||
},
|
||||
|
||||
setNativeProps: function(props: Object) {
|
||||
if (this._scrollComponent) {
|
||||
this._scrollComponent.setNativeProps(props);
|
||||
|
||||
@@ -283,6 +283,16 @@ class SectionList<SectionT: SectionBase<any>>
|
||||
listRef && listRef.recordInteraction();
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays the scroll indicators momentarily.
|
||||
*
|
||||
* @platform ios
|
||||
*/
|
||||
flashScrollIndicators() {
|
||||
const listRef = this._wrapperListRef && this._wrapperListRef.getListRef();
|
||||
listRef && listRef.flashScrollIndicators();
|
||||
}
|
||||
|
||||
/**
|
||||
* Provides a handle to the underlying scroll responder.
|
||||
*/
|
||||
|
||||
@@ -260,6 +260,10 @@ class VirtualizedList extends React.PureComponent<OptionalProps, Props, State> {
|
||||
this._updateViewableItems(this.props.data);
|
||||
}
|
||||
|
||||
flashScrollIndicators() {
|
||||
this._scrollRef.flashScrollIndicators();
|
||||
}
|
||||
|
||||
/**
|
||||
* Provides a handle to the underlying scroll responder.
|
||||
* Note that `this._scrollRef` might not be a `ScrollView`, so we
|
||||
|
||||
Reference in New Issue
Block a user