@ornikar/kitt-universal 32.5.1 → 32.5.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -6314,10 +6314,11 @@ const DatePicker = /*#__PURE__*/react.forwardRef(({
6314
6314
  });
6315
6315
 
6316
6316
  function DocumentPicker({
6317
- onDocumentUpload,
6318
6317
  children,
6319
6318
  disabled,
6320
- documentPickerOptions
6319
+ documentPickerOptions,
6320
+ onDocumentUpload,
6321
+ onGetDocumentAsyncError
6321
6322
  }) {
6322
6323
  const childElement = react.Children.only(children);
6323
6324
  return /*#__PURE__*/react.cloneElement(childElement, {
@@ -6326,12 +6327,22 @@ function DocumentPicker({
6326
6327
  onPress: async () => {
6327
6328
  if (disabled) return;
6328
6329
  childElement.props.onPress?.();
6329
- const result = await expoDocumentPicker.getDocumentAsync({
6330
- ...documentPickerOptions,
6331
- multiple: false
6332
- });
6333
- if (!result.canceled && result.assets[0]?.file) {
6334
- onDocumentUpload(result.assets[0].file);
6330
+ let result;
6331
+ try {
6332
+ result = await expoDocumentPicker.getDocumentAsync({
6333
+ ...documentPickerOptions,
6334
+ multiple: false
6335
+ });
6336
+ } catch (error) {
6337
+ onGetDocumentAsyncError?.();
6338
+ result = {
6339
+ canceled: true,
6340
+ assets: null
6341
+ };
6342
+ }
6343
+ const file = result.assets?.at(0)?.file;
6344
+ if (!result.canceled && file) {
6345
+ onDocumentUpload(file);
6335
6346
  }
6336
6347
  },
6337
6348
  disabled