Skip to content

Commit d815680

Browse files
committed
ComposeMenu [nfc]: Bring out assets const
1 parent 10b3eca commit d815680

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/compose/ComposeMenu.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,17 +142,19 @@ export default function ComposeMenu(props: Props): Node {
142142
return;
143143
}
144144

145+
const { assets } = response;
146+
145147
// TODO: support sending multiple files; see library's docs for how to
146148
// let `assets` have more than one item in `response`.
147-
const firstAsset = response.assets && response.assets[0];
149+
const firstAsset = assets && assets[0];
148150

149151
if (!firstAsset) {
150152
// TODO: See if we these unexpected situations actually happen. …Ah,
151153
// yep, reportedly (and we've seen in Sentry):
152154
// https://github.com/react-native-image-picker/react-native-image-picker/issues/1945
153155
showErrorAlert(_('Error'), _('Failed to attach your file.'));
154156
logging.error('Image picker response gave falsy `assets` or falsy `assets[0]`', {
155-
'!assets': !response.assets,
157+
'!assets': !assets,
156158
});
157159
return;
158160
}

0 commit comments

Comments
 (0)