mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-06-28 22:30:01 +00:00
Update react-native-snap-carousel to v2.1.4 (#16669)
This commit is contained in:
9
types/react-native-snap-carousel/index.d.ts
vendored
9
types/react-native-snap-carousel/index.d.ts
vendored
@@ -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
|
||||
*/
|
||||
|
||||
@@ -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({
|
||||
|
||||
Reference in New Issue
Block a user