@@ -2,72 +2,69 @@ import _ from 'lodash';
2
2
import React , { Component , useCallback } from 'react' ;
3
3
import {
4
4
Animated ,
5
- ScrollView ,
6
- FlatList ,
7
5
FlatListProps ,
8
6
ImageSourcePropType ,
9
7
NativeSyntheticEvent ,
10
8
NativeScrollEvent ,
11
9
LayoutChangeEvent
12
10
} from 'react-native' ;
11
+ import { ScrollView , FlatList } from 'react-native-gesture-handler' ;
13
12
import { Colors } from '../../style' ;
14
13
import { Constants , asBaseComponent , forwardRef , ForwardRefInjectedProps } from '../../commons/new' ;
15
14
import View from '../view' ;
16
15
import Image from '../image' ;
17
16
18
-
19
17
export interface ScrollBarProps extends FlatListProps < any > {
20
18
/**
21
- * Whether to use a FlatList. NOTE: you must pass 'data' and 'renderItem' props as well
22
- */
23
- useList ?: boolean ,
24
- /**
25
- * The element to use as a container, instead of a View
26
- */
27
- containerView ?: React . ComponentClass ,
28
- /**
29
- * The props to pass the container
30
- */
31
- containerProps ?: object ,
32
- /**
33
- * The component's height
34
- */
35
- height ?: number ,
36
- /**
37
- * The gradient's height, defaults to the component's height
38
- */
39
- gradientHeight ?: number ,
40
- /**
41
- * The gradient's width
42
- */
43
- gradientWidth ?: number ,
44
- /**
45
- * The gradient's margins for the edge
46
- */
47
- gradientMargins ?: number ,
48
- /**
49
- * The gradient's tint color
50
- */
51
- gradientColor ?: string ,
52
- /**
53
- * The gradient's image, instead of the default image.
54
- * NOTE: pass an image for the right-hand side and it will be flipped to match the left-hand side
55
- */
56
- gradientImage ?: ImageSourcePropType ,
57
- /**
58
- * The index to currently focus on
59
- */
60
- focusIndex ?: number
19
+ * Whether to use a FlatList. NOTE: you must pass 'data' and 'renderItem' props as well
20
+ */
21
+ useList ?: boolean ;
22
+ /**
23
+ * The element to use as a container, instead of a View
24
+ */
25
+ containerView ?: React . ComponentClass ;
26
+ /**
27
+ * The props to pass the container
28
+ */
29
+ containerProps ?: object ;
30
+ /**
31
+ * The component's height
32
+ */
33
+ height ?: number ;
34
+ /**
35
+ * The gradient's height, defaults to the component's height
36
+ */
37
+ gradientHeight ?: number ;
38
+ /**
39
+ * The gradient's width
40
+ */
41
+ gradientWidth ?: number ;
42
+ /**
43
+ * The gradient's margins for the edge
44
+ */
45
+ gradientMargins ?: number ;
46
+ /**
47
+ * The gradient's tint color
48
+ */
49
+ gradientColor ?: string ;
50
+ /**
51
+ * The gradient's image, instead of the default image.
52
+ * NOTE: pass an image for the right-hand side and it will be flipped to match the left-hand side
53
+ */
54
+ gradientImage ?: ImageSourcePropType ;
55
+ /**
56
+ * The index to currently focus on
57
+ */
58
+ focusIndex ?: number ;
61
59
}
62
60
63
61
type Props = ScrollBarProps & ForwardRefInjectedProps ;
64
62
65
63
type State = {
66
- gradientOpacity : Animated . Value ,
67
- gradientOpacityLeft : Animated . Value
64
+ gradientOpacity : Animated . Value ;
65
+ gradientOpacityLeft : Animated . Value ;
68
66
} ;
69
67
70
-
71
68
const GRADIENT_WIDTH = 76 ;
72
69
const defaultImage = ( ) => require ( './assets/gradientOverlay.png' ) ;
73
70
@@ -267,7 +264,8 @@ class ScrollBar extends Component<Props, State> {
267
264
const Item = ( { children, index, onLayout} : any ) => {
268
265
const onItemLayout = useCallback ( ( { nativeEvent : { layout} } : LayoutChangeEvent ) => {
269
266
onLayout ( { layout, index} ) ;
270
- } , [ children ] ) ;
267
+ } ,
268
+ [ children ] ) ;
271
269
272
270
return (
273
271
< View flexG onLayout = { onItemLayout } >
@@ -279,4 +277,3 @@ const Item = ({children, index, onLayout}: any) => {
279
277
Item . displayName = 'IGNORE' ;
280
278
ScrollBar . Item = Item ;
281
279
export default asBaseComponent < ScrollBarProps , typeof ScrollBar > ( forwardRef ( ScrollBar ) ) ;
282
-
0 commit comments