@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.
@@ -6305,10 +6305,11 @@ const DatePicker = /*#__PURE__*/forwardRef(({
6305
6305
  });
6306
6306
 
6307
6307
  function DocumentPicker({
6308
- onDocumentUpload,
6309
6308
  children,
6310
6309
  disabled,
6311
- documentPickerOptions
6310
+ documentPickerOptions,
6311
+ onDocumentUpload,
6312
+ onGetDocumentAsyncError
6312
6313
  }) {
6313
6314
  const childElement = Children.only(children);
6314
6315
  return /*#__PURE__*/cloneElement(childElement, {
@@ -6317,12 +6318,22 @@ function DocumentPicker({
6317
6318
  onPress: async () => {
6318
6319
  if (disabled) return;
6319
6320
  childElement.props.onPress?.();
6320
- const result = await getDocumentAsync({
6321
- ...documentPickerOptions,
6322
- multiple: false
6323
- });
6324
- if (!result.canceled && result.assets[0]?.file) {
6325
- onDocumentUpload(result.assets[0].file);
6321
+ let result;
6322
+ try {
6323
+ result = await getDocumentAsync({
6324
+ ...documentPickerOptions,
6325
+ multiple: false
6326
+ });
6327
+ } catch (error) {
6328
+ onGetDocumentAsyncError?.();
6329
+ result = {
6330
+ canceled: true,
6331
+ assets: null
6332
+ };
6333
+ }
6334
+ const file = result.assets?.at(0)?.file;
6335
+ if (!result.canceled && file) {
6336
+ onDocumentUpload(file);
6326
6337
  }
6327
6338
  },
6328
6339
  disabled