Skip to content

Commit e192eb4

Browse files
authored
Merge d2dd1f3 into 56a113e
2 parents 56a113e + d2dd1f3 commit e192eb4

File tree

3 files changed

+13
-5
lines changed

3 files changed

+13
-5
lines changed

packages/core/src/js/feedback/FeedbackForm.tsx

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -155,9 +155,17 @@ export class FeedbackForm extends React.Component<FeedbackFormProps, FeedbackFor
155155
} else {
156156
// Defaulting to the onAddScreenshot callback
157157
const { onAddScreenshot } = { ...defaultConfiguration, ...this.props };
158-
onAddScreenshot((filename: string, attachement: Uint8Array) => {
159-
// TODO: Add support for image uri when using onAddScreenshot
160-
this.setState({ filename, attachment: attachement, attachmentUri: undefined }, this._saveFormState);
158+
onAddScreenshot((filename: string, fileUri: string) => {
159+
NATIVE.getDataFromUri(fileUri).then((data) => {
160+
if (data != null) {
161+
this.setState({ filename, attachment: data, attachmentUri: fileUri }, this._saveFormState);
162+
} else {
163+
logger.error('Failed to read image data from uri:', fileUri);
164+
}
165+
})
166+
.catch((error) => {
167+
logger.error('Failed to read image data from uri:', fileUri, 'error: ', error);
168+
});
161169
});
162170
}
163171
} else {

packages/core/src/js/feedback/FeedbackForm.types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ export interface FeedbackCallbacks {
171171
/**
172172
* Callback when a screenshot is added
173173
*/
174-
onAddScreenshot?: (attachFile: (filename: string, data: Uint8Array) => void) => void;
174+
onAddScreenshot?: (attachFile: (filename: string, fileUri: string) => void) => void;
175175

176176
/**
177177
* Callback when feedback is successfully submitted

packages/core/src/js/feedback/defaults.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ export const defaultConfiguration: Partial<FeedbackFormProps> = {
3333
);
3434
}
3535
},
36-
onAddScreenshot: (_: (filename: string, data: Uint8Array) => void) => {
36+
onAddScreenshot: (_: (filename: string, fileUri: string) => void) => {
3737
if (__DEV__) {
3838
Alert.alert('Development note', 'onAddScreenshot callback is not implemented.');
3939
}

0 commit comments

Comments
 (0)