baseui 0.0.0-alpha-c54ce6f → 0.0.0-alpha-29a759d

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.
@@ -44,15 +44,29 @@ function MeasureColumn(_ref) {
44
44
  _useStyletron2 = _slicedToArray(_useStyletron, 1),
45
45
  css = _useStyletron2[0];
46
46
 
47
- var ref = (0, React.useRef)();
48
- console.log('measure column', columnIndex);
47
+ var _React$useState = React.useState(null),
48
+ _React$useState2 = _slicedToArray(_React$useState, 2),
49
+ node = _React$useState2[0],
50
+ setNode = _React$useState2[1];
51
+
52
+ var ref = React.useCallback(function (node) {
53
+ setNode(node);
54
+ }, []);
49
55
  React.useEffect(function () {
50
56
  if (typeof document !== 'undefined') {
51
- if (ref.current) {
52
- onLayout(columnIndex, ref.current.getBoundingClientRect());
57
+ if (node) {
58
+ onLayout(columnIndex, node.getBoundingClientRect());
53
59
  }
54
60
  }
55
- }, []);
61
+ }, [node, onLayout]); // const ref = React.useRef();
62
+ // React.useEffect(() => {
63
+ // if (__BROWSER__) {
64
+ // if (ref.current) {
65
+ // onLayout(columnIndex, ref.current.getBoundingClientRect());
66
+ // }
67
+ // }
68
+ // }, []);
69
+
56
70
  return /*#__PURE__*/React.createElement("div", {
57
71
  ref: ref,
58
72
  className: css({
@@ -25,17 +25,26 @@ function MeasureColumn({
25
25
  }) {
26
26
  const [css] = useStyletron();
27
27
 
28
- const ref = useRef();
29
-
30
- console.log('measure column', columnIndex);
31
-
28
+ const [node, setNode] = React.useState(null);
29
+ const ref = React.useCallback(node => {
30
+ setNode(node);
31
+ }, []);
32
32
  React.useEffect(() => {
33
33
  if (__BROWSER__) {
34
- if (ref.current) {
35
- onLayout(columnIndex, ref.current.getBoundingClientRect());
34
+ if (node) {
35
+ onLayout(columnIndex, node.getBoundingClientRect());
36
36
  }
37
37
  }
38
- }, []);
38
+ }, [node, onLayout]);
39
+
40
+ // const ref = React.useRef();
41
+ // React.useEffect(() => {
42
+ // if (__BROWSER__) {
43
+ // if (ref.current) {
44
+ // onLayout(columnIndex, ref.current.getBoundingClientRect());
45
+ // }
46
+ // }
47
+ // }, []);
39
48
 
40
49
  return (
41
50
  <div
@@ -18,15 +18,25 @@ function MeasureColumn({
18
18
  onLayout
19
19
  }) {
20
20
  const [css] = useStyletron();
21
- const ref = useRef();
22
- console.log('measure column', columnIndex);
21
+ const [node, setNode] = React.useState(null);
22
+ const ref = React.useCallback(node => {
23
+ setNode(node);
24
+ }, []);
23
25
  React.useEffect(() => {
24
26
  if (typeof document !== 'undefined') {
25
- if (ref.current) {
26
- onLayout(columnIndex, ref.current.getBoundingClientRect());
27
+ if (node) {
28
+ onLayout(columnIndex, node.getBoundingClientRect());
27
29
  }
28
30
  }
29
- }, []);
31
+ }, [node, onLayout]); // const ref = React.useRef();
32
+ // React.useEffect(() => {
33
+ // if (__BROWSER__) {
34
+ // if (ref.current) {
35
+ // onLayout(columnIndex, ref.current.getBoundingClientRect());
36
+ // }
37
+ // }
38
+ // }, []);
39
+
30
40
  return /*#__PURE__*/React.createElement("div", {
31
41
  ref: ref,
32
42
  className: css({
@@ -33,15 +33,29 @@ function MeasureColumn(_ref) {
33
33
  _useStyletron2 = _slicedToArray(_useStyletron, 1),
34
34
  css = _useStyletron2[0];
35
35
 
36
- var ref = useRef();
37
- console.log('measure column', columnIndex);
36
+ var _React$useState = React.useState(null),
37
+ _React$useState2 = _slicedToArray(_React$useState, 2),
38
+ node = _React$useState2[0],
39
+ setNode = _React$useState2[1];
40
+
41
+ var ref = React.useCallback(function (node) {
42
+ setNode(node);
43
+ }, []);
38
44
  React.useEffect(function () {
39
45
  if (typeof document !== 'undefined') {
40
- if (ref.current) {
41
- onLayout(columnIndex, ref.current.getBoundingClientRect());
46
+ if (node) {
47
+ onLayout(columnIndex, node.getBoundingClientRect());
42
48
  }
43
49
  }
44
- }, []);
50
+ }, [node, onLayout]); // const ref = React.useRef();
51
+ // React.useEffect(() => {
52
+ // if (__BROWSER__) {
53
+ // if (ref.current) {
54
+ // onLayout(columnIndex, ref.current.getBoundingClientRect());
55
+ // }
56
+ // }
57
+ // }, []);
58
+
45
59
  return /*#__PURE__*/React.createElement("div", {
46
60
  ref: ref,
47
61
  className: css({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "baseui",
3
- "version": "0.0.0-alpha-c54ce6f",
3
+ "version": "0.0.0-alpha-29a759d",
4
4
  "description": "A React Component library implementing the Base design language",
5
5
  "keywords": [
6
6
  "react",