@applicaster/zapp-react-dom-app 13.0.0-alpha.3755455151 → 13.0.0-alpha.4004617449

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() {
@@ -386,7 +399,7 @@ class InteractionManagerClass extends React.Component<Props, State> {
386
399
  this.longPressDetector.monitorKeyPress(event.code, event);
387
400
  }
388
401
 
389
- // None of the logic below should be executed for repeated keys
402
+ // Only handle repeat events for arrow keys
390
403
  if (event.repeat && !keyCode(event).matchesAny(...ARROW_KEYS)) return;
391
404
 
392
405
  /**
@@ -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:
@@ -510,6 +516,7 @@ class InteractionManagerClass extends React.Component<Props, State> {
510
516
  if (displayState === DISPLAY_STATES.PLAYER) {
511
517
  setDisplayState(DISPLAY_STATES.HUD);
512
518
  } else {
519
+ focusManager.pressIn();
513
520
  focusManager.press();
514
521
  }
515
522
 
@@ -542,12 +549,6 @@ class InteractionManagerClass extends React.Component<Props, State> {
542
549
  focusManager.moveFocus(direction);
543
550
  }
544
551
 
545
- if (!isDialogVisible) {
546
- // run focus recovery on user interaction attempt
547
- // probably we failed to set initial focus for some reason
548
- focusManager.recoverFocus();
549
- }
550
-
551
552
  if (
552
553
  displayState === DISPLAY_STATES.PLAYER ||
553
554
  displayState === DISPLAY_STATES.HUD
@@ -623,6 +624,7 @@ class InteractionManagerClass extends React.Component<Props, State> {
623
624
 
624
625
  if (
625
626
  (target.tagName === "INPUT" && target.type === "text") ||
627
+ (target.tagName === "INPUT" && target.type === "password") ||
626
628
  target.tagName === "TEXTAREA"
627
629
  ) {
628
630
  this.setState({
@@ -651,7 +653,7 @@ class InteractionManagerClass extends React.Component<Props, State> {
651
653
  }
652
654
  }
653
655
 
654
- handleKeyboardDismiss = () => {
656
+ handleKeyboardDismiss() {
655
657
  this.isDismissing = true;
656
658
 
657
659
  this.setState(
@@ -662,9 +664,10 @@ class InteractionManagerClass extends React.Component<Props, State> {
662
664
  },
663
665
  () => {
664
666
  this.isDismissing = false;
667
+ focusManager.recoverFocus();
665
668
  }
666
669
  );
667
- };
670
+ }
668
671
 
669
672
  handleKeyboardInput = (value: string) => {
670
673
  const { activeInputRef } = this.state;
@@ -760,6 +763,35 @@ class InteractionManagerClass extends React.Component<Props, State> {
760
763
  ].includes(event.code);
761
764
  }
762
765
 
766
+ handlePhysicalKeyboardDismiss(event: CustomEvent) {
767
+ const { value, position, inputElement } = event.detail;
768
+
769
+ this.isDismissing = true;
770
+
771
+ this.setState(
772
+ {
773
+ isKeyboardVisible: false,
774
+ keyboardInput: "",
775
+ activeInputRef: null,
776
+ },
777
+ () => {
778
+ if (inputElement) {
779
+ inputElement.value = value;
780
+ inputElement.focus();
781
+ inputElement.setSelectionRange(position, position);
782
+
783
+ const keyboardEvent = new CustomEvent("keyboardUpdate", {
784
+ detail: { value },
785
+ });
786
+
787
+ document.dispatchEvent(keyboardEvent);
788
+ }
789
+
790
+ this.isDismissing = false;
791
+ }
792
+ );
793
+ }
794
+
763
795
  render() {
764
796
  return (
765
797
  (shouldUseOnScreenKeyboard() && this.state.isKeyboardVisible && (
@@ -4,8 +4,8 @@ import { QuickBrickCommunicationModule } from "../../Polyfills/QuickBrickCommuni
4
4
  import { loadLocaleImpl, getLanguageCode } from "./utils";
5
5
 
6
6
  type Locale = {
7
- language: string,
8
- country: string,
7
+ language: string;
8
+ country: string;
9
9
  };
10
10
 
11
11
  async function getBrowserLocale() {
package/index.js CHANGED
@@ -1,13 +1,11 @@
1
1
  /// <reference types="@applicaster/applicaster-types" />
2
2
  import * as R from "ramda";
3
- import { useHistory, useLocation } from "react-router-dom";
4
3
 
5
4
  import { createQuickBrickApp } from "@applicaster/quick-brick-core";
6
5
  import * as QuickBrickManager from "@applicaster/zapp-react-native-bridge/QuickBrick";
7
6
  import * as Contexts from "@applicaster/zapp-react-native-ui-components/Contexts";
8
7
  import { OfflineHandler } from "@applicaster/zapp-react-native-ui-components/Components/OfflineHandler";
9
8
  import { getXray } from "@applicaster/zapp-react-native-utils/logger";
10
- import { ZappDomRouter } from "./App/Router";
11
9
  import { Layout } from "./App/Layout";
12
10
  import { SplashLoader } from "./App/Loader/SplashLoader";
13
11
  import { appLoader } from "./App/Loader";
@@ -24,11 +22,6 @@ const contextProviders = R.map(R.prop("withProvider"), R.values(Contexts));
24
22
  if (withXray) contextProviders.push(withXray);
25
23
 
26
24
  export const ZappApp = createQuickBrickApp({
27
- navigations: {
28
- Router: ZappDomRouter,
29
- useLocation,
30
- useHistory,
31
- },
32
25
  QuickBrickManager,
33
26
  Layout,
34
27
  OfflineHandler,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@applicaster/zapp-react-dom-app",
3
- "version": "13.0.0-alpha.3755455151",
3
+ "version": "13.0.0-alpha.4004617449",
4
4
  "description": "Zapp App Component for Applicaster's Quick Brick React Native App",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -22,13 +22,12 @@
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-alpha.3755455151",
26
- "@applicaster/zapp-react-native-bridge": "13.0.0-alpha.3755455151",
27
- "@applicaster/zapp-react-native-redux": "13.0.0-alpha.3755455151",
28
- "@applicaster/zapp-react-native-ui-components": "13.0.0-alpha.3755455151",
29
- "@applicaster/zapp-react-native-utils": "13.0.0-alpha.3755455151",
25
+ "@applicaster/zapp-react-dom-ui-components": "13.0.0-alpha.4004617449",
26
+ "@applicaster/zapp-react-native-bridge": "13.0.0-alpha.4004617449",
27
+ "@applicaster/zapp-react-native-redux": "13.0.0-alpha.4004617449",
28
+ "@applicaster/zapp-react-native-ui-components": "13.0.0-alpha.4004617449",
29
+ "@applicaster/zapp-react-native-utils": "13.0.0-alpha.4004617449",
30
30
  "abortcontroller-polyfill": "^1.7.5",
31
- "history": "^4.7.2",
32
31
  "react-router-dom": "^5.1.2",
33
32
  "typeface-montserrat": "^0.0.54",
34
33
  "video.js": "7.14.3",
@@ -1,17 +0,0 @@
1
- import React from "react";
2
- import PropTypes from "prop-types";
3
-
4
- import { Router } from "react-router";
5
- import { createMemoryHistory } from "history";
6
-
7
- const history = createMemoryHistory();
8
-
9
- export const ZappDomRouter = ({ children, ...otherProps }) => (
10
- <Router history={history} {...otherProps}>
11
- {children}
12
- </Router>
13
- );
14
-
15
- ZappDomRouter.propTypes = {
16
- children: PropTypes.node.isRequired,
17
- };
@@ -1,30 +0,0 @@
1
- import React from "react";
2
-
3
- import "./spinner-styles.css";
4
-
5
- export const Spinner = (color) => {
6
- const spinnerColor = {
7
- background: color.color,
8
- };
9
-
10
- return (
11
- <div>
12
- <div id="progress">
13
- <div className="spinner">
14
- <div style={spinnerColor} className="bar1" />
15
- <div style={spinnerColor} className="bar2" />
16
- <div style={spinnerColor} className="bar3" />
17
- <div style={spinnerColor} className="bar4" />
18
- <div style={spinnerColor} className="bar5" />
19
- <div style={spinnerColor} className="bar6" />
20
- <div style={spinnerColor} className="bar7" />
21
- <div style={spinnerColor} className="bar8" />
22
- <div style={spinnerColor} className="bar9" />
23
- <div style={spinnerColor} className="bar10" />
24
- <div style={spinnerColor} className="bar11" />
25
- <div style={spinnerColor} className="bar12" />
26
- </div>
27
- </div>
28
- </div>
29
- );
30
- };
@@ -1,81 +0,0 @@
1
- div.spinner {
2
- position: absolute;
3
- width: 100px;
4
- height: 100px;
5
- display: inline-block;
6
- top: 50%;
7
- left: 50%;
8
- margin: -60px 0 0 -70px;
9
- }
10
-
11
- div.spinner div {
12
- width: 6%;
13
- height: 16%;
14
- position: absolute;
15
- left: 49%;
16
- top: 43%;
17
- opacity: 0;
18
- -webkit-border-radius: 50px;
19
- -webkit-box-shadow: 0 0 3px rgba(0, 0, 0, 0.2);
20
- -webkit-animation: fade 1s linear infinite;
21
- }
22
-
23
- @-webkit-keyframes fade {
24
- from {
25
- opacity: 1;
26
- }
27
- to {
28
- opacity: 0.25;
29
- }
30
- }
31
-
32
- div.spinner div.bar1 {
33
- -webkit-transform: rotate(0deg) translate(0, -130%);
34
- -webkit-animation-delay: 0s;
35
- }
36
-
37
- div.spinner div.bar2 {
38
- -webkit-transform: rotate(30deg) translate(0, -130%);
39
- -webkit-animation-delay: -0.9167s;
40
- }
41
-
42
- div.spinner div.bar3 {
43
- -webkit-transform: rotate(60deg) translate(0, -130%);
44
- -webkit-animation-delay: -0.833s;
45
- }
46
- div.spinner div.bar4 {
47
- -webkit-transform: rotate(90deg) translate(0, -130%);
48
- -webkit-animation-delay: -0.7497s;
49
- }
50
- div.spinner div.bar5 {
51
- -webkit-transform: rotate(120deg) translate(0, -130%);
52
- -webkit-animation-delay: -0.667s;
53
- }
54
- div.spinner div.bar6 {
55
- -webkit-transform: rotate(150deg) translate(0, -130%);
56
- -webkit-animation-delay: -0.5837s;
57
- }
58
- div.spinner div.bar7 {
59
- -webkit-transform: rotate(180deg) translate(0, -130%);
60
- -webkit-animation-delay: -0.5s;
61
- }
62
- div.spinner div.bar8 {
63
- -webkit-transform: rotate(210deg) translate(0, -130%);
64
- -webkit-animation-delay: -0.4167s;
65
- }
66
- div.spinner div.bar9 {
67
- -webkit-transform: rotate(240deg) translate(0, -130%);
68
- -webkit-animation-delay: -0.333s;
69
- }
70
- div.spinner div.bar10 {
71
- -webkit-transform: rotate(270deg) translate(0, -130%);
72
- -webkit-animation-delay: -0.2497s;
73
- }
74
- div.spinner div.bar11 {
75
- -webkit-transform: rotate(300deg) translate(0, -130%);
76
- -webkit-animation-delay: -0.167s;
77
- }
78
- div.spinner div.bar12 {
79
- -webkit-transform: rotate(330deg) translate(0, -130%);
80
- -webkit-animation-delay: -0.0833s;
81
- }