@@ -40,6 +40,7 @@ export class FeedbackForm extends React.Component<FeedbackFormProps, FeedbackFor
40
40
description : '' ,
41
41
filename : undefined ,
42
42
attachment : undefined ,
43
+ attachmentUri : undefined ,
43
44
} ;
44
45
45
46
public constructor ( props : FeedbackFormProps ) {
@@ -59,6 +60,7 @@ export class FeedbackForm extends React.Component<FeedbackFormProps, FeedbackFor
59
60
description : FeedbackForm . _savedState . description || '' ,
60
61
filename : FeedbackForm . _savedState . filename || undefined ,
61
62
attachment : FeedbackForm . _savedState . attachment || undefined ,
63
+ attachmentUri : FeedbackForm . _savedState . attachmentUri || undefined ,
62
64
} ;
63
65
}
64
66
@@ -141,7 +143,7 @@ export class FeedbackForm extends React.Component<FeedbackFormProps, FeedbackFor
141
143
const imageUri = result . assets [ 0 ] . uri ;
142
144
NATIVE . getDataFromUri ( imageUri ) . then ( ( data ) => {
143
145
if ( data != null ) {
144
- this . setState ( { filename, attachment : data } , this . _saveFormState ) ;
146
+ this . setState ( { filename, attachment : data , attachmentUri : imageUri } , this . _saveFormState ) ;
145
147
} else {
146
148
logger . error ( 'Failed to read image data from uri:' , imageUri ) ;
147
149
}
@@ -154,11 +156,12 @@ export class FeedbackForm extends React.Component<FeedbackFormProps, FeedbackFor
154
156
// Defaulting to the onAddScreenshot callback
155
157
const { onAddScreenshot } = { ...defaultConfiguration , ...this . props } ;
156
158
onAddScreenshot ( ( filename : string , attachement : Uint8Array ) => {
157
- this . setState ( { filename, attachment : attachement } , this . _saveFormState ) ;
159
+ // TODO: Add support for image uri when using onAddScreenshot
160
+ this . setState ( { filename, attachment : attachement , attachmentUri : undefined } , this . _saveFormState ) ;
158
161
} ) ;
159
162
}
160
163
} else {
161
- this . setState ( { filename : undefined , attachment : undefined } , this . _saveFormState ) ;
164
+ this . setState ( { filename : undefined , attachment : undefined , attachmentUri : undefined } , this . _saveFormState ) ;
162
165
}
163
166
}
164
167
@@ -244,13 +247,21 @@ export class FeedbackForm extends React.Component<FeedbackFormProps, FeedbackFor
244
247
multiline
245
248
/>
246
249
{ ( config . enableScreenshot || imagePickerConfiguration . imagePicker ) && (
247
- < TouchableOpacity style = { styles . screenshotButton } onPress = { this . onScreenshotButtonPress } >
248
- < Text style = { styles . screenshotText } >
249
- { ! this . state . filename && ! this . state . attachment
250
- ? text . addScreenshotButtonLabel
251
- : text . removeScreenshotButtonLabel }
252
- </ Text >
253
- </ TouchableOpacity >
250
+ < View style = { styles . screenshotContainer } >
251
+ { this . state . attachmentUri && (
252
+ < Image
253
+ source = { { uri : this . state . attachmentUri } }
254
+ style = { styles . screenshotThumbnail }
255
+ />
256
+ ) }
257
+ < TouchableOpacity style = { styles . screenshotButton } onPress = { this . onScreenshotButtonPress } >
258
+ < Text style = { styles . screenshotText } >
259
+ { ! this . state . filename && ! this . state . attachment
260
+ ? text . addScreenshotButtonLabel
261
+ : text . removeScreenshotButtonLabel }
262
+ </ Text >
263
+ </ TouchableOpacity >
264
+ </ View >
254
265
) }
255
266
< TouchableOpacity style = { styles . submitButton } onPress = { this . handleFeedbackSubmit } >
256
267
< Text style = { styles . submitText } > { text . submitButtonLabel } </ Text >
@@ -279,6 +290,7 @@ export class FeedbackForm extends React.Component<FeedbackFormProps, FeedbackFor
279
290
description : '' ,
280
291
filename : undefined ,
281
292
attachment : undefined ,
293
+ attachmentUri : undefined ,
282
294
} ;
283
295
} ;
284
296
}
0 commit comments