@butternutbox/pawprint-native 1.6.1 → 1.6.3

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.
@@ -7,12 +7,12 @@
7
7
  CJS Build start
8
8
  ESM Build start
9
9
  DTS Build start
10
- CJS dist/index.cjs 574.67 KB
10
+ CJS dist/index.cjs 575.22 KB
11
11
  CJS dist/index.cjs.map 1.13 MB
12
- CJS ⚡️ Build success in 7657ms
13
- ESM dist/index.js 542.68 KB
12
+ CJS ⚡️ Build success in 8147ms
13
+ ESM dist/index.js 543.22 KB
14
14
  ESM dist/index.js.map 1.13 MB
15
- ESM ⚡️ Build success in 7657ms
16
- DTS ⚡️ Build success in 21480ms
15
+ ESM ⚡️ Build success in 8147ms
16
+ DTS ⚡️ Build success in 21264ms
17
17
  DTS dist/index.d.cts 114.88 KB
18
18
  DTS dist/index.d.ts 114.88 KB
package/CHANGELOG.md CHANGED
@@ -1,5 +1,27 @@
1
1
  # @butternutbox/pawprint-native
2
2
 
3
+ ## 1.6.3
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [b6fcfff]
8
+ - @butternutbox/pawprint-tokens@0.6.0
9
+ - @butternutbox/pawprint-fonts@2.0.1
10
+
11
+ ## 1.6.2
12
+
13
+ ### Patch Changes
14
+
15
+ - 2bdd943: fix(INC-4913): keep the searchable dropdown anchored to its field wherever the field moves
16
+
17
+ The dropdown re-measured its field only when the keyboard showed or hid. A
18
+ `KeyboardAwareScrollView` also scrolls the focused input while the keyboard is
19
+ already up — on every keystroke, and when the app asks it to re-check the
20
+ focused input — so the field moved and the list stayed behind the keyboard.
21
+
22
+ While open, the dropdown now measures its field each frame and moves the list
23
+ once the field has come to rest, whatever moved it.
24
+
3
25
  ## 1.6.1
4
26
 
5
27
  ### Patch Changes
package/dist/index.cjs CHANGED
@@ -9072,22 +9072,32 @@ var StyledRoot14 = styled51__default.default(reactNative.View)(({ theme: theme2
9072
9072
  gap: parseTokenValue48(spacing.gap)
9073
9073
  };
9074
9074
  });
9075
+ var isSamePosition = (a, b) => a !== null && b !== null && a.width === b.width && a.height === b.height && a.pageX === b.pageX && a.pageY === b.pageY;
9075
9076
  function SelectFieldAnchor({ triggerRef, enabled }) {
9076
- const { setTriggerPosition } = SelectPrimitive3__namespace.useRootContext();
9077
+ const { triggerPosition, setTriggerPosition } = SelectPrimitive3__namespace.useRootContext();
9078
+ const anchoredRef = React66__default.default.useRef(null);
9079
+ React66__default.default.useEffect(() => {
9080
+ anchoredRef.current = triggerPosition != null ? triggerPosition : null;
9081
+ }, [triggerPosition]);
9077
9082
  React66__default.default.useEffect(() => {
9078
9083
  if (!enabled) return;
9079
- const reanchor = () => {
9084
+ let frame;
9085
+ let previous = null;
9086
+ const track = () => {
9080
9087
  var _a;
9081
9088
  (_a = triggerRef.current) == null ? void 0 : _a.measure((_x, _y, width, height, pageX, pageY) => {
9082
- setTriggerPosition({ width, height, pageX, pageY });
9089
+ const measured = { width, height, pageX, pageY };
9090
+ const settled = isSamePosition(measured, previous);
9091
+ if (settled && !isSamePosition(measured, anchoredRef.current)) {
9092
+ anchoredRef.current = measured;
9093
+ setTriggerPosition(measured);
9094
+ }
9095
+ previous = measured;
9083
9096
  });
9097
+ frame = requestAnimationFrame(track);
9084
9098
  };
9085
- const shown = reactNative.Keyboard.addListener("keyboardDidShow", reanchor);
9086
- const hidden = reactNative.Keyboard.addListener("keyboardDidHide", reanchor);
9087
- return () => {
9088
- shown.remove();
9089
- hidden.remove();
9090
- };
9099
+ frame = requestAnimationFrame(track);
9100
+ return () => cancelAnimationFrame(frame);
9091
9101
  }, [enabled, setTriggerPosition, triggerRef]);
9092
9102
  return null;
9093
9103
  }