@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.
@@ -6817,10 +6817,11 @@ const DatePicker = /*#__PURE__*/React.forwardRef(({
6817
6817
  });
6818
6818
 
6819
6819
  function DocumentPicker({
6820
- onDocumentUpload,
6821
6820
  children,
6822
6821
  disabled,
6823
- documentPickerOptions
6822
+ documentPickerOptions,
6823
+ onDocumentUpload,
6824
+ onGetDocumentAsyncError
6824
6825
  }) {
6825
6826
  const childElement = React.Children.only(children);
6826
6827
  return /*#__PURE__*/React.cloneElement(childElement, {
@@ -6829,12 +6830,22 @@ function DocumentPicker({
6829
6830
  onPress: async () => {
6830
6831
  if (disabled) return;
6831
6832
  childElement.props.onPress?.();
6832
- const result = await expoDocumentPicker.getDocumentAsync({
6833
- ...documentPickerOptions,
6834
- multiple: false
6835
- });
6836
- if (!result.canceled && result.assets[0]?.file) {
6837
- onDocumentUpload(result.assets[0].file);
6833
+ let result;
6834
+ try {
6835
+ result = await expoDocumentPicker.getDocumentAsync({
6836
+ ...documentPickerOptions,
6837
+ multiple: false
6838
+ });
6839
+ } catch (error) {
6840
+ onGetDocumentAsyncError?.();
6841
+ result = {
6842
+ canceled: true,
6843
+ assets: null
6844
+ };
6845
+ }
6846
+ const file = result.assets?.at(0)?.file;
6847
+ if (!result.canceled && file) {
6848
+ onDocumentUpload(file);
6838
6849
  }
6839
6850
  },
6840
6851
  disabled