1
1
import { logger } from '@sentry/core' ;
2
2
import * as React from 'react' ;
3
- import { Animated , Dimensions , KeyboardAvoidingView , Modal , PanResponder , Platform } from 'react-native' ;
3
+ import { Animated , Dimensions , Easing , KeyboardAvoidingView , Modal , PanResponder , Platform } from 'react-native' ;
4
4
5
5
import { FeedbackWidget } from './FeedbackWidget' ;
6
6
import { modalBackground , modalSheetContainer , modalWrapper } from './FeedbackWidget.styles' ;
@@ -10,7 +10,7 @@ import { isModalSupported } from './utils';
10
10
11
11
const PULL_DOWN_CLOSE_THREESHOLD = 200 ;
12
12
const PULL_DOWN_ANDROID_ACTIVATION_HEIGHT = 150 ;
13
- const SLIDE_ANIMATION_DURATION = 150 ;
13
+ const SLIDE_ANIMATION_DURATION = 200 ;
14
14
const BACKGROUND_ANIMATION_DURATION = 200 ;
15
15
16
16
class FeedbackWidgetManager {
@@ -104,11 +104,13 @@ class FeedbackWidgetProvider extends React.Component<FeedbackWidgetProviderProps
104
104
toValue : 1 ,
105
105
duration : BACKGROUND_ANIMATION_DURATION ,
106
106
useNativeDriver : true ,
107
+ easing : Easing . in ( Easing . quad ) ,
107
108
} ) ,
108
109
Animated . timing ( this . state . panY , {
109
110
toValue : 0 ,
110
111
duration : SLIDE_ANIMATION_DURATION ,
111
112
useNativeDriver : true ,
113
+ easing : Easing . in ( Easing . quad ) ,
112
114
} )
113
115
] ) . start ( ( ) => {
114
116
logger . info ( 'FeedbackWidgetProvider componentDidUpdate' ) ;
@@ -164,22 +166,31 @@ class FeedbackWidgetProvider extends React.Component<FeedbackWidgetProviderProps
164
166
}
165
167
166
168
private _setVisibilityFunction = ( visible : boolean ) : void => {
167
- Animated . parallel ( [
168
- Animated . timing ( this . state . panY , {
169
- toValue : Dimensions . get ( 'screen' ) . height ,
170
- duration : SLIDE_ANIMATION_DURATION ,
171
- useNativeDriver : true ,
172
- } ) ,
173
- Animated . timing ( this . state . backgroundOpacity , {
174
- toValue : 0 ,
175
- duration : BACKGROUND_ANIMATION_DURATION ,
176
- useNativeDriver : true ,
177
- } )
178
- ] ) . start ( ( ) => {
179
- // Change of the state unmount the component
180
- // which would cancel the animation
169
+ const updateState = ( ) : void => {
181
170
this . setState ( { isVisible : visible } ) ;
182
- } ) ;
171
+ } ;
172
+ if ( ! visible ) {
173
+ Animated . parallel ( [
174
+ Animated . timing ( this . state . panY , {
175
+ toValue : Dimensions . get ( 'screen' ) . height ,
176
+ duration : SLIDE_ANIMATION_DURATION ,
177
+ useNativeDriver : true ,
178
+ easing : Easing . out ( Easing . quad ) ,
179
+ } ) ,
180
+ Animated . timing ( this . state . backgroundOpacity , {
181
+ toValue : 0 ,
182
+ duration : BACKGROUND_ANIMATION_DURATION ,
183
+ useNativeDriver : true ,
184
+ easing : Easing . out ( Easing . quad ) ,
185
+ } )
186
+ ] ) . start ( ( ) => {
187
+ // Change of the state unmount the component
188
+ // which would cancel the animation
189
+ updateState ( ) ;
190
+ } ) ;
191
+ } else {
192
+ updateState ( ) ;
193
+ }
183
194
} ;
184
195
185
196
private _handleClose = ( ) : void => {
0 commit comments