@@ -77,7 +77,7 @@ export const DraggablePanel = React.forwardRef<
77
77
// eslint-disable-next-line react-hooks/exhaustive-deps
78
78
} , [ visible ] ) ;
79
79
80
- const show = React . useCallback ( ( ) => {
80
+ const show = ( ) => {
81
81
if ( ! animating ) {
82
82
animatedValue . setValue ( 0 ) ;
83
83
setInnerContentHeight ( Math . min ( initialHeight , DEFAULT_PANEL_HEIGHT ) ) ;
@@ -96,9 +96,9 @@ export const DraggablePanel = React.forwardRef<
96
96
setAnimating ( false ) ;
97
97
} ) ;
98
98
}
99
- } , [ animatedValue , animating , animationDuration , height , initialHeight ] ) ;
99
+ } ;
100
100
101
- const hide = React . useCallback ( ( ) => {
101
+ const hide = ( ) => {
102
102
if ( ! animating ) {
103
103
setAnimating ( true ) ;
104
104
Animated . timing ( animatedValue , {
@@ -116,9 +116,9 @@ export const DraggablePanel = React.forwardRef<
116
116
onDismiss && onDismiss ( ) ;
117
117
} ) ;
118
118
}
119
- } , [ animatedValue , animating , animationDuration , onDismiss ] ) ;
119
+ } ;
120
120
121
- const onBackButtonPress = React . useCallback ( ( ) => {
121
+ const onBackButtonPress = ( ) => {
122
122
if (
123
123
Platform . OS === 'android' &&
124
124
hideOnBackButtonPressed &&
@@ -127,7 +127,7 @@ export const DraggablePanel = React.forwardRef<
127
127
) {
128
128
hide ( ) ;
129
129
}
130
- } , [ hideOnBackButtonPressed , animating , popupVisible , hide ] ) ;
130
+ } ;
131
131
132
132
React . useImperativeHandle <
133
133
ReactNativeDraggablePanelRef ,
@@ -137,51 +137,46 @@ export const DraggablePanel = React.forwardRef<
137
137
hide,
138
138
} ) ) ;
139
139
140
- const onScroll = React . useCallback (
141
- ( event : NativeSyntheticEvent < NativeScrollEvent > ) => {
142
- if ( ! animating ) {
143
- const { y} = event . nativeEvent . contentOffset ;
144
- if (
145
- ! expandable &&
146
- y < SCREEN_HEIGHT - ( SCREEN_HEIGHT * height ) / DEFAULT_PANEL_HEIGHT
147
- ) {
148
- return ;
149
- }
150
- animatedValue . setValue ( 1 - Math . floor ( y ) / Math . floor ( SCREEN_HEIGHT ) ) ;
151
- // >= Fix the android issue, cause for some reason it goes for more than SCREEN_HEIGHT
152
- // if the use swipes faster
153
- if ( Math . floor ( y ) >= Math . floor ( SCREEN_HEIGHT ) ) {
154
- togglePopupVisibility ( false ) ;
155
- setAnimating ( false ) ;
156
- onDismiss && onDismiss ( ) ;
157
- }
140
+ const onScroll = ( event : NativeSyntheticEvent < NativeScrollEvent > ) => {
141
+ if ( ! animating ) {
142
+ const { y} = event . nativeEvent . contentOffset ;
143
+ if (
144
+ ! expandable &&
145
+ y < SCREEN_HEIGHT - ( SCREEN_HEIGHT * height ) / DEFAULT_PANEL_HEIGHT
146
+ ) {
147
+ return ;
158
148
}
159
- } ,
160
- [ animatedValue , animating , expandable , height , onDismiss ] ,
161
- ) ;
162
-
163
- const onScrollBeginDrag = React . useCallback (
164
- ( e : NativeSyntheticEvent < NativeScrollEvent > ) => {
165
- if ( e . nativeEvent . contentOffset . y !== 0 && expandable ) {
166
- setInnerContentHeight ( DEFAULT_PANEL_HEIGHT ) ;
149
+ animatedValue . setValue ( 1 - Math . floor ( y ) / Math . floor ( SCREEN_HEIGHT ) ) ;
150
+ // >= Fix the android issue, cause for some reason it goes for more than SCREEN_HEIGHT
151
+ // if the use swipes faster
152
+ if ( Math . floor ( y ) >= Math . floor ( SCREEN_HEIGHT ) ) {
153
+ togglePopupVisibility ( false ) ;
154
+ setAnimating ( false ) ;
155
+ onDismiss && onDismiss ( ) ;
167
156
}
168
- } ,
169
- [ expandable ] ,
170
- ) ;
157
+ }
158
+ } ;
159
+
160
+ const onScrollBeginDrag = (
161
+ event : NativeSyntheticEvent < NativeScrollEvent > ,
162
+ ) => {
163
+ if ( event . nativeEvent . contentOffset . y !== 0 && expandable ) {
164
+ setInnerContentHeight ( DEFAULT_PANEL_HEIGHT ) ;
165
+ }
166
+ } ;
171
167
172
- const onMomentumScrollEnd = React . useCallback (
173
- ( e : NativeSyntheticEvent < NativeScrollEvent > ) => {
174
- if ( expandable ) {
175
- const { y } = e . nativeEvent . contentOffset ;
176
- if ( y !== 0 ) {
177
- setInnerContentHeight ( height ) ;
178
- } else {
179
- setInnerContentHeight ( DEFAULT_PANEL_HEIGHT ) ;
180
- }
168
+ const onMomentumScrollEnd = (
169
+ event : NativeSyntheticEvent < NativeScrollEvent > ,
170
+ ) => {
171
+ if ( expandable ) {
172
+ const { y } = event . nativeEvent . contentOffset ;
173
+ if ( y !== 0 ) {
174
+ setInnerContentHeight ( height ) ;
175
+ } else {
176
+ setInnerContentHeight ( DEFAULT_PANEL_HEIGHT ) ;
181
177
}
182
- } ,
183
- [ height , expandable ] ,
184
- ) ;
178
+ }
179
+ } ;
185
180
186
181
return (
187
182
< Modal
0 commit comments