Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Make modal style configurable
  • Loading branch information
antonis committed Jan 27, 2025
commit 2d4abb37a3a0612d740b98d75539adf3184cc7d2
4 changes: 4 additions & 0 deletions packages/core/src/js/feedback/FeedbackForm.styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,10 @@ const defaultStyles: FeedbackFormStyles = {
width: 40,
height: 40,
},
modalBackground: {
flex: 1,
justifyContent: 'center',
},
};

export default defaultStyles;
1 change: 1 addition & 0 deletions packages/core/src/js/feedback/FeedbackForm.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,7 @@ export interface FeedbackFormStyles {
screenshotText?: TextStyle;
titleContainer?: ViewStyle;
sentryLogo?: ImageStyle;
modalBackground?: ViewStyle;
}

/**
Expand Down
14 changes: 5 additions & 9 deletions packages/core/src/js/feedback/FeedbackFormManager.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import * as React from 'react';
import { Modal, StyleSheet,View } from 'react-native';
import { Modal, View } from 'react-native';

import { FeedbackForm } from './FeedbackForm';
import defaultStyles from './FeedbackForm.styles';
import type { FeedbackFormStyles } from './FeedbackForm.types';

class FeedbackFormManager {
private static _isVisible = false;
Expand Down Expand Up @@ -32,6 +34,7 @@ class FeedbackFormManager {

interface FeedbackFormProviderProps {
children: React.ReactNode;
styles?: FeedbackFormStyles;
}

class FeedbackFormProvider extends React.Component<FeedbackFormProviderProps> {
Expand All @@ -49,6 +52,7 @@ class FeedbackFormProvider extends React.Component<FeedbackFormProviderProps> {
*/
public render(): React.ReactNode {
const { isVisible } = this.state;
const styles: FeedbackFormStyles = { ...defaultStyles, ...this.props.styles };

// Wrapping the `Modal` component in a `View` component is necessary to avoid
// issues like https://github.com/software-mansion/react-native-reanimated/issues/6035
Expand Down Expand Up @@ -85,12 +89,4 @@ const showFeedbackForm = (): void => {
FeedbackFormManager.show();
};

const styles = StyleSheet.create({
modalBackground: {
flex: 1,
justifyContent: 'center',
backgroundColor: 'rgba(0,0,0,0.5)',
},
});

export { showFeedbackForm, FeedbackFormProvider };
Loading