diff --git a/packages/core/src/js/feedback/FeedbackWidget.styles.ts b/packages/core/src/js/feedback/FeedbackWidget.styles.ts index 5b4ee0bc6e..f7adc5f214 100644 --- a/packages/core/src/js/feedback/FeedbackWidget.styles.ts +++ b/packages/core/src/js/feedback/FeedbackWidget.styles.ts @@ -45,8 +45,20 @@ const defaultStyles: FeedbackWidgetStyles = { backgroundColor: '#eee', padding: 15, borderRadius: 5, - marginBottom: 20, alignItems: 'center', + flex: 1, + }, + screenshotContainer: { + flexDirection: 'row', + alignItems: 'center', + width: '100%', + marginBottom: 20, + }, + screenshotThumbnail: { + width: 50, + height: 50, + borderRadius: 5, + marginRight: 10, }, screenshotText: { color: '#333', diff --git a/packages/core/src/js/feedback/FeedbackWidget.tsx b/packages/core/src/js/feedback/FeedbackWidget.tsx index f0026751d3..317c48c3bd 100644 --- a/packages/core/src/js/feedback/FeedbackWidget.tsx +++ b/packages/core/src/js/feedback/FeedbackWidget.tsx @@ -39,6 +39,7 @@ export class FeedbackWidget extends React.Component { if (data != null) { - this.setState({ filename, attachment: data }); + this.setState({ filename, attachment: data, attachmentUri: imageUri }); } else { logger.error('Failed to read image data from uri:', imageUri); } }) - .catch((error) => { - logger.error('Failed to read image data from uri:', imageUri, 'error: ', error); - }); + .catch((error) => { + logger.error('Failed to read image data from uri:', imageUri, 'error: ', error); + }); } } else { // Defaulting to the onAddScreenshot callback const { onAddScreenshot } = { ...defaultConfiguration, ...this.props }; onAddScreenshot((filename: string, attachement: Uint8Array) => { - this.setState({ filename, attachment: attachement }); + // TODO: Add support for image uri when using onAddScreenshot + this.setState({ filename, attachment: attachement, attachmentUri: undefined }); }); } } else { - this.setState({ filename: undefined, attachment: undefined }); + this.setState({ filename: undefined, attachment: undefined, attachmentUri: undefined }); } } @@ -262,13 +265,21 @@ export class FeedbackWidget extends React.Component {(config.enableScreenshot || imagePickerConfiguration.imagePicker) && ( - - - {!this.state.filename && !this.state.attachment - ? text.addScreenshotButtonLabel - : text.removeScreenshotButtonLabel} - - + + {this.state.attachmentUri && ( + + )} + + + {!this.state.filename && !this.state.attachment + ? text.addScreenshotButtonLabel + : text.removeScreenshotButtonLabel} + + + )} {text.submitButtonLabel} @@ -296,6 +307,7 @@ export class FeedbackWidget extends React.Component - - Add a screenshot - + + Add a screenshot + + - - Add Screenshot - + + Add Screenshot + + - - Add a screenshot - + + Add a screenshot + +