Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@
> make sure you follow our [migration guide](https://docs.sentry.io/platforms/react-native/migration/) first.
<!-- prettier-ignore-end -->

## Unreleased

### Fixes

- Disable native driver for Feedback Widget `backgroundColor` animation in unsupported React Native versions ([#4794](https://github.com/getsentry/sentry-react-native/pull/4794))

## 6.13.0

### Changes
Expand Down
8 changes: 5 additions & 3 deletions packages/core/src/js/feedback/FeedbackWidgetManager.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,14 @@ import { modalSheetContainer, modalWrapper, topSpacer } from './FeedbackWidget.s
import type { FeedbackWidgetStyles } from './FeedbackWidget.types';
import { getFeedbackOptions } from './integration';
import { lazyLoadAutoInjectFeedbackIntegration } from './lazy';
import { isModalSupported } from './utils';
import { isModalSupported, isNativeDriverSupportedForColorAnimations } from './utils';

const PULL_DOWN_CLOSE_THRESHOLD = 200;
const SLIDE_ANIMATION_DURATION = 200;
const BACKGROUND_ANIMATION_DURATION = 200;

const useNativeDriverForColorAnimations = isNativeDriverSupportedForColorAnimations();

class FeedbackWidgetManager {
private static _isVisible = false;
private static _setVisibility: (visible: boolean) => void;
Expand Down Expand Up @@ -124,7 +126,7 @@ class FeedbackWidgetProvider extends React.Component<FeedbackWidgetProviderProps
Animated.timing(this.state.backgroundOpacity, {
toValue: 1,
duration: BACKGROUND_ANIMATION_DURATION,
useNativeDriver: true,
useNativeDriver: useNativeDriverForColorAnimations,
easing: Easing.in(Easing.quad),
}),
Animated.timing(this.state.panY, {
Expand Down Expand Up @@ -206,7 +208,7 @@ class FeedbackWidgetProvider extends React.Component<FeedbackWidgetProviderProps
Animated.timing(this.state.backgroundOpacity, {
toValue: 0,
duration: BACKGROUND_ANIMATION_DURATION,
useNativeDriver: true,
useNativeDriver: useNativeDriverForColorAnimations,
easing: Easing.out(Easing.quad),
})
]).start(() => {
Expand Down
9 changes: 9 additions & 0 deletions packages/core/src/js/feedback/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,15 @@ export function isModalSupported(): boolean {
return !(isFabricEnabled() && major === 0 && minor < 71);
}

/**
* The native driver supports color animations since React Native 0.69.
* ref: https://github.com/facebook/react-native/commit/201f355479cafbcece3d9eb40a52bae003da3e5c
*/
export function isNativeDriverSupportedForColorAnimations(): boolean {
const { major, minor } = ReactNativeLibraries.ReactNativeVersion?.version || {};
return major > 0 || minor >= 69;
}

export const isValidEmail = (email: string): boolean => {
const emailRegex = /^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/;
return emailRegex.test(email);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import { getDefaultTestClientOptions, TestClient } from '../mocks/client';

jest.mock('../../src/js/feedback/utils', () => ({
isModalSupported: jest.fn(),
isNativeDriverSupportedForColorAnimations: jest.fn().mockReturnValue(true),
}));

const consoleWarnSpy = jest.spyOn(console, 'warn');
Expand Down
Loading