@magmamath/students-features 1.8.5-rc.1 → 1.8.6-rc.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.
Files changed (26) hide show
  1. package/dist/commonjs/features/keyboard/helpers.js +2 -9
  2. package/dist/commonjs/features/keyboard/helpers.js.map +1 -1
  3. package/dist/commonjs/shared/common.constants.js +6 -1
  4. package/dist/commonjs/shared/common.constants.js.map +1 -1
  5. package/dist/commonjs/shared/hooks/useKeyboardOffset.js +10 -6
  6. package/dist/commonjs/shared/hooks/useKeyboardOffset.js.map +1 -1
  7. package/dist/module/features/keyboard/helpers.js +2 -9
  8. package/dist/module/features/keyboard/helpers.js.map +1 -1
  9. package/dist/module/shared/common.constants.js +5 -0
  10. package/dist/module/shared/common.constants.js.map +1 -1
  11. package/dist/module/shared/hooks/useKeyboardOffset.js +11 -7
  12. package/dist/module/shared/hooks/useKeyboardOffset.js.map +1 -1
  13. package/dist/typescript/commonjs/features/keyboard/helpers.d.ts.map +1 -1
  14. package/dist/typescript/commonjs/shared/common.constants.d.ts +1 -0
  15. package/dist/typescript/commonjs/shared/common.constants.d.ts.map +1 -1
  16. package/dist/typescript/commonjs/shared/hooks/useKeyboardOffset.d.ts +6 -4
  17. package/dist/typescript/commonjs/shared/hooks/useKeyboardOffset.d.ts.map +1 -1
  18. package/dist/typescript/module/features/keyboard/helpers.d.ts.map +1 -1
  19. package/dist/typescript/module/shared/common.constants.d.ts +1 -0
  20. package/dist/typescript/module/shared/common.constants.d.ts.map +1 -1
  21. package/dist/typescript/module/shared/hooks/useKeyboardOffset.d.ts +6 -4
  22. package/dist/typescript/module/shared/hooks/useKeyboardOffset.d.ts.map +1 -1
  23. package/package.json +1 -1
  24. package/src/features/keyboard/helpers.ts +2 -9
  25. package/src/shared/common.constants.ts +8 -0
  26. package/src/shared/hooks/useKeyboardOffset.ts +12 -7
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.isMobileWidth = exports.getUnitsKeyboardGroup = exports.getMainKeyboardGroup = exports.getIsIpadOrIphoneDevice = void 0;
7
- var _reactNativeUi = require("@magmamath/react-native-ui");
7
+ var _commonConstants = require("../../shared/common.constants.js");
8
8
  var _keyboardLayouts = require("./constants/keyboardLayouts.js");
9
9
  const getMainKeyboardGroup = (keys, type) => {
10
10
  return keys.operators[type];
@@ -14,14 +14,7 @@ const getUnitsKeyboardGroup = (keys, type) => {
14
14
  return keys.units[type];
15
15
  };
16
16
  exports.getUnitsKeyboardGroup = getUnitsKeyboardGroup;
17
- const getIsIpadOrIphoneDevice = () => {
18
- if (!_reactNativeUi.IS_WEB) {
19
- return false;
20
- }
21
- const isIOS = /iPad|iPhone|iPod/.test(navigator.platform);
22
- const isIpadOS = navigator?.maxTouchPoints > 2 && /MacIntel/.test(navigator.platform);
23
- return isIOS || isIpadOS;
24
- };
17
+ const getIsIpadOrIphoneDevice = () => _commonConstants.isIosWeb;
25
18
  exports.getIsIpadOrIphoneDevice = getIsIpadOrIphoneDevice;
26
19
  const isMobileWidth = (width, characterType) => {
27
20
  const layoutWidth = (0, _keyboardLayouts.getMobileBreakpointByCharType)(characterType);
@@ -1 +1 @@
1
- {"version":3,"names":["_reactNativeUi","require","_keyboardLayouts","getMainKeyboardGroup","keys","type","operators","exports","getUnitsKeyboardGroup","units","getIsIpadOrIphoneDevice","IS_WEB","isIOS","test","navigator","platform","isIpadOS","maxTouchPoints","isMobileWidth","width","characterType","layoutWidth","getMobileBreakpointByCharType"],"sourceRoot":"../../../../src","sources":["features/keyboard/helpers.ts"],"mappings":";;;;;;AAAA,IAAAA,cAAA,GAAAC,OAAA;AACA,IAAAC,gBAAA,GAAAD,OAAA;AAGO,MAAME,oBAAoB,GAAGA,CAACC,IAAsB,EAAEC,IAAkB,KAAK;EAClF,OAAOD,IAAI,CAACE,SAAS,CAACD,IAAI,CAAC;AAC7B,CAAC;AAAAE,OAAA,CAAAJ,oBAAA,GAAAA,oBAAA;AAEM,MAAMK,qBAAqB,GAAGA,CAACJ,IAAsB,EAAEC,IAA4B,KAAK;EAC7F,OAAOD,IAAI,CAACK,KAAK,CAACJ,IAAI,CAAC;AACzB,CAAC;AAAAE,OAAA,CAAAC,qBAAA,GAAAA,qBAAA;AAEM,MAAME,uBAAuB,GAAGA,CAAA,KAAM;EAC3C,IAAI,CAACC,qBAAM,EAAE;IACX,OAAO,KAAK;EACd;EACA,MAAMC,KAAK,GAAG,kBAAkB,CAACC,IAAI,CAACC,SAAS,CAACC,QAAQ,CAAC;EACzD,MAAMC,QAAQ,GAAGF,SAAS,EAAEG,cAAc,GAAG,CAAC,IAAI,UAAU,CAACJ,IAAI,CAACC,SAAS,CAACC,QAAQ,CAAC;EACrF,OAAOH,KAAK,IAAII,QAAQ;AAC1B,CAAC;AAAAT,OAAA,CAAAG,uBAAA,GAAAA,uBAAA;AAEM,MAAMQ,aAAa,GAAGA,CAACC,KAAa,EAAEC,aAAsB,KAAK;EACtE,MAAMC,WAAW,GAAG,IAAAC,8CAA6B,EAACF,aAAa,CAAC;EAChE,OAAOD,KAAK,IAAIE,WAAW;AAC7B,CAAC;AAAAd,OAAA,CAAAW,aAAA,GAAAA,aAAA","ignoreList":[]}
1
+ {"version":3,"names":["_commonConstants","require","_keyboardLayouts","getMainKeyboardGroup","keys","type","operators","exports","getUnitsKeyboardGroup","units","getIsIpadOrIphoneDevice","isIosWeb","isMobileWidth","width","characterType","layoutWidth","getMobileBreakpointByCharType"],"sourceRoot":"../../../../src","sources":["features/keyboard/helpers.ts"],"mappings":";;;;;;AAAA,IAAAA,gBAAA,GAAAC,OAAA;AACA,IAAAC,gBAAA,GAAAD,OAAA;AAGO,MAAME,oBAAoB,GAAGA,CAACC,IAAsB,EAAEC,IAAkB,KAAK;EAClF,OAAOD,IAAI,CAACE,SAAS,CAACD,IAAI,CAAC;AAC7B,CAAC;AAAAE,OAAA,CAAAJ,oBAAA,GAAAA,oBAAA;AAEM,MAAMK,qBAAqB,GAAGA,CAACJ,IAAsB,EAAEC,IAA4B,KAAK;EAC7F,OAAOD,IAAI,CAACK,KAAK,CAACJ,IAAI,CAAC;AACzB,CAAC;AAAAE,OAAA,CAAAC,qBAAA,GAAAA,qBAAA;AAEM,MAAME,uBAAuB,GAAGA,CAAA,KAAMC,yBAAQ;AAAAJ,OAAA,CAAAG,uBAAA,GAAAA,uBAAA;AAE9C,MAAME,aAAa,GAAGA,CAACC,KAAa,EAAEC,aAAsB,KAAK;EACtE,MAAMC,WAAW,GAAG,IAAAC,8CAA6B,EAACF,aAAa,CAAC;EAChE,OAAOD,KAAK,IAAIE,WAAW;AAC7B,CAAC;AAAAR,OAAA,CAAAK,aAAA,GAAAA,aAAA","ignoreList":[]}
@@ -3,9 +3,14 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.isWeb = exports.SortingDirection = exports.BURGER_MENU_BREAKPOINT = void 0;
6
+ exports.isWeb = exports.isIosWeb = exports.SortingDirection = exports.BURGER_MENU_BREAKPOINT = void 0;
7
7
  var _reactNative = require("react-native");
8
8
  const isWeb = exports.isWeb = _reactNative.Platform.OS === 'web';
9
+
10
+ // iOS Safari / iPadOS on web is the only web platform where the on-screen keyboard
11
+ // overlaps content instead of resizing the viewport (Android resizes it via the
12
+ // `interactive-widget` meta tag; desktop has no virtual keyboard).
13
+ const isIosWeb = exports.isIosWeb = isWeb && (/iPad|iPhone|iPod/.test(navigator.platform) || navigator.maxTouchPoints > 2 && /MacIntel/.test(navigator.platform));
9
14
  let SortingDirection = exports.SortingDirection = /*#__PURE__*/function (SortingDirection) {
10
15
  SortingDirection["DESC"] = "desc";
11
16
  SortingDirection["ASC"] = "asc";
@@ -1 +1 @@
1
- {"version":3,"names":["_reactNative","require","isWeb","exports","Platform","OS","SortingDirection","BURGER_MENU_BREAKPOINT"],"sourceRoot":"../../../src","sources":["shared/common.constants.ts"],"mappings":";;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAEO,MAAMC,KAAK,GAAAC,OAAA,CAAAD,KAAA,GAAGE,qBAAQ,CAACC,EAAE,KAAK,KAAK;AAAA,IAE9BC,gBAAgB,GAAAH,OAAA,CAAAG,gBAAA,0BAAhBA,gBAAgB;EAAhBA,gBAAgB;EAAhBA,gBAAgB;EAAA,OAAhBA,gBAAgB;AAAA;AAKrB,MAAMC,sBAAsB,GAAAJ,OAAA,CAAAI,sBAAA,GAAG,IAAI","ignoreList":[]}
1
+ {"version":3,"names":["_reactNative","require","isWeb","exports","Platform","OS","isIosWeb","test","navigator","platform","maxTouchPoints","SortingDirection","BURGER_MENU_BREAKPOINT"],"sourceRoot":"../../../src","sources":["shared/common.constants.ts"],"mappings":";;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAEO,MAAMC,KAAK,GAAAC,OAAA,CAAAD,KAAA,GAAGE,qBAAQ,CAACC,EAAE,KAAK,KAAK;;AAE1C;AACA;AACA;AACO,MAAMC,QAAQ,GAAAH,OAAA,CAAAG,QAAA,GACnBJ,KAAK,KACJ,kBAAkB,CAACK,IAAI,CAACC,SAAS,CAACC,QAAQ,CAAC,IACzCD,SAAS,CAACE,cAAc,GAAG,CAAC,IAAI,UAAU,CAACH,IAAI,CAACC,SAAS,CAACC,QAAQ,CAAE,CAAC;AAAA,IAE9DE,gBAAgB,GAAAR,OAAA,CAAAQ,gBAAA,0BAAhBA,gBAAgB;EAAhBA,gBAAgB;EAAhBA,gBAAgB;EAAA,OAAhBA,gBAAgB;AAAA;AAKrB,MAAMC,sBAAsB,GAAAT,OAAA,CAAAS,sBAAA,GAAG,IAAI","ignoreList":[]}
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.useKeyboardOffset = void 0;
7
7
  var _react = require("react");
8
8
  var _reactNative = require("react-native");
9
+ var _reactNativeUi = require("@magmamath/react-native-ui");
9
10
  var _commonConstants = require("../common.constants.js");
10
11
  const SHOW_EVENT = _reactNative.Platform.OS === 'ios' ? 'keyboardWillShow' : 'keyboardDidShow';
11
12
  const HIDE_EVENT = _reactNative.Platform.OS === 'ios' ? 'keyboardWillHide' : 'keyboardDidHide';
@@ -14,10 +15,12 @@ const ANIMATION_DURATION = 220;
14
15
  /**
15
16
  * Returns an animated value tracking the on-screen keyboard height.
16
17
  *
17
- * - native: subscribes to the platform `Keyboard` events.
18
- * - web: reads `visualViewport`, so it only reacts to a *virtual* keyboard
19
- * (mobile browsers). A physical desktop keyboard never shrinks the viewport,
20
- * so the value stays 0 and nothing moves.
18
+ * Only reacts where the keyboard actually overlaps the modal:
19
+ * - native mobile (`IS_MOBILE`) via the platform `Keyboard` events;
20
+ * - iOS web (`isIosWeb`) via `visualViewport`.
21
+ *
22
+ * Android web (the viewport resizes itself via `interactive-widget`) and desktop
23
+ * (no virtual keyboard) keep the value at 0, so nothing moves.
21
24
  */
22
25
  const useKeyboardOffset = () => {
23
26
  const keyboardHeight = (0, _react.useRef)(new _reactNative.Animated.Value(0)).current;
@@ -25,9 +28,9 @@ const useKeyboardOffset = () => {
25
28
  const animateTo = toValue => _reactNative.Animated.timing(keyboardHeight, {
26
29
  toValue,
27
30
  duration: ANIMATION_DURATION,
28
- useNativeDriver: !_commonConstants.isWeb
31
+ useNativeDriver: _reactNativeUi.IS_MOBILE
29
32
  }).start();
30
- if (_commonConstants.isWeb) {
33
+ if (_commonConstants.isIosWeb) {
31
34
  const viewport = window.visualViewport;
32
35
  if (!viewport) return;
33
36
  const update = () => {
@@ -41,6 +44,7 @@ const useKeyboardOffset = () => {
41
44
  viewport.removeEventListener('scroll', update);
42
45
  };
43
46
  }
47
+ if (!_reactNativeUi.IS_MOBILE) return;
44
48
  const showSub = _reactNative.Keyboard.addListener(SHOW_EVENT, event => animateTo(event.endCoordinates.height));
45
49
  const hideSub = _reactNative.Keyboard.addListener(HIDE_EVENT, () => animateTo(0));
46
50
  return () => {
@@ -1 +1 @@
1
- {"version":3,"names":["_react","require","_reactNative","_commonConstants","SHOW_EVENT","Platform","OS","HIDE_EVENT","ANIMATION_DURATION","useKeyboardOffset","keyboardHeight","useRef","Animated","Value","current","useEffect","animateTo","toValue","timing","duration","useNativeDriver","isWeb","start","viewport","window","visualViewport","update","overlap","Math","max","innerHeight","height","offsetTop","addEventListener","removeEventListener","showSub","Keyboard","addListener","event","endCoordinates","hideSub","remove","exports"],"sourceRoot":"../../../../src","sources":["shared/hooks/useKeyboardOffset.ts"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AAEA,IAAAE,gBAAA,GAAAF,OAAA;AAEA,MAAMG,UAAU,GAAGC,qBAAQ,CAACC,EAAE,KAAK,KAAK,GAAG,kBAAkB,GAAG,iBAAiB;AACjF,MAAMC,UAAU,GAAGF,qBAAQ,CAACC,EAAE,KAAK,KAAK,GAAG,kBAAkB,GAAG,iBAAiB;AACjF,MAAME,kBAAkB,GAAG,GAAG;;AAE9B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMC,iBAAiB,GAAGA,CAAA,KAAM;EACrC,MAAMC,cAAc,GAAG,IAAAC,aAAM,EAAC,IAAIC,qBAAQ,CAACC,KAAK,CAAC,CAAC,CAAC,CAAC,CAACC,OAAO;EAE5D,IAAAC,gBAAS,EAAC,MAAM;IACd,MAAMC,SAAS,GAAIC,OAAe,IAChCL,qBAAQ,CAACM,MAAM,CAACR,cAAc,EAAE;MAC9BO,OAAO;MACPE,QAAQ,EAAEX,kBAAkB;MAC5BY,eAAe,EAAE,CAACC;IACpB,CAAC,CAAC,CAACC,KAAK,CAAC,CAAC;IAEZ,IAAID,sBAAK,EAAE;MACT,MAAME,QAAQ,GAAGC,MAAM,CAACC,cAAc;MACtC,IAAI,CAACF,QAAQ,EAAE;MAEf,MAAMG,MAAM,GAAGA,CAAA,KAAM;QACnB,MAAMC,OAAO,GAAGC,IAAI,CAACC,GAAG,CAAC,CAAC,EAAEL,MAAM,CAACM,WAAW,GAAGP,QAAQ,CAACQ,MAAM,GAAGR,QAAQ,CAACS,SAAS,CAAC;QACtFhB,SAAS,CAACW,OAAO,CAAC;MACpB,CAAC;MAEDJ,QAAQ,CAACU,gBAAgB,CAAC,QAAQ,EAAEP,MAAM,CAAC;MAC3CH,QAAQ,CAACU,gBAAgB,CAAC,QAAQ,EAAEP,MAAM,CAAC;MAC3C,OAAO,MAAM;QACXH,QAAQ,CAACW,mBAAmB,CAAC,QAAQ,EAAER,MAAM,CAAC;QAC9CH,QAAQ,CAACW,mBAAmB,CAAC,QAAQ,EAAER,MAAM,CAAC;MAChD,CAAC;IACH;IAEA,MAAMS,OAAO,GAAGC,qBAAQ,CAACC,WAAW,CAACjC,UAAU,EAAGkC,KAAoB,IACpEtB,SAAS,CAACsB,KAAK,CAACC,cAAc,CAACR,MAAM,CACvC,CAAC;IACD,MAAMS,OAAO,GAAGJ,qBAAQ,CAACC,WAAW,CAAC9B,UAAU,EAAE,MAAMS,SAAS,CAAC,CAAC,CAAC,CAAC;IACpE,OAAO,MAAM;MACXmB,OAAO,CAACM,MAAM,CAAC,CAAC;MAChBD,OAAO,CAACC,MAAM,CAAC,CAAC;IAClB,CAAC;EACH,CAAC,EAAE,CAAC/B,cAAc,CAAC,CAAC;EAEpB,OAAOA,cAAc;AACvB,CAAC;AAAAgC,OAAA,CAAAjC,iBAAA,GAAAA,iBAAA","ignoreList":[]}
1
+ {"version":3,"names":["_react","require","_reactNative","_reactNativeUi","_commonConstants","SHOW_EVENT","Platform","OS","HIDE_EVENT","ANIMATION_DURATION","useKeyboardOffset","keyboardHeight","useRef","Animated","Value","current","useEffect","animateTo","toValue","timing","duration","useNativeDriver","IS_MOBILE","start","isIosWeb","viewport","window","visualViewport","update","overlap","Math","max","innerHeight","height","offsetTop","addEventListener","removeEventListener","showSub","Keyboard","addListener","event","endCoordinates","hideSub","remove","exports"],"sourceRoot":"../../../../src","sources":["shared/hooks/useKeyboardOffset.ts"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAA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ER,MAAM,CAAC;QAC9CH,QAAQ,CAACW,mBAAmB,CAAC,QAAQ,EAAER,MAAM,CAAC;MAChD,CAAC;IACH;IAEA,IAAI,CAACN,wBAAS,EAAE;IAEhB,MAAMe,OAAO,GAAGC,qBAAQ,CAACC,WAAW,CAAClC,UAAU,EAAGmC,KAAoB,IACpEvB,SAAS,CAACuB,KAAK,CAACC,cAAc,CAACR,MAAM,CACvC,CAAC;IACD,MAAMS,OAAO,GAAGJ,qBAAQ,CAACC,WAAW,CAAC/B,UAAU,EAAE,MAAMS,SAAS,CAAC,CAAC,CAAC,CAAC;IACpE,OAAO,MAAM;MACXoB,OAAO,CAACM,MAAM,CAAC,CAAC;MAChBD,OAAO,CAACC,MAAM,CAAC,CAAC;IAClB,CAAC;EACH,CAAC,EAAE,CAAChC,cAAc,CAAC,CAAC;EAEpB,OAAOA,cAAc;AACvB,CAAC;AAAAiC,OAAA,CAAAlC,iBAAA,GAAAA,iBAAA","ignoreList":[]}
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
 
3
- import { IS_WEB } from '@magmamath/react-native-ui';
3
+ import { isIosWeb } from "../../shared/common.constants.js";
4
4
  import { getMobileBreakpointByCharType } from "./constants/keyboardLayouts.js";
5
5
  export const getMainKeyboardGroup = (keys, type) => {
6
6
  return keys.operators[type];
@@ -8,14 +8,7 @@ export const getMainKeyboardGroup = (keys, type) => {
8
8
  export const getUnitsKeyboardGroup = (keys, type) => {
9
9
  return keys.units[type];
10
10
  };
11
- export const getIsIpadOrIphoneDevice = () => {
12
- if (!IS_WEB) {
13
- return false;
14
- }
15
- const isIOS = /iPad|iPhone|iPod/.test(navigator.platform);
16
- const isIpadOS = navigator?.maxTouchPoints > 2 && /MacIntel/.test(navigator.platform);
17
- return isIOS || isIpadOS;
18
- };
11
+ export const getIsIpadOrIphoneDevice = () => isIosWeb;
19
12
  export const isMobileWidth = (width, characterType) => {
20
13
  const layoutWidth = getMobileBreakpointByCharType(characterType);
21
14
  return width <= layoutWidth;
@@ -1 +1 @@
1
- {"version":3,"names":["IS_WEB","getMobileBreakpointByCharType","getMainKeyboardGroup","keys","type","operators","getUnitsKeyboardGroup","units","getIsIpadOrIphoneDevice","isIOS","test","navigator","platform","isIpadOS","maxTouchPoints","isMobileWidth","width","characterType","layoutWidth"],"sourceRoot":"../../../../src","sources":["features/keyboard/helpers.ts"],"mappings":";;AAAA,SAASA,MAAM,QAAQ,4BAA4B;AACnD,SAASC,6BAA6B,QAAQ,gCAA6B;AAG3E,OAAO,MAAMC,oBAAoB,GAAGA,CAACC,IAAsB,EAAEC,IAAkB,KAAK;EAClF,OAAOD,IAAI,CAACE,SAAS,CAACD,IAAI,CAAC;AAC7B,CAAC;AAED,OAAO,MAAME,qBAAqB,GAAGA,CAACH,IAAsB,EAAEC,IAA4B,KAAK;EAC7F,OAAOD,IAAI,CAACI,KAAK,CAACH,IAAI,CAAC;AACzB,CAAC;AAED,OAAO,MAAMI,uBAAuB,GAAGA,CAAA,KAAM;EAC3C,IAAI,CAACR,MAAM,EAAE;IACX,OAAO,KAAK;EACd;EACA,MAAMS,KAAK,GAAG,kBAAkB,CAACC,IAAI,CAACC,SAAS,CAACC,QAAQ,CAAC;EACzD,MAAMC,QAAQ,GAAGF,SAAS,EAAEG,cAAc,GAAG,CAAC,IAAI,UAAU,CAACJ,IAAI,CAACC,SAAS,CAACC,QAAQ,CAAC;EACrF,OAAOH,KAAK,IAAII,QAAQ;AAC1B,CAAC;AAED,OAAO,MAAME,aAAa,GAAGA,CAACC,KAAa,EAAEC,aAAsB,KAAK;EACtE,MAAMC,WAAW,GAAGjB,6BAA6B,CAACgB,aAAa,CAAC;EAChE,OAAOD,KAAK,IAAIE,WAAW;AAC7B,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["isIosWeb","getMobileBreakpointByCharType","getMainKeyboardGroup","keys","type","operators","getUnitsKeyboardGroup","units","getIsIpadOrIphoneDevice","isMobileWidth","width","characterType","layoutWidth"],"sourceRoot":"../../../../src","sources":["features/keyboard/helpers.ts"],"mappings":";;AAAA,SAASA,QAAQ,QAAQ,kCAA+B;AACxD,SAASC,6BAA6B,QAAQ,gCAA6B;AAG3E,OAAO,MAAMC,oBAAoB,GAAGA,CAACC,IAAsB,EAAEC,IAAkB,KAAK;EAClF,OAAOD,IAAI,CAACE,SAAS,CAACD,IAAI,CAAC;AAC7B,CAAC;AAED,OAAO,MAAME,qBAAqB,GAAGA,CAACH,IAAsB,EAAEC,IAA4B,KAAK;EAC7F,OAAOD,IAAI,CAACI,KAAK,CAACH,IAAI,CAAC;AACzB,CAAC;AAED,OAAO,MAAMI,uBAAuB,GAAGA,CAAA,KAAMR,QAAQ;AAErD,OAAO,MAAMS,aAAa,GAAGA,CAACC,KAAa,EAAEC,aAAsB,KAAK;EACtE,MAAMC,WAAW,GAAGX,6BAA6B,CAACU,aAAa,CAAC;EAChE,OAAOD,KAAK,IAAIE,WAAW;AAC7B,CAAC","ignoreList":[]}
@@ -2,6 +2,11 @@
2
2
 
3
3
  import { Platform } from 'react-native';
4
4
  export const isWeb = Platform.OS === 'web';
5
+
6
+ // iOS Safari / iPadOS on web is the only web platform where the on-screen keyboard
7
+ // overlaps content instead of resizing the viewport (Android resizes it via the
8
+ // `interactive-widget` meta tag; desktop has no virtual keyboard).
9
+ export const isIosWeb = isWeb && (/iPad|iPhone|iPod/.test(navigator.platform) || navigator.maxTouchPoints > 2 && /MacIntel/.test(navigator.platform));
5
10
  export let SortingDirection = /*#__PURE__*/function (SortingDirection) {
6
11
  SortingDirection["DESC"] = "desc";
7
12
  SortingDirection["ASC"] = "asc";
@@ -1 +1 @@
1
- {"version":3,"names":["Platform","isWeb","OS","SortingDirection","BURGER_MENU_BREAKPOINT"],"sourceRoot":"../../../src","sources":["shared/common.constants.ts"],"mappings":";;AAAA,SAASA,QAAQ,QAAQ,cAAc;AAEvC,OAAO,MAAMC,KAAK,GAAGD,QAAQ,CAACE,EAAE,KAAK,KAAK;AAE1C,WAAYC,gBAAgB,0BAAhBA,gBAAgB;EAAhBA,gBAAgB;EAAhBA,gBAAgB;EAAA,OAAhBA,gBAAgB;AAAA;AAK5B,OAAO,MAAMC,sBAAsB,GAAG,IAAI","ignoreList":[]}
1
+ {"version":3,"names":["Platform","isWeb","OS","isIosWeb","test","navigator","platform","maxTouchPoints","SortingDirection","BURGER_MENU_BREAKPOINT"],"sourceRoot":"../../../src","sources":["shared/common.constants.ts"],"mappings":";;AAAA,SAASA,QAAQ,QAAQ,cAAc;AAEvC,OAAO,MAAMC,KAAK,GAAGD,QAAQ,CAACE,EAAE,KAAK,KAAK;;AAE1C;AACA;AACA;AACA,OAAO,MAAMC,QAAQ,GACnBF,KAAK,KACJ,kBAAkB,CAACG,IAAI,CAACC,SAAS,CAACC,QAAQ,CAAC,IACzCD,SAAS,CAACE,cAAc,GAAG,CAAC,IAAI,UAAU,CAACH,IAAI,CAACC,SAAS,CAACC,QAAQ,CAAE,CAAC;AAE1E,WAAYE,gBAAgB,0BAAhBA,gBAAgB;EAAhBA,gBAAgB;EAAhBA,gBAAgB;EAAA,OAAhBA,gBAAgB;AAAA;AAK5B,OAAO,MAAMC,sBAAsB,GAAG,IAAI","ignoreList":[]}
@@ -2,7 +2,8 @@
2
2
 
3
3
  import { useEffect, useRef } from 'react';
4
4
  import { Animated, Keyboard, Platform } from 'react-native';
5
- import { isWeb } from "../common.constants.js";
5
+ import { IS_MOBILE } from '@magmamath/react-native-ui';
6
+ import { isIosWeb } from "../common.constants.js";
6
7
  const SHOW_EVENT = Platform.OS === 'ios' ? 'keyboardWillShow' : 'keyboardDidShow';
7
8
  const HIDE_EVENT = Platform.OS === 'ios' ? 'keyboardWillHide' : 'keyboardDidHide';
8
9
  const ANIMATION_DURATION = 220;
@@ -10,10 +11,12 @@ const ANIMATION_DURATION = 220;
10
11
  /**
11
12
  * Returns an animated value tracking the on-screen keyboard height.
12
13
  *
13
- * - native: subscribes to the platform `Keyboard` events.
14
- * - web: reads `visualViewport`, so it only reacts to a *virtual* keyboard
15
- * (mobile browsers). A physical desktop keyboard never shrinks the viewport,
16
- * so the value stays 0 and nothing moves.
14
+ * Only reacts where the keyboard actually overlaps the modal:
15
+ * - native mobile (`IS_MOBILE`) via the platform `Keyboard` events;
16
+ * - iOS web (`isIosWeb`) via `visualViewport`.
17
+ *
18
+ * Android web (the viewport resizes itself via `interactive-widget`) and desktop
19
+ * (no virtual keyboard) keep the value at 0, so nothing moves.
17
20
  */
18
21
  export const useKeyboardOffset = () => {
19
22
  const keyboardHeight = useRef(new Animated.Value(0)).current;
@@ -21,9 +24,9 @@ export const useKeyboardOffset = () => {
21
24
  const animateTo = toValue => Animated.timing(keyboardHeight, {
22
25
  toValue,
23
26
  duration: ANIMATION_DURATION,
24
- useNativeDriver: !isWeb
27
+ useNativeDriver: IS_MOBILE
25
28
  }).start();
26
- if (isWeb) {
29
+ if (isIosWeb) {
27
30
  const viewport = window.visualViewport;
28
31
  if (!viewport) return;
29
32
  const update = () => {
@@ -37,6 +40,7 @@ export const useKeyboardOffset = () => {
37
40
  viewport.removeEventListener('scroll', update);
38
41
  };
39
42
  }
43
+ if (!IS_MOBILE) return;
40
44
  const showSub = Keyboard.addListener(SHOW_EVENT, event => animateTo(event.endCoordinates.height));
41
45
  const hideSub = Keyboard.addListener(HIDE_EVENT, () => animateTo(0));
42
46
  return () => {
@@ -1 +1 @@
1
- {"version":3,"names":["useEffect","useRef","Animated","Keyboard","Platform","isWeb","SHOW_EVENT","OS","HIDE_EVENT","ANIMATION_DURATION","useKeyboardOffset","keyboardHeight","Value","current","animateTo","toValue","timing","duration","useNativeDriver","start","viewport","window","visualViewport","update","overlap","Math","max","innerHeight","height","offsetTop","addEventListener","removeEventListener","showSub","addListener","event","endCoordinates","hideSub","remove"],"sourceRoot":"../../../../src","sources":["shared/hooks/useKeyboardOffset.ts"],"mappings":";;AAAA,SAASA,SAAS,EAAEC,MAAM,QAAQ,OAAO;AACzC,SAASC,QAAQ,EAAEC,QAAQ,EAAEC,QAAQ,QAA4B,cAAc;AAE/E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D,CAAC;IACH;IAEA,MAAMS,OAAO,GAAG7B,QAAQ,CAAC8B,WAAW,CAAC3B,UAAU,EAAG4B,KAAoB,IACpEpB,SAAS,CAACoB,KAAK,CAACC,cAAc,CAACP,MAAM,CACvC,CAAC;IACD,MAAMQ,OAAO,GAAGjC,QAAQ,CAAC8B,WAAW,CAACzB,UAAU,EAAE,MAAMM,SAAS,CAAC,CAAC,CAAC,CAAC;IACpE,OAAO,MAAM;MACXkB,OAAO,CAACK,MAAM,CAAC,CAAC;MAChBD,OAAO,CAACC,MAAM,CAAC,CAAC;IAClB,CAAC;EACH,CAAC,EAAE,CAAC1B,cAAc,CAAC,CAAC;EAEpB,OAAOA,cAAc;AACvB,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["useEffect","useRef","Animated","Keyboard","Platform","IS_MOBILE","isIosWeb","SHOW_EVENT","OS","HIDE_EVENT","ANIMATION_DURATION","useKeyboardOffset","keyboardHeight","Value","current","animateTo","toValue","timing","duration","useNativeDriver","start","viewport","window","visualViewport","update","overlap","Math","max","innerHeight","height","offsetTop","addEventListener","removeEventListener","showSub","addListener","event","endCoordinates","hideSub","remove"],"sourceRoot":"../../../../src","sources":["shared/hooks/useKeyboardOffset.ts"],"mappings":";;AAAA,SAASA,SAAS,EAAEC,MAAM,QAAQ,OAAO;AACzC,SAASC,QAAQ,EAAEC,QAAQ,EAAEC,QAAQ,QAA4B,cAAc;AAC/E,SAASC,SAAS,QAAQ,4BAA4B;AAEtD,SAASC,QAAQ,QAAQ,wBAAqB;AAE9C,MAAMC,UAAU,GAAGH,QAAQ,CAACI,EAAE,KAAK,KAAK,GAAG,kBAAkB,GAAG,iBAAiB;AACjF,MAAMC,UAAU,GAAGL,QAAQ,CAACI,EAAE,KAAK,KAAK,GAAG,kBAAkB,GAAG,iBAAiB;AACjF,MAAME,kBAAkB,GAAG,GAAG;;AAE9B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,iBAAiB,GAA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AM;MACXkB,OAAO,CAACK,MAAM,CAAC,CAAC;MAChBD,OAAO,CAACC,MAAM,CAAC,CAAC;IAClB,CAAC;EACH,CAAC,EAAE,CAAC1B,cAAc,CAAC,CAAC;EAEpB,OAAOA,cAAc;AACvB,CAAC","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../../../../src/features/keyboard/helpers.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,sBAAsB,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAA;AAEtF,eAAO,MAAM,oBAAoB,SAAU,gBAAgB,QAAQ,YAAY,0CAE9E,CAAA;AAED,eAAO,MAAM,qBAAqB,SAAU,gBAAgB,QAAQ,sBAAsB,8CAEzF,CAAA;AAED,eAAO,MAAM,uBAAuB,eAOnC,CAAA;AAED,eAAO,MAAM,aAAa,UAAW,MAAM,kBAAkB,MAAM,YAGlE,CAAA"}
1
+ {"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../../../../src/features/keyboard/helpers.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,sBAAsB,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAA;AAEtF,eAAO,MAAM,oBAAoB,SAAU,gBAAgB,QAAQ,YAAY,0CAE9E,CAAA;AAED,eAAO,MAAM,qBAAqB,SAAU,gBAAgB,QAAQ,sBAAsB,8CAEzF,CAAA;AAED,eAAO,MAAM,uBAAuB,eAAiB,CAAA;AAErD,eAAO,MAAM,aAAa,UAAW,MAAM,kBAAkB,MAAM,YAGlE,CAAA"}
@@ -1,4 +1,5 @@
1
1
  export declare const isWeb: boolean;
2
+ export declare const isIosWeb: boolean;
2
3
  export declare enum SortingDirection {
3
4
  DESC = "desc",
4
5
  ASC = "asc"
@@ -1 +1 @@
1
- {"version":3,"file":"common.constants.d.ts","sourceRoot":"","sources":["../../../../src/shared/common.constants.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,KAAK,SAAwB,CAAA;AAE1C,oBAAY,gBAAgB;IAC1B,IAAI,SAAS;IACb,GAAG,QAAQ;CACZ;AAED,eAAO,MAAM,sBAAsB,OAAO,CAAA"}
1
+ {"version":3,"file":"common.constants.d.ts","sourceRoot":"","sources":["../../../../src/shared/common.constants.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,KAAK,SAAwB,CAAA;AAK1C,eAAO,MAAM,QAAQ,SAGqD,CAAA;AAE1E,oBAAY,gBAAgB;IAC1B,IAAI,SAAS;IACb,GAAG,QAAQ;CACZ;AAED,eAAO,MAAM,sBAAsB,OAAO,CAAA"}
@@ -2,10 +2,12 @@ import { Animated } from 'react-native';
2
2
  /**
3
3
  * Returns an animated value tracking the on-screen keyboard height.
4
4
  *
5
- * - native: subscribes to the platform `Keyboard` events.
6
- * - web: reads `visualViewport`, so it only reacts to a *virtual* keyboard
7
- * (mobile browsers). A physical desktop keyboard never shrinks the viewport,
8
- * so the value stays 0 and nothing moves.
5
+ * Only reacts where the keyboard actually overlaps the modal:
6
+ * - native mobile (`IS_MOBILE`) via the platform `Keyboard` events;
7
+ * - iOS web (`isIosWeb`) via `visualViewport`.
8
+ *
9
+ * Android web (the viewport resizes itself via `interactive-widget`) and desktop
10
+ * (no virtual keyboard) keep the value at 0, so nothing moves.
9
11
  */
10
12
  export declare const useKeyboardOffset: () => Animated.Value;
11
13
  //# sourceMappingURL=useKeyboardOffset.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"useKeyboardOffset.d.ts","sourceRoot":"","sources":["../../../../../src/shared/hooks/useKeyboardOffset.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAA0C,MAAM,cAAc,CAAA;AAQ/E;;;;;;;GAOG;AACH,eAAO,MAAM,iBAAiB,sBAuC7B,CAAA"}
1
+ {"version":3,"file":"useKeyboardOffset.d.ts","sourceRoot":"","sources":["../../../../../src/shared/hooks/useKeyboardOffset.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAA0C,MAAM,cAAc,CAAA;AAS/E;;;;;;;;;GASG;AACH,eAAO,MAAM,iBAAiB,sBAyC7B,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../../../../src/features/keyboard/helpers.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,sBAAsB,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAA;AAEtF,eAAO,MAAM,oBAAoB,SAAU,gBAAgB,QAAQ,YAAY,0CAE9E,CAAA;AAED,eAAO,MAAM,qBAAqB,SAAU,gBAAgB,QAAQ,sBAAsB,8CAEzF,CAAA;AAED,eAAO,MAAM,uBAAuB,eAOnC,CAAA;AAED,eAAO,MAAM,aAAa,UAAW,MAAM,kBAAkB,MAAM,YAGlE,CAAA"}
1
+ {"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../../../../src/features/keyboard/helpers.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,sBAAsB,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAA;AAEtF,eAAO,MAAM,oBAAoB,SAAU,gBAAgB,QAAQ,YAAY,0CAE9E,CAAA;AAED,eAAO,MAAM,qBAAqB,SAAU,gBAAgB,QAAQ,sBAAsB,8CAEzF,CAAA;AAED,eAAO,MAAM,uBAAuB,eAAiB,CAAA;AAErD,eAAO,MAAM,aAAa,UAAW,MAAM,kBAAkB,MAAM,YAGlE,CAAA"}
@@ -1,4 +1,5 @@
1
1
  export declare const isWeb: boolean;
2
+ export declare const isIosWeb: boolean;
2
3
  export declare enum SortingDirection {
3
4
  DESC = "desc",
4
5
  ASC = "asc"
@@ -1 +1 @@
1
- {"version":3,"file":"common.constants.d.ts","sourceRoot":"","sources":["../../../../src/shared/common.constants.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,KAAK,SAAwB,CAAA;AAE1C,oBAAY,gBAAgB;IAC1B,IAAI,SAAS;IACb,GAAG,QAAQ;CACZ;AAED,eAAO,MAAM,sBAAsB,OAAO,CAAA"}
1
+ {"version":3,"file":"common.constants.d.ts","sourceRoot":"","sources":["../../../../src/shared/common.constants.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,KAAK,SAAwB,CAAA;AAK1C,eAAO,MAAM,QAAQ,SAGqD,CAAA;AAE1E,oBAAY,gBAAgB;IAC1B,IAAI,SAAS;IACb,GAAG,QAAQ;CACZ;AAED,eAAO,MAAM,sBAAsB,OAAO,CAAA"}
@@ -2,10 +2,12 @@ import { Animated } from 'react-native';
2
2
  /**
3
3
  * Returns an animated value tracking the on-screen keyboard height.
4
4
  *
5
- * - native: subscribes to the platform `Keyboard` events.
6
- * - web: reads `visualViewport`, so it only reacts to a *virtual* keyboard
7
- * (mobile browsers). A physical desktop keyboard never shrinks the viewport,
8
- * so the value stays 0 and nothing moves.
5
+ * Only reacts where the keyboard actually overlaps the modal:
6
+ * - native mobile (`IS_MOBILE`) via the platform `Keyboard` events;
7
+ * - iOS web (`isIosWeb`) via `visualViewport`.
8
+ *
9
+ * Android web (the viewport resizes itself via `interactive-widget`) and desktop
10
+ * (no virtual keyboard) keep the value at 0, so nothing moves.
9
11
  */
10
12
  export declare const useKeyboardOffset: () => Animated.Value;
11
13
  //# sourceMappingURL=useKeyboardOffset.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"useKeyboardOffset.d.ts","sourceRoot":"","sources":["../../../../../src/shared/hooks/useKeyboardOffset.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAA0C,MAAM,cAAc,CAAA;AAQ/E;;;;;;;GAOG;AACH,eAAO,MAAM,iBAAiB,sBAuC7B,CAAA"}
1
+ {"version":3,"file":"useKeyboardOffset.d.ts","sourceRoot":"","sources":["../../../../../src/shared/hooks/useKeyboardOffset.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAA0C,MAAM,cAAc,CAAA;AAS/E;;;;;;;;;GASG;AACH,eAAO,MAAM,iBAAiB,sBAyC7B,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@magmamath/students-features",
3
- "version": "1.8.5-rc.1",
3
+ "version": "1.8.6-rc.2",
4
4
  "description": "Magmamath features library",
5
5
  "source": "src/index.ts",
6
6
  "main": "src/index.ts",
@@ -1,4 +1,4 @@
1
- import { IS_WEB } from '@magmamath/react-native-ui'
1
+ import { isIosWeb } from '../../shared/common.constants'
2
2
  import { getMobileBreakpointByCharType } from './constants/keyboardLayouts'
3
3
  import { KeyboardType, KeyboardUnitsGroupType, ResolvedKeyboard } from './types/types'
4
4
 
@@ -10,14 +10,7 @@ export const getUnitsKeyboardGroup = (keys: ResolvedKeyboard, type: KeyboardUnit
10
10
  return keys.units[type]
11
11
  }
12
12
 
13
- export const getIsIpadOrIphoneDevice = () => {
14
- if (!IS_WEB) {
15
- return false
16
- }
17
- const isIOS = /iPad|iPhone|iPod/.test(navigator.platform)
18
- const isIpadOS = navigator?.maxTouchPoints > 2 && /MacIntel/.test(navigator.platform)
19
- return isIOS || isIpadOS
20
- }
13
+ export const getIsIpadOrIphoneDevice = () => isIosWeb
21
14
 
22
15
  export const isMobileWidth = (width: number, characterType?: number) => {
23
16
  const layoutWidth = getMobileBreakpointByCharType(characterType)
@@ -2,6 +2,14 @@ import { Platform } from 'react-native'
2
2
 
3
3
  export const isWeb = Platform.OS === 'web'
4
4
 
5
+ // iOS Safari / iPadOS on web is the only web platform where the on-screen keyboard
6
+ // overlaps content instead of resizing the viewport (Android resizes it via the
7
+ // `interactive-widget` meta tag; desktop has no virtual keyboard).
8
+ export const isIosWeb =
9
+ isWeb &&
10
+ (/iPad|iPhone|iPod/.test(navigator.platform) ||
11
+ (navigator.maxTouchPoints > 2 && /MacIntel/.test(navigator.platform)))
12
+
5
13
  export enum SortingDirection {
6
14
  DESC = 'desc',
7
15
  ASC = 'asc',
@@ -1,7 +1,8 @@
1
1
  import { useEffect, useRef } from 'react'
2
2
  import { Animated, Keyboard, Platform, type KeyboardEvent } from 'react-native'
3
+ import { IS_MOBILE } from '@magmamath/react-native-ui'
3
4
 
4
- import { isWeb } from '../common.constants'
5
+ import { isIosWeb } from '../common.constants'
5
6
 
6
7
  const SHOW_EVENT = Platform.OS === 'ios' ? 'keyboardWillShow' : 'keyboardDidShow'
7
8
  const HIDE_EVENT = Platform.OS === 'ios' ? 'keyboardWillHide' : 'keyboardDidHide'
@@ -10,10 +11,12 @@ const ANIMATION_DURATION = 220
10
11
  /**
11
12
  * Returns an animated value tracking the on-screen keyboard height.
12
13
  *
13
- * - native: subscribes to the platform `Keyboard` events.
14
- * - web: reads `visualViewport`, so it only reacts to a *virtual* keyboard
15
- * (mobile browsers). A physical desktop keyboard never shrinks the viewport,
16
- * so the value stays 0 and nothing moves.
14
+ * Only reacts where the keyboard actually overlaps the modal:
15
+ * - native mobile (`IS_MOBILE`) via the platform `Keyboard` events;
16
+ * - iOS web (`isIosWeb`) via `visualViewport`.
17
+ *
18
+ * Android web (the viewport resizes itself via `interactive-widget`) and desktop
19
+ * (no virtual keyboard) keep the value at 0, so nothing moves.
17
20
  */
18
21
  export const useKeyboardOffset = () => {
19
22
  const keyboardHeight = useRef(new Animated.Value(0)).current
@@ -23,10 +26,10 @@ export const useKeyboardOffset = () => {
23
26
  Animated.timing(keyboardHeight, {
24
27
  toValue,
25
28
  duration: ANIMATION_DURATION,
26
- useNativeDriver: !isWeb,
29
+ useNativeDriver: IS_MOBILE,
27
30
  }).start()
28
31
 
29
- if (isWeb) {
32
+ if (isIosWeb) {
30
33
  const viewport = window.visualViewport
31
34
  if (!viewport) return
32
35
 
@@ -43,6 +46,8 @@ export const useKeyboardOffset = () => {
43
46
  }
44
47
  }
45
48
 
49
+ if (!IS_MOBILE) return
50
+
46
51
  const showSub = Keyboard.addListener(SHOW_EVENT, (event: KeyboardEvent) =>
47
52
  animateTo(event.endCoordinates.height),
48
53
  )