Update react-native-snap-carousel to v2.1.4 (#16669)

This commit is contained in:
jnbt
2017-06-02 16:23:57 +02:00
committed by Andy
parent 48250e2191
commit dce014e31d
2 changed files with 16 additions and 0 deletions

View File

@@ -7,6 +7,8 @@
import * as React from 'react';
import {
Animated,
NativeSyntheticEvent,
NativeScrollEvent,
ScrollViewProperties,
ScrollViewStyle,
ViewStyle
@@ -110,6 +112,13 @@ export interface CarouselProps extends React.Props<ScrollViewProperties> {
// Callbacks
/**
* Callback fired while scrolling; direct equivalent of ScrollView's onScroll
* Since onScroll is overriden by plugin's implementation, you should use prop onScrollViewScroll
* if you need a callback while scrolling.
*/
onScrollViewScroll?(event: NativeSyntheticEvent<NativeScrollEvent>): void;
/**
* Callback fired when navigating to an item
*/

View File

@@ -1,5 +1,7 @@
import * as React from 'react';
import {
NativeSyntheticEvent,
NativeScrollEvent,
StyleSheet,
Text,
View,
@@ -23,6 +25,7 @@ class SnapCarouselTest extends React.Component<{}, {}> {
enableMomentum={true}
keyboardDismissMode='interactive'
onSnapToItem={this.onSnapToItem}
onScrollViewScroll={this.onScroll}
>
<View
style={styles.item}
@@ -37,6 +40,10 @@ class SnapCarouselTest extends React.Component<{}, {}> {
private onSnapToItem = (index: number) => {
console.log("Snapped to: ", index);
}
private onScroll = (event: NativeSyntheticEvent<NativeScrollEvent>) => {
console.log("Scrolled: ", event);
}
}
const styles = StyleSheet.create({