@applicaster/zapp-react-dom-app 13.0.0-rc.34 → 13.0.0-rc.36

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.
@@ -140,13 +140,16 @@ class InteractionManagerClass extends React.Component<Props, State> {
140
140
  this.onConfirmDialogOpen = this.onConfirmDialogOpen.bind(this);
141
141
  this.onConfirmDialogClose = this.onConfirmDialogClose.bind(this);
142
142
 
143
+ this.handlePhysicalKeyboardDismiss =
144
+ this.handlePhysicalKeyboardDismiss.bind(this);
145
+
143
146
  this.confirmDialog.setConfirmAction(this.performExit);
144
147
  this.confirmDialog.setCancelAction(this.onConfirmDialogClose);
145
148
  this.longPressDetector = new KeyboardLongPressManager();
146
149
  }
147
150
 
148
151
  componentDidMount() {
149
- window.addEventListener("keydown", this.onKeyDownListener);
152
+ window.addEventListener("keydown", this.onKeyDownListener, true);
150
153
  window.addEventListener("keyup", this.onKeyUp);
151
154
  window.addEventListener("mousemove", this.onMouseMoveListener);
152
155
 
@@ -181,6 +184,11 @@ class InteractionManagerClass extends React.Component<Props, State> {
181
184
  "onLongPressRelease",
182
185
  this.handleLongPressRelease.bind(this)
183
186
  );
187
+
188
+ document.addEventListener(
189
+ "keyboardDismissedByPhysicalKeypress",
190
+ this.handlePhysicalKeyboardDismiss
191
+ );
184
192
  }
185
193
 
186
194
  componentWillUnmount() {
@@ -209,6 +217,11 @@ class InteractionManagerClass extends React.Component<Props, State> {
209
217
  "onLongPressRelease",
210
218
  this.handleLongPressRelease
211
219
  );
220
+
221
+ document.removeEventListener(
222
+ "keyboardDismissedByPhysicalKeypress",
223
+ this.handlePhysicalKeyboardDismiss
224
+ );
212
225
  }
213
226
 
214
227
  performExit() {
@@ -448,20 +461,13 @@ class InteractionManagerClass extends React.Component<Props, State> {
448
461
  }
449
462
 
450
463
  /**
451
- When pressing backspace or the Native "Back" button:
464
+ When pressing escape or the Native "Back" button:
452
465
  if on the transport controls: we show the player
453
466
  if on the player : we show the UI
454
467
  if on the UI : we exit the app
468
+ note: backspace affects the keyboard input, so it not handled here
455
469
  */
456
-
457
- if (
458
- keyCode(event).matchesAny(
459
- KEYS.Back,
460
- KEYS.Escape,
461
- KEYS.EscapeDevice,
462
- KEYS.Backspace
463
- )
464
- ) {
470
+ if (keyCode(event).matchesAny(KEYS.Back, KEYS.Escape, KEYS.EscapeDevice)) {
465
471
  switch (displayState) {
466
472
  case DISPLAY_STATES.DEFAULT:
467
473
  case DISPLAY_STATES.PLAYER:
@@ -652,7 +658,7 @@ class InteractionManagerClass extends React.Component<Props, State> {
652
658
  }
653
659
  }
654
660
 
655
- handleKeyboardDismiss = () => {
661
+ handleKeyboardDismiss() {
656
662
  this.isDismissing = true;
657
663
 
658
664
  this.setState(
@@ -663,9 +669,10 @@ class InteractionManagerClass extends React.Component<Props, State> {
663
669
  },
664
670
  () => {
665
671
  this.isDismissing = false;
672
+ focusManager.recoverFocus();
666
673
  }
667
674
  );
668
- };
675
+ }
669
676
 
670
677
  handleKeyboardInput = (value: string) => {
671
678
  const { activeInputRef } = this.state;
@@ -761,6 +768,35 @@ class InteractionManagerClass extends React.Component<Props, State> {
761
768
  ].includes(event.code);
762
769
  }
763
770
 
771
+ handlePhysicalKeyboardDismiss(event: CustomEvent) {
772
+ const { value, position, inputElement } = event.detail;
773
+
774
+ this.isDismissing = true;
775
+
776
+ this.setState(
777
+ {
778
+ isKeyboardVisible: false,
779
+ keyboardInput: "",
780
+ activeInputRef: null,
781
+ },
782
+ () => {
783
+ if (inputElement) {
784
+ inputElement.value = value;
785
+ inputElement.focus();
786
+ inputElement.setSelectionRange(position, position);
787
+
788
+ const keyboardEvent = new CustomEvent("keyboardUpdate", {
789
+ detail: { value },
790
+ });
791
+
792
+ document.dispatchEvent(keyboardEvent);
793
+ }
794
+
795
+ this.isDismissing = false;
796
+ }
797
+ );
798
+ }
799
+
764
800
  render() {
765
801
  return (
766
802
  (shouldUseOnScreenKeyboard() && this.state.isKeyboardVisible && (
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@applicaster/zapp-react-dom-app",
3
- "version": "13.0.0-rc.34",
3
+ "version": "13.0.0-rc.36",
4
4
  "description": "Zapp App Component for Applicaster's Quick Brick React Native App",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -22,11 +22,11 @@
22
22
  },
23
23
  "homepage": "https://github.com/applicaster/zapp-react-dom-app#readme",
24
24
  "dependencies": {
25
- "@applicaster/zapp-react-dom-ui-components": "13.0.0-rc.34",
26
- "@applicaster/zapp-react-native-bridge": "13.0.0-rc.34",
27
- "@applicaster/zapp-react-native-redux": "13.0.0-rc.34",
28
- "@applicaster/zapp-react-native-ui-components": "13.0.0-rc.34",
29
- "@applicaster/zapp-react-native-utils": "13.0.0-rc.34",
25
+ "@applicaster/zapp-react-dom-ui-components": "13.0.0-rc.36",
26
+ "@applicaster/zapp-react-native-bridge": "13.0.0-rc.36",
27
+ "@applicaster/zapp-react-native-redux": "13.0.0-rc.36",
28
+ "@applicaster/zapp-react-native-ui-components": "13.0.0-rc.36",
29
+ "@applicaster/zapp-react-native-utils": "13.0.0-rc.36",
30
30
  "abortcontroller-polyfill": "^1.7.5",
31
31
  "react-router-dom": "^5.1.2",
32
32
  "typeface-montserrat": "^0.0.54",