Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
bda351c
(1) feat: Add Feedback Form Component (#4328)
antonis Jan 10, 2025
078cb37
Merge branch 'main' into feedback-ui
antonis Jan 10, 2025
7add44c
Merge branch 'main' into feedback-ui
antonis Jan 14, 2025
8709a48
Update changelog PR reference
antonis Jan 14, 2025
08eecba
test: Adds snapshot tests (#4379)
antonis Jan 15, 2025
4529b68
feat: handle `captureFeedback` errors (#4364)
antonis Jan 15, 2025
48ff52e
Merge branch 'main' into feedback-ui
antonis Jan 15, 2025
93b770e
Merge branch 'main' into feedback-ui
antonis Jan 16, 2025
aa15c88
(2.4) feat(feedback-ui): Add screenshots (#4338)
antonis Jan 16, 2025
312116d
Merge branch 'main' into feedback-ui
antonis Jan 20, 2025
f3c3563
Merge branch 'main' into feedback-ui
antonis Jan 22, 2025
b7b36d8
Merge branch 'main' into feedback-ui
antonis Jan 27, 2025
eda1cb7
Autoinject feedback widget (#4483)
antonis Jan 29, 2025
74748f8
Adds feedbackIntegration for configuring the feedback form (#4485)
antonis Jan 30, 2025
df77091
Merge branch 'main' into feedback-ui
antonis Jan 30, 2025
dbdfceb
Merge branch 'main' into feedback-ui
antonis Jan 31, 2025
f8988bc
Merge branch 'main' into feedback-ui
antonis Feb 3, 2025
03ece25
Merge branch 'main' into feedback-ui
antonis Feb 7, 2025
07b3f54
Merge branch 'main' into feedback-ui
antonis Feb 10, 2025
7ec9441
Feedback modal UI tweaks (#4492)
antonis Feb 11, 2025
fe99425
Merge branch 'main' into feedback-ui
antonis Feb 11, 2025
22cde46
Fix changelog
antonis Feb 11, 2025
e17ab11
Feedback UI: Use Image Picker libraries from integrations (#4524)
antonis Feb 14, 2025
fcbc6c6
Merge branch 'main' into feedback-ui
antonis Feb 14, 2025
874b2a2
feat(feedback): Pull down to cancel (#4534)
antonis Feb 17, 2025
7579a06
chore(feedback): Use Widget instead of Form (#4547)
krystofwoldrich Feb 17, 2025
2135c96
chore(feedback): Improve widget animations (#4555)
krystofwoldrich Feb 17, 2025
51dc070
feat(feedback): Save form state for un-submitted data (#4538)
antonis Feb 18, 2025
b3ea2b2
feat(feedback): Show selected screenshot (#4545)
antonis Feb 18, 2025
53e13fc
feat(feedback): Use only image uri in the onAddScreenshot callback (#…
antonis Feb 18, 2025
8ff7db3
Merge branch 'main' into feedback-ui
antonis Feb 18, 2025
ef4be9e
feat(feedback): Support web environments (#4558)
antonis Feb 20, 2025
ee3aa70
misc(feedback): Improve Feedback Sheet interactions (#4571)
krystofwoldrich Feb 20, 2025
ba260a4
feat(feedback): Align secondary buttons with the web (#4572)
antonis Feb 20, 2025
58aa109
Merge branch 'main' into feedback-ui
antonis Feb 20, 2025
ba2eecd
Update changelog
antonis Feb 20, 2025
76f708d
Merge branch 'main' into feedback-ui
antonis Feb 21, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
chore(feedback): Improve widget animations (#4555)
* chore(feedback): Improve widget animations

* add comment

* when widget is about to be shown it should not animate slide down
  • Loading branch information
krystofwoldrich authored Feb 17, 2025
commit 2135c968096a20a0f0cfa57b0bd130dcd45c529b
11 changes: 8 additions & 3 deletions packages/core/src/js/feedback/FeedbackWidget.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,9 @@ export class FeedbackWidget extends React.Component<FeedbackWidgetProps, Feedbac
};

try {
this.setState({ isVisible: false });
if (!onFormSubmitted) {
this.setState({ isVisible: false });
}
captureFeedback(userFeedback, attachments ? { attachments } : undefined);
onSubmitSuccess({ name: trimmedName, email: trimmedEmail, message: trimmedDescription, attachments: undefined });
Alert.alert(text.successMessageText);
Expand Down Expand Up @@ -161,8 +163,11 @@ export class FeedbackWidget extends React.Component<FeedbackWidgetProps, Feedbac
const text: FeedbackTextConfiguration = this.props;
const styles: FeedbackWidgetStyles = { ...defaultStyles, ...this.props.styles };
const onCancel = (): void => {
onFormClose();
this.setState({ isVisible: false });
if (onFormClose) {
onFormClose();
} else {
this.setState({ isVisible: false });
}
}

if (!this.state.isVisible) {
Expand Down
61 changes: 47 additions & 14 deletions packages/core/src/js/feedback/FeedbackWidgetManager.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { logger } from '@sentry/core';
import * as React from 'react';
import { Animated, KeyboardAvoidingView, Modal, PanResponder, Platform } from 'react-native';
import { Animated, Dimensions, Easing, KeyboardAvoidingView, Modal, PanResponder, Platform } from 'react-native';

import { FeedbackWidget } from './FeedbackWidget';
import { modalBackground, modalSheetContainer, modalWrapper } from './FeedbackWidget.styles';
Expand All @@ -10,6 +10,8 @@ import { isModalSupported } from './utils';

const PULL_DOWN_CLOSE_THREESHOLD = 200;
const PULL_DOWN_ANDROID_ACTIVATION_HEIGHT = 150;
const SLIDE_ANIMATION_DURATION = 200;
const BACKGROUND_ANIMATION_DURATION = 200;

class FeedbackWidgetManager {
private static _isVisible = false;
Expand Down Expand Up @@ -53,7 +55,7 @@ class FeedbackWidgetProvider extends React.Component<FeedbackWidgetProviderProps
public state: FeedbackWidgetProviderState = {
isVisible: false,
backgroundOpacity: new Animated.Value(0),
panY: new Animated.Value(0),
panY: new Animated.Value(Dimensions.get('screen').height),
};

private _panResponder = PanResponder.create({
Expand All @@ -72,8 +74,8 @@ class FeedbackWidgetProvider extends React.Component<FeedbackWidgetProviderProps
onPanResponderRelease: (_, gestureState) => {
if (gestureState.dy > PULL_DOWN_CLOSE_THREESHOLD) { // Close on swipe below a certain threshold
Animated.timing(this.state.panY, {
toValue: 600,
duration: 200,
toValue: Dimensions.get('screen').height,
duration: SLIDE_ANIMATION_DURATION,
useNativeDriver: true,
}).start(() => {
this._handleClose();
Expand All @@ -97,11 +99,22 @@ class FeedbackWidgetProvider extends React.Component<FeedbackWidgetProviderProps
*/
public componentDidUpdate(_prevProps: any, prevState: FeedbackWidgetProviderState): void {
if (!prevState.isVisible && this.state.isVisible) {
Animated.timing(this.state.backgroundOpacity, {
toValue: 1,
duration: 300,
useNativeDriver: true,
}).start();
Animated.parallel([
Animated.timing(this.state.backgroundOpacity, {
toValue: 1,
duration: BACKGROUND_ANIMATION_DURATION,
useNativeDriver: true,
easing: Easing.in(Easing.quad),
}),
Animated.timing(this.state.panY, {
toValue: 0,
duration: SLIDE_ANIMATION_DURATION,
useNativeDriver: true,
easing: Easing.in(Easing.quad),
})
]).start(() => {
logger.info('FeedbackWidgetProvider componentDidUpdate');
});
} else if (prevState.isVisible && !this.state.isVisible) {
this.state.backgroundOpacity.setValue(0);
}
Expand Down Expand Up @@ -130,7 +143,7 @@ class FeedbackWidgetProvider extends React.Component<FeedbackWidgetProviderProps
{this.props.children}
{isVisible && (
<Animated.View style={[modalWrapper, { backgroundColor }]} >
<Modal visible={isVisible} transparent animationType="slide" onRequestClose={this._handleClose} testID="feedback-form-modal">
<Modal visible={isVisible} transparent animationType="none" onRequestClose={this._handleClose} testID="feedback-form-modal">
<KeyboardAvoidingView
behavior={Platform.OS === 'ios' ? 'padding' : 'height'}
style={modalBackground}
Expand All @@ -153,15 +166,35 @@ class FeedbackWidgetProvider extends React.Component<FeedbackWidgetProviderProps
}

private _setVisibilityFunction = (visible: boolean): void => {
this.setState({ isVisible: visible });
if (visible) {
this.state.panY.setValue(0);
const updateState = (): void => {
this.setState({ isVisible: visible });
};
if (!visible) {
Animated.parallel([
Animated.timing(this.state.panY, {
toValue: Dimensions.get('screen').height,
duration: SLIDE_ANIMATION_DURATION,
useNativeDriver: true,
easing: Easing.out(Easing.quad),
}),
Animated.timing(this.state.backgroundOpacity, {
toValue: 0,
duration: BACKGROUND_ANIMATION_DURATION,
useNativeDriver: true,
easing: Easing.out(Easing.quad),
})
]).start(() => {
// Change of the state unmount the component
// which would cancel the animation
updateState();
});
} else {
updateState();
}
};

private _handleClose = (): void => {
FeedbackWidgetManager.hide();
this.setState({ isVisible: false });
};
}

Expand Down
Loading