@applicaster/zapp-react-dom-app 13.0.0-alpha.8532113155 → 13.0.0-alpha.9103242840

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,16 +140,13 @@ 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
-
146
143
  this.confirmDialog.setConfirmAction(this.performExit);
147
144
  this.confirmDialog.setCancelAction(this.onConfirmDialogClose);
148
145
  this.longPressDetector = new KeyboardLongPressManager();
149
146
  }
150
147
 
151
148
  componentDidMount() {
152
- window.addEventListener("keydown", this.onKeyDownListener, true);
149
+ window.addEventListener("keydown", this.onKeyDownListener);
153
150
  window.addEventListener("keyup", this.onKeyUp);
154
151
  window.addEventListener("mousemove", this.onMouseMoveListener);
155
152
 
@@ -184,11 +181,6 @@ class InteractionManagerClass extends React.Component<Props, State> {
184
181
  "onLongPressRelease",
185
182
  this.handleLongPressRelease.bind(this)
186
183
  );
187
-
188
- document.addEventListener(
189
- "keyboardDismissedByPhysicalKeypress",
190
- this.handlePhysicalKeyboardDismiss
191
- );
192
184
  }
193
185
 
194
186
  componentWillUnmount() {
@@ -217,11 +209,6 @@ class InteractionManagerClass extends React.Component<Props, State> {
217
209
  "onLongPressRelease",
218
210
  this.handleLongPressRelease
219
211
  );
220
-
221
- document.removeEventListener(
222
- "keyboardDismissedByPhysicalKeypress",
223
- this.handlePhysicalKeyboardDismiss
224
- );
225
212
  }
226
213
 
227
214
  performExit() {
@@ -399,7 +386,7 @@ class InteractionManagerClass extends React.Component<Props, State> {
399
386
  this.longPressDetector.monitorKeyPress(event.code, event);
400
387
  }
401
388
 
402
- // Only handle repeat events for arrow keys
389
+ // None of the logic below should be executed for repeated keys
403
390
  if (event.repeat && !keyCode(event).matchesAny(...ARROW_KEYS)) return;
404
391
 
405
392
  /**
@@ -461,13 +448,20 @@ class InteractionManagerClass extends React.Component<Props, State> {
461
448
  }
462
449
 
463
450
  /**
464
- When pressing escape or the Native "Back" button:
451
+ When pressing backspace or the Native "Back" button:
465
452
  if on the transport controls: we show the player
466
453
  if on the player : we show the UI
467
454
  if on the UI : we exit the app
468
- note: backspace affects the keyboard input, so it not handled here
469
455
  */
470
- if (keyCode(event).matchesAny(KEYS.Back, KEYS.Escape, KEYS.EscapeDevice)) {
456
+
457
+ if (
458
+ keyCode(event).matchesAny(
459
+ KEYS.Back,
460
+ KEYS.Escape,
461
+ KEYS.EscapeDevice,
462
+ KEYS.Backspace
463
+ )
464
+ ) {
471
465
  switch (displayState) {
472
466
  case DISPLAY_STATES.DEFAULT:
473
467
  case DISPLAY_STATES.PLAYER:
@@ -516,7 +510,6 @@ class InteractionManagerClass extends React.Component<Props, State> {
516
510
  if (displayState === DISPLAY_STATES.PLAYER) {
517
511
  setDisplayState(DISPLAY_STATES.HUD);
518
512
  } else {
519
- focusManager.pressIn();
520
513
  focusManager.press();
521
514
  }
522
515
 
@@ -549,6 +542,12 @@ class InteractionManagerClass extends React.Component<Props, State> {
549
542
  focusManager.moveFocus(direction);
550
543
  }
551
544
 
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
+
552
551
  if (
553
552
  displayState === DISPLAY_STATES.PLAYER ||
554
553
  displayState === DISPLAY_STATES.HUD
@@ -653,7 +652,7 @@ class InteractionManagerClass extends React.Component<Props, State> {
653
652
  }
654
653
  }
655
654
 
656
- handleKeyboardDismiss() {
655
+ handleKeyboardDismiss = () => {
657
656
  this.isDismissing = true;
658
657
 
659
658
  this.setState(
@@ -664,10 +663,9 @@ class InteractionManagerClass extends React.Component<Props, State> {
664
663
  },
665
664
  () => {
666
665
  this.isDismissing = false;
667
- focusManager.recoverFocus();
668
666
  }
669
667
  );
670
- }
668
+ };
671
669
 
672
670
  handleKeyboardInput = (value: string) => {
673
671
  const { activeInputRef } = this.state;
@@ -763,35 +761,6 @@ class InteractionManagerClass extends React.Component<Props, State> {
763
761
  ].includes(event.code);
764
762
  }
765
763
 
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
-
795
764
  render() {
796
765
  return (
797
766
  (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() {
@@ -0,0 +1,17 @@
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
+ };
@@ -0,0 +1,30 @@
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
+ };
@@ -0,0 +1,81 @@
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
+ }
package/index.js CHANGED
@@ -1,11 +1,13 @@
1
1
  /// <reference types="@applicaster/applicaster-types" />
2
2
  import * as R from "ramda";
3
+ import { useHistory, useLocation } from "react-router-dom";
3
4
 
4
5
  import { createQuickBrickApp } from "@applicaster/quick-brick-core";
5
6
  import * as QuickBrickManager from "@applicaster/zapp-react-native-bridge/QuickBrick";
6
7
  import * as Contexts from "@applicaster/zapp-react-native-ui-components/Contexts";
7
8
  import { OfflineHandler } from "@applicaster/zapp-react-native-ui-components/Components/OfflineHandler";
8
9
  import { getXray } from "@applicaster/zapp-react-native-utils/logger";
10
+ import { ZappDomRouter } from "./App/Router";
9
11
  import { Layout } from "./App/Layout";
10
12
  import { SplashLoader } from "./App/Loader/SplashLoader";
11
13
  import { appLoader } from "./App/Loader";
@@ -22,6 +24,11 @@ const contextProviders = R.map(R.prop("withProvider"), R.values(Contexts));
22
24
  if (withXray) contextProviders.push(withXray);
23
25
 
24
26
  export const ZappApp = createQuickBrickApp({
27
+ navigations: {
28
+ Router: ZappDomRouter,
29
+ useLocation,
30
+ useHistory,
31
+ },
25
32
  QuickBrickManager,
26
33
  Layout,
27
34
  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.8532113155",
3
+ "version": "13.0.0-alpha.9103242840",
4
4
  "description": "Zapp App Component for Applicaster's Quick Brick React Native App",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -22,12 +22,13 @@
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.8532113155",
26
- "@applicaster/zapp-react-native-bridge": "13.0.0-alpha.8532113155",
27
- "@applicaster/zapp-react-native-redux": "13.0.0-alpha.8532113155",
28
- "@applicaster/zapp-react-native-ui-components": "13.0.0-alpha.8532113155",
29
- "@applicaster/zapp-react-native-utils": "13.0.0-alpha.8532113155",
25
+ "@applicaster/zapp-react-dom-ui-components": "13.0.0-alpha.9103242840",
26
+ "@applicaster/zapp-react-native-bridge": "13.0.0-alpha.9103242840",
27
+ "@applicaster/zapp-react-native-redux": "13.0.0-alpha.9103242840",
28
+ "@applicaster/zapp-react-native-ui-components": "13.0.0-alpha.9103242840",
29
+ "@applicaster/zapp-react-native-utils": "13.0.0-alpha.9103242840",
30
30
  "abortcontroller-polyfill": "^1.7.5",
31
+ "history": "^4.7.2",
31
32
  "react-router-dom": "^5.1.2",
32
33
  "typeface-montserrat": "^0.0.54",
33
34
  "video.js": "7.14.3",