@applicaster/zapp-react-dom-app 12.0.0-rc.120 → 12.0.0-rc.121

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.
@@ -67,7 +67,11 @@ type Props = {
67
67
  };
68
68
  };
69
69
 
70
- type State = { isKeyboardVisible: boolean; keyboardInput: string };
70
+ interface State {
71
+ isKeyboardVisible: boolean;
72
+ keyboardInput: string;
73
+ activeInputRef: HTMLInputElement | null;
74
+ }
71
75
 
72
76
  type KeyCode = { code: string; keyCode: number | string };
73
77
 
@@ -96,6 +100,7 @@ class InteractionManagerClass extends React.Component<Props, State> {
96
100
  this.state = {
97
101
  isKeyboardVisible: false,
98
102
  keyboardInput: "",
103
+ activeInputRef: null,
99
104
  };
100
105
 
101
106
  this.onMouseMoveListener = debounce({
@@ -461,6 +466,17 @@ class InteractionManagerClass extends React.Component<Props, State> {
461
466
 
462
467
  const { isDialogVisible } = confirmationDialogStore.getState();
463
468
 
469
+ if (isKeyboardVisible && shouldUseOnScreenKeyboard()) {
470
+ if (keyCode(event).matchesAny("Escape", "Back")) {
471
+ this.handleKeyboardDismiss();
472
+ }
473
+
474
+ event.preventDefault();
475
+ event.stopPropagation();
476
+
477
+ return;
478
+ }
479
+
464
480
  // If this is a supported longpress key we need to set the timeout and handle the longpress
465
481
  if (this.keySupportsLongPress(event)) {
466
482
  this.longKeyPressTimeout = setTimeout(() => {
@@ -468,16 +484,6 @@ class InteractionManagerClass extends React.Component<Props, State> {
468
484
  }, LONG_KEY_PRESS_TIMEOUT);
469
485
  }
470
486
 
471
- if (isKeyboardVisible && shouldUseOnScreenKeyboard()) {
472
- if (keyCode(event).matchesAny("Escape", "Back")) {
473
- event.preventDefault();
474
- event.stopPropagation();
475
- this.handleKeyboardDismiss();
476
-
477
- return;
478
- }
479
- }
480
-
481
487
  /**
482
488
  When the player is displayed, we listen to Native Play / Pause / Stop
483
489
  buttons. Any other key press will display the transport controls
@@ -694,16 +700,15 @@ class InteractionManagerClass extends React.Component<Props, State> {
694
700
 
695
701
  handleInputFocus = (event: FocusEvent) => {
696
702
  if (!shouldUseOnScreenKeyboard()) return;
697
- const target = event.target as HTMLElement;
703
+ const target = event.target as HTMLInputElement;
698
704
 
699
- if (this.isDismissing) {
700
- return;
701
- }
705
+ if (this.isDismissing) return;
702
706
 
703
707
  if (target.tagName === "INPUT" || target.tagName === "TEXTAREA") {
704
708
  this.setState({
705
709
  isKeyboardVisible: true,
706
- keyboardInput: (target as HTMLInputElement).value || "",
710
+ keyboardInput: target.value || "",
711
+ activeInputRef: target,
707
712
  });
708
713
  }
709
714
  };
@@ -733,6 +738,7 @@ class InteractionManagerClass extends React.Component<Props, State> {
733
738
  {
734
739
  isKeyboardVisible: false,
735
740
  keyboardInput: "",
741
+ activeInputRef: null,
736
742
  },
737
743
  () => {
738
744
  this.isDismissing = false;
@@ -740,15 +746,29 @@ class InteractionManagerClass extends React.Component<Props, State> {
740
746
  );
741
747
  };
742
748
 
743
- handleKeyboardInput(value: string) {
749
+ handleKeyboardInput = (value: string) => {
750
+ const { activeInputRef } = this.state;
751
+
752
+ if (activeInputRef) {
753
+ // Update the input's value
754
+ activeInputRef.value = value;
755
+
756
+ // Dispatch keyboard update event
757
+ const keyboardEvent = new CustomEvent("keyboardUpdate", {
758
+ detail: { value },
759
+ });
760
+
761
+ document.dispatchEvent(keyboardEvent);
762
+ }
763
+
744
764
  this.setState({ keyboardInput: value });
745
- }
765
+ };
746
766
 
747
767
  render() {
748
768
  return (
749
769
  (shouldUseOnScreenKeyboard() && this.state.isKeyboardVisible && (
750
770
  <OnScreenKeyboard
751
- initialValue={this.state.keyboardInput}
771
+ value={this.state.keyboardInput}
752
772
  onInput={this.handleKeyboardInput}
753
773
  onDismiss={this.handleKeyboardDismiss}
754
774
  />
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@applicaster/zapp-react-dom-app",
3
- "version": "12.0.0-rc.120",
3
+ "version": "12.0.0-rc.121",
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": "12.0.0-rc.120",
26
- "@applicaster/zapp-react-native-bridge": "12.0.0-rc.120",
27
- "@applicaster/zapp-react-native-redux": "12.0.0-rc.120",
28
- "@applicaster/zapp-react-native-ui-components": "12.0.0-rc.120",
29
- "@applicaster/zapp-react-native-utils": "12.0.0-rc.120",
25
+ "@applicaster/zapp-react-dom-ui-components": "12.0.0-rc.121",
26
+ "@applicaster/zapp-react-native-bridge": "12.0.0-rc.121",
27
+ "@applicaster/zapp-react-native-redux": "12.0.0-rc.121",
28
+ "@applicaster/zapp-react-native-ui-components": "12.0.0-rc.121",
29
+ "@applicaster/zapp-react-native-utils": "12.0.0-rc.121",
30
30
  "abortcontroller-polyfill": "^1.7.5",
31
31
  "history": "^4.7.2",
32
32
  "react-router-dom": "^5.1.2",