-
Notifications
You must be signed in to change notification settings - Fork 2.3k
/
index.d.ts
147 lines (137 loc) · 5.05 KB
/
index.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
import {
ViewStyle,
StyleProp,
NativeSyntheticEvent,
NativeScrollEvent,
ScrollViewProps
} from 'react-native'
import { Component } from 'react'
declare module 'react-native-swiper' {
interface SwiperState {
autoplayEnd: false
loopJump: false
width: number
height: number
offset: {
x: number
y: number
}
total: number
index: number
dir: 'x' | 'y'
}
interface SwiperInternals extends SwiperState {
isScrolling: boolean
}
interface SwiperProps
extends Omit<ScrollViewProps, 'onScrollBeginDrag' | 'onMomentumScrollEnd'> {
// Basic
// If true, the scroll view's children are arranged horizontally in a row instead of vertically in a column.
horizontal?: boolean
// If no specify default enable fullscreen mode by flex: 1.
loop?: boolean
// Index number of initial slide.
index?: number
// Set to true make control buttons visible.
showsButtons?: boolean
// Set to false to disable continuous loop mode.
autoplay?: boolean
// Called with the new index when the user swiped
onIndexChanged?: (index: number) => void
// Custom basic style & content
// Set to true enable auto play mode.
width?: number
// If no specify default fullscreen mode by flex: 1.
height?: number
// See default style in source.
style?: StyleProp<ViewStyle>
// Customize the View container.
containerStyle?: StyleProp<ViewStyle>
// Only load current index slide , loadMinimalSize slides before and after.
loadMinimal?: boolean
// see loadMinimal
loadMinimalSize?: number
// Custom loader to display when slides aren't loaded
loadMinimalLoader?: React.ReactNode
// Pagination
// Set to true make pagination visible.
showsPagination?: boolean
// Custom styles will merge with the default styles.
paginationStyle?: StyleProp<ViewStyle>
// Complete control how to render pagination with three params (index, total, context) ref to this.state.index / this.state.total / this, For example: show numbers instead of dots.
renderPagination?: (
index: number,
total: number,
swiper: Swiper
) => React.ReactNode
// Allow custom the dot element.
dot?: React.ReactNode
// Allow custom the active-dot element.
activeDot?: React.ReactNode
// Allow custom the active-dot element.
dotStyle?: StyleProp<ViewStyle>
// Allow custom the active-dot element.
dotColor?: string
// Allow custom the active-dot element.
activeDotColor?: string
// Allow custom the active-dot element.
activeDotStyle?: StyleProp<ViewStyle>
// Autoplay
// Delay between auto play transitions (in second).
autoplayTimeout?: number
// Cycle direction control.
autoplayDirection?: boolean
// Control buttons
// Set to true make control buttons visible.
buttonWrapperStyle?: StyleProp<ViewStyle>
// Allow custom the next button.
nextButton?: React.ReactNode
// Allow custom the prev button.
prevButton?: React.ReactNode
// Supported ScrollResponder
// When animation begins after letting up
onScrollBeginDrag?: (
e: NativeSyntheticEvent<NativeScrollEvent>,
state: SwiperInternals,
swiper: Swiper
) => void
// Makes no sense why this occurs first during bounce
onMomentumScrollEnd?: (
e: NativeSyntheticEvent<NativeScrollEvent>,
state: SwiperInternals,
swiper: Swiper
) => void
// Immediately after onMomentumScrollEnd
onTouchStartCapture?: any
// Same, but bubble phase
onTouchStart?: any
// You could hold the touch start for a long time
onTouchEnd?: any
// When lifting up - you could pause forever before * lifting
onResponderRelease?: any
// If true, the scroll view stops on multiples of the scroll view's size when scrolling. This can be used for
// horizontal pagination.
pagingEnabled?: boolean
// Set to true if you want to show horizontal scroll bar.
showsHorizontalScrollIndicator?: boolean
// Set to true if you want to show vertical scroll bar.
showsVerticalScrollIndicator?: boolean
// If 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. If false, it disables all bouncing even if the
// alwaysBounce* props are true.
bounces?: boolean
// If true, the scroll view scrolls to top when the status bar is tapped.
scrollsToTop?: boolean
// If true, offscreen child views (whose overflow value is hidden) are removed from their native backing
// superview when offscreen. This canimprove scrolling performance on long lists.
removeClippedSubviews?: boolean
// Set to true if you need adjust content insets automation.
automaticallyAdjustContentInsets?: boolean
// Enables/Disables swiping
scrollEnabled?: boolean
}
export default class Swiper extends Component<SwiperProps, SwiperState> {
scrollBy: (index?: number, animated?: boolean) => void
scrollTo: (index: number, animated?: boolean) => void
}
}