@onehat/ui 0.3.350 → 0.3.351

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@onehat/ui",
3
- "version": "0.3.350",
3
+ "version": "0.3.351",
4
4
  "description": "Base UI for OneHat apps",
5
5
  "main": "src/index.js",
6
6
  "type": "module",
@@ -794,7 +794,7 @@ function Form(props) {
794
794
  doReset(defaultValues);
795
795
  }
796
796
  if (formSetup) {
797
- formSetup(formSetValue, formGetValues, formState)
797
+ formSetup(formSetValue, formGetValues, formState);
798
798
  }
799
799
  }, [record]);
800
800
 
@@ -1,4 +1,4 @@
1
- import { useRef, useState, } from 'react';
1
+ import { useEffect, useRef, useState, } from 'react';
2
2
  import {
3
3
  Column,
4
4
  Icon,
@@ -37,7 +37,8 @@ function Viewer(props) {
37
37
  record,
38
38
  additionalViewButtons,
39
39
  canRecordBeEdited,
40
-
40
+ viewerSetup, // this fn will be executed after the viewer setup is complete
41
+
41
42
  // withComponent
42
43
  self,
43
44
 
@@ -235,6 +236,12 @@ function Viewer(props) {
235
236
  setContainerWidth(e.nativeEvent.layout.width);
236
237
  };
237
238
 
239
+ useEffect(() => {
240
+ if (viewerSetup && record?.getSubmitValues) {
241
+ viewerSetup(record.getSubmitValues());
242
+ }
243
+ }, [record]);
244
+
238
245
  if (self) {
239
246
  self.ref = scrollViewRef;
240
247
  }