@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.
@@ -6793,10 +6793,11 @@ const DatePicker = /*#__PURE__*/forwardRef(({
6793
6793
  });
6794
6794
 
6795
6795
  function DocumentPicker({
6796
- onDocumentUpload,
6797
6796
  children,
6798
6797
  disabled,
6799
- documentPickerOptions
6798
+ documentPickerOptions,
6799
+ onDocumentUpload,
6800
+ onGetDocumentAsyncError
6800
6801
  }) {
6801
6802
  const childElement = Children.only(children);
6802
6803
  return /*#__PURE__*/cloneElement(childElement, {
@@ -6805,12 +6806,22 @@ function DocumentPicker({
6805
6806
  onPress: async () => {
6806
6807
  if (disabled) return;
6807
6808
  childElement.props.onPress?.();
6808
- const result = await getDocumentAsync({
6809
- ...documentPickerOptions,
6810
- multiple: false
6811
- });
6812
- if (!result.canceled && result.assets[0]?.file) {
6813
- onDocumentUpload(result.assets[0].file);
6809
+ let result;
6810
+ try {
6811
+ result = await getDocumentAsync({
6812
+ ...documentPickerOptions,
6813
+ multiple: false
6814
+ });
6815
+ } catch (error) {
6816
+ onGetDocumentAsyncError?.();
6817
+ result = {
6818
+ canceled: true,
6819
+ assets: null
6820
+ };
6821
+ }
6822
+ const file = result.assets?.at(0)?.file;
6823
+ if (!result.canceled && file) {
6824
+ onDocumentUpload(file);
6814
6825
  }
6815
6826
  },
6816
6827
  disabled