@onehat/ui 0.3.245 → 0.3.247

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.245",
3
+ "version": "0.3.247",
4
4
  "description": "Base UI for OneHat apps",
5
5
  "main": "src/index.js",
6
6
  "type": "module",
@@ -204,7 +204,7 @@ function Container(props) {
204
204
  componentProps.setIsCollapsed = setIsNorthCollapsed || setLocalIsNorthCollapsed;
205
205
  componentProps.onLayout = (e) => {
206
206
  const height = parseFloat(e.nativeEvent.layout.height);
207
- if (height !== northHeight) {
207
+ if (height && height !== northHeight) {
208
208
  setNorthHeight(height);
209
209
  }
210
210
  };
@@ -228,7 +228,7 @@ function Container(props) {
228
228
  componentProps.setIsCollapsed = setIsSouthCollapsed || setLocalIsSouthCollapsed;
229
229
  componentProps.onLayout = (e) => {
230
230
  const height = parseFloat(e.nativeEvent.layout.height);
231
- if (height !== southHeight) {
231
+ if (height && height !== southHeight) {
232
232
  setSouthHeight(height);
233
233
  }
234
234
  };
@@ -252,7 +252,7 @@ function Container(props) {
252
252
  componentProps.setIsCollapsed = setIsEastCollapsed || setLocalIsEastCollapsed;
253
253
  componentProps.onLayout = (e) => {
254
254
  const width = parseFloat(e.nativeEvent.layout.width);
255
- if (width !== eastWidth) {
255
+ if (width && width !== eastWidth) {
256
256
  setEastWidth(width);
257
257
  }
258
258
  };
@@ -276,7 +276,7 @@ function Container(props) {
276
276
  componentProps.setIsCollapsed = setIsWestCollapsed || setLocalIsWestCollapsed;
277
277
  componentProps.onLayout = (e) => {
278
278
  const width = parseFloat(e.nativeEvent.layout.width);
279
- if (width !== westWidth) {
279
+ if (width && width !== westWidth) {
280
280
  setWestWidth(width);
281
281
  }
282
282
  };
@@ -488,6 +488,7 @@ function GridComponent(props) {
488
488
  rowDragProps.isDropTarget = true;
489
489
  rowDragProps.dropTargetAccept = dropTargetAccept;
490
490
  rowDragProps.onDrop = (droppedItem) => {
491
+ // NOTE: item is sometimes getting destroyed, but it still as the id, so you can still use it
491
492
  onRowDrop(item, droppedItem); // item is what it was dropped on; droppedItem is the dragSourceItem defined above
492
493
  };
493
494
  }
@@ -982,6 +983,9 @@ function GridComponent(props) {
982
983
  {...flatListProps}
983
984
  />
984
985
 
986
+ if (CURRENT_MODE === UI_MODE_WEB) {
987
+ grid = <ScrollView horizontal={false}>{grid}</ScrollView>; // fix scrolling bug on nested FlatLists
988
+ } else
985
989
  if (CURRENT_MODE === UI_MODE_REACT_NATIVE) {
986
990
  grid = <ScrollView flex={1} w="100%">{grid}</ScrollView>
987
991
  }
@@ -26,6 +26,7 @@ function ManagerScreen(props) {
26
26
  styles = UiGlobals.styles,
27
27
  id = props.id || props.self?.path,
28
28
  [isRendered, setIsRendered] = useState(false),
29
+ [isModeSet, setIsModeSet] = useState(false),
29
30
  [allowSideBySide, setAllowSideBySide] = useState(false),
30
31
  [mode, setModeRaw] = useState(MODE_FULL),
31
32
  setMode = (newMode) => {
@@ -63,6 +64,7 @@ function ManagerScreen(props) {
63
64
  setMode(val);
64
65
  }
65
66
  }
67
+ setIsModeSet(true);
66
68
  })();
67
69
  }, [isRendered]);
68
70
 
@@ -81,7 +83,7 @@ function ManagerScreen(props) {
81
83
  }
82
84
 
83
85
  return <Column maxHeight="100vh" overflow="hidden" flex={1} w="100%" onLayout={onLayout}>
84
- {isRendered &&
86
+ {isRendered && isModeSet &&
85
87
  <>
86
88
  <Row
87
89
  h="80px"
@@ -70,6 +70,9 @@ function TabBar(props) {
70
70
  }
71
71
  return; // no change
72
72
  }
73
+ if (tabs[currentTabIx].content) {
74
+ tabs[currentTabIx].content = null; // free up memory by clearing rendered content
75
+ }
73
76
  if (useLocal) {
74
77
  setCurrentTabIxLocal(ix);
75
78