react-native-unit-components 0.1.0 → 1.0.0
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.
- package/README.md +157 -2
- package/lib/commonjs/assets/images/close.png +0 -0
- package/lib/commonjs/assets/images/index.js +16 -0
- package/lib/commonjs/assets/images/index.js.map +1 -0
- package/lib/commonjs/components/UNActivityComponent/UNActivityComponent.js +28 -0
- package/lib/commonjs/components/UNActivityComponent/UNActivityComponent.js.map +1 -0
- package/lib/commonjs/components/UNActivityComponent/UNActivityComponent.utils.js +20 -0
- package/lib/commonjs/components/UNActivityComponent/UNActivityComponent.utils.js.map +1 -0
- package/lib/commonjs/components/UNBookPaymentComponent/UNBookPaymentComponent.js +39 -0
- package/lib/commonjs/components/UNBookPaymentComponent/UNBookPaymentComponent.js.map +1 -0
- package/lib/commonjs/components/UNBookPaymentComponent/UNBookPaymentComponent.utils.js +40 -0
- package/lib/commonjs/components/UNBookPaymentComponent/UNBookPaymentComponent.utils.js.map +1 -0
- package/lib/commonjs/components/UNBottomSheetComponent/UNBottomSheetComponent.constants.js +9 -0
- package/lib/commonjs/components/UNBottomSheetComponent/UNBottomSheetComponent.constants.js.map +1 -0
- package/lib/commonjs/components/{BottomSheet/BottomSheetComponent.js → UNBottomSheetComponent/UNBottomSheetComponent.js} +84 -65
- package/lib/commonjs/components/UNBottomSheetComponent/UNBottomSheetComponent.js.map +1 -0
- package/lib/commonjs/components/UNBottomSheetComponent/UNBottomSheetComponent.styles.js +23 -0
- package/lib/commonjs/components/UNBottomSheetComponent/UNBottomSheetComponent.styles.js.map +1 -0
- package/lib/commonjs/components/UNBottomSheetComponent/UNBottomSheetComponent.utils.js +49 -0
- package/lib/commonjs/components/UNBottomSheetComponent/UNBottomSheetComponent.utils.js.map +1 -0
- package/lib/commonjs/components/{Card/CardComponent.js → UNCardComponent/UNCardComponent.js} +42 -46
- package/lib/commonjs/components/UNCardComponent/UNCardComponent.js.map +1 -0
- package/lib/commonjs/components/UNCardComponent/UNCardComponent.utils.js +42 -0
- package/lib/commonjs/components/UNCardComponent/UNCardComponent.utils.js.map +1 -0
- package/lib/commonjs/components/index.js +34 -8
- package/lib/commonjs/components/index.js.map +1 -1
- package/lib/commonjs/custom.d.js +2 -0
- package/lib/commonjs/custom.d.js.map +1 -0
- package/lib/commonjs/helpers/{BottomSheet.js → BottomSheet/BottomSheet.js} +36 -82
- package/lib/commonjs/helpers/BottomSheet/BottomSheet.js.map +1 -0
- package/lib/commonjs/helpers/BottomSheet/BottomSheet.styles.js +82 -0
- package/lib/commonjs/helpers/BottomSheet/BottomSheet.styles.js.map +1 -0
- package/lib/commonjs/helpers/EventBus.js +5 -13
- package/lib/commonjs/helpers/EventBus.js.map +1 -1
- package/lib/commonjs/hooks/listenerToBus.js +31 -0
- package/lib/commonjs/hooks/listenerToBus.js.map +1 -0
- package/lib/commonjs/hooks/useAppStateListener.js +34 -0
- package/lib/commonjs/hooks/useAppStateListener.js.map +1 -0
- package/lib/commonjs/index.js +33 -0
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/messages/nativeMessages/index.js +13 -0
- package/lib/commonjs/messages/nativeMessages/index.js.map +1 -0
- package/lib/commonjs/messages/webMessages/bookPaymentMessage.js +13 -0
- package/lib/commonjs/messages/webMessages/bookPaymentMessage.js.map +1 -0
- package/lib/commonjs/{webComponent → messages}/webMessages/cardMessage.js +1 -1
- package/lib/commonjs/messages/webMessages/cardMessage.js.map +1 -0
- package/lib/commonjs/messages/webMessages/index.js +6 -0
- package/lib/commonjs/messages/webMessages/index.js.map +1 -0
- package/lib/commonjs/{webComponent → messages}/webMessages/pageMessage.js +0 -0
- package/lib/commonjs/{webComponent → messages}/webMessages/pageMessage.js.map +0 -0
- package/lib/commonjs/{webComponent → messages}/webMessages/unitMessages.js +0 -0
- package/lib/commonjs/messages/webMessages/unitMessages.js.map +1 -0
- package/lib/commonjs/nativeComponenet/NativeComponentExample.js +2 -2
- package/lib/commonjs/nativeComponenet/NativeComponentExample.js.map +1 -1
- package/lib/commonjs/scripts/html/bodyHtml.js +52 -0
- package/lib/commonjs/scripts/html/bodyHtml.js.map +1 -0
- package/lib/commonjs/scripts/html/bodyScript.js +78 -0
- package/lib/commonjs/scripts/html/bodyScript.js.map +1 -0
- package/lib/commonjs/sharedTypes/bookPayment.types.js +6 -0
- package/lib/commonjs/sharedTypes/bookPayment.types.js.map +1 -0
- package/lib/commonjs/sharedTypes/card.types.js +6 -0
- package/lib/commonjs/sharedTypes/card.types.js.map +1 -0
- package/lib/commonjs/sharedTypes/index.js +32 -0
- package/lib/commonjs/sharedTypes/index.js.map +1 -0
- package/lib/commonjs/sharedTypes/types.js +2 -0
- package/lib/commonjs/sharedTypes/types.js.map +1 -0
- package/lib/commonjs/styles/variables.js +17 -0
- package/lib/commonjs/styles/variables.js.map +1 -0
- package/lib/commonjs/unitSdkManager/UnitSdk.api.js +54 -0
- package/lib/commonjs/unitSdkManager/UnitSdk.api.js.map +1 -0
- package/lib/commonjs/unitSdkManager/UnitSdkManager.js +51 -0
- package/lib/commonjs/unitSdkManager/UnitSdkManager.js.map +1 -0
- package/lib/commonjs/webComponent/WebComponent.js +35 -15
- package/lib/commonjs/webComponent/WebComponent.js.map +1 -1
- package/lib/commonjs/webComponent/html.js +22 -45
- package/lib/commonjs/webComponent/html.js.map +1 -1
- package/lib/module/assets/images/close.png +0 -0
- package/lib/module/assets/images/index.js +2 -0
- package/lib/module/assets/images/index.js.map +1 -0
- package/lib/module/components/UNActivityComponent/UNActivityComponent.js +13 -0
- package/lib/module/components/UNActivityComponent/UNActivityComponent.js.map +1 -0
- package/lib/module/components/UNActivityComponent/UNActivityComponent.utils.js +10 -0
- package/lib/module/components/UNActivityComponent/UNActivityComponent.utils.js.map +1 -0
- package/lib/module/components/UNBookPaymentComponent/UNBookPaymentComponent.js +23 -0
- package/lib/module/components/UNBookPaymentComponent/UNBookPaymentComponent.js.map +1 -0
- package/lib/module/components/UNBookPaymentComponent/UNBookPaymentComponent.utils.js +26 -0
- package/lib/module/components/UNBookPaymentComponent/UNBookPaymentComponent.utils.js.map +1 -0
- package/lib/module/components/UNBottomSheetComponent/UNBottomSheetComponent.constants.js +2 -0
- package/lib/module/components/UNBottomSheetComponent/UNBottomSheetComponent.constants.js.map +1 -0
- package/lib/module/components/UNBottomSheetComponent/UNBottomSheetComponent.js +131 -0
- package/lib/module/components/UNBottomSheetComponent/UNBottomSheetComponent.js.map +1 -0
- package/lib/module/components/UNBottomSheetComponent/UNBottomSheetComponent.styles.js +13 -0
- package/lib/module/components/UNBottomSheetComponent/UNBottomSheetComponent.styles.js.map +1 -0
- package/lib/module/components/UNBottomSheetComponent/UNBottomSheetComponent.utils.js +29 -0
- package/lib/module/components/UNBottomSheetComponent/UNBottomSheetComponent.utils.js.map +1 -0
- package/lib/module/components/UNCardComponent/UNCardComponent.js +65 -0
- package/lib/module/components/UNCardComponent/UNCardComponent.js.map +1 -0
- package/lib/module/components/UNCardComponent/UNCardComponent.utils.js +24 -0
- package/lib/module/components/UNCardComponent/UNCardComponent.utils.js.map +1 -0
- package/lib/module/components/index.js +4 -2
- package/lib/module/components/index.js.map +1 -1
- package/lib/module/custom.d.js +2 -0
- package/lib/module/custom.d.js.map +1 -0
- package/lib/module/helpers/{BottomSheet.js → BottomSheet/BottomSheet.js} +34 -81
- package/lib/module/helpers/BottomSheet/BottomSheet.js.map +1 -0
- package/lib/module/helpers/BottomSheet/BottomSheet.styles.js +70 -0
- package/lib/module/helpers/BottomSheet/BottomSheet.styles.js.map +1 -0
- package/lib/module/helpers/EventBus.js +4 -11
- package/lib/module/helpers/EventBus.js.map +1 -1
- package/lib/module/hooks/listenerToBus.js +18 -0
- package/lib/module/hooks/listenerToBus.js.map +1 -0
- package/lib/module/hooks/useAppStateListener.js +23 -0
- package/lib/module/hooks/useAppStateListener.js.map +1 -0
- package/lib/module/index.js +2 -0
- package/lib/module/index.js.map +1 -1
- package/lib/module/messages/nativeMessages/index.js +6 -0
- package/lib/module/messages/nativeMessages/index.js.map +1 -0
- package/lib/module/messages/webMessages/bookPaymentMessage.js +6 -0
- package/lib/module/messages/webMessages/bookPaymentMessage.js.map +1 -0
- package/lib/module/messages/webMessages/cardMessage.js +6 -0
- package/lib/module/messages/webMessages/cardMessage.js.map +1 -0
- package/lib/module/messages/webMessages/index.js +2 -0
- package/lib/module/messages/webMessages/index.js.map +1 -0
- package/lib/module/{webComponent → messages}/webMessages/pageMessage.js +0 -0
- package/lib/module/{webComponent → messages}/webMessages/pageMessage.js.map +0 -0
- package/lib/module/{webComponent → messages}/webMessages/unitMessages.js +0 -0
- package/lib/module/messages/webMessages/unitMessages.js.map +1 -0
- package/lib/module/nativeComponenet/NativeComponentExample.js +2 -2
- package/lib/module/nativeComponenet/NativeComponentExample.js.map +1 -1
- package/lib/module/scripts/html/bodyHtml.js +42 -0
- package/lib/module/scripts/html/bodyHtml.js.map +1 -0
- package/lib/module/scripts/html/bodyScript.js +64 -0
- package/lib/module/scripts/html/bodyScript.js.map +1 -0
- package/lib/module/sharedTypes/bookPayment.types.js +2 -0
- package/lib/module/sharedTypes/bookPayment.types.js.map +1 -0
- package/lib/module/sharedTypes/card.types.js +2 -0
- package/lib/module/sharedTypes/card.types.js.map +1 -0
- package/lib/module/sharedTypes/index.js +3 -0
- package/lib/module/sharedTypes/index.js.map +1 -0
- package/lib/module/sharedTypes/types.js +2 -0
- package/lib/module/sharedTypes/types.js.map +1 -0
- package/lib/module/styles/variables.js +10 -0
- package/lib/module/styles/variables.js.map +1 -0
- package/lib/module/unitSdkManager/UnitSdk.api.js +37 -0
- package/lib/module/unitSdkManager/UnitSdk.api.js.map +1 -0
- package/lib/module/unitSdkManager/UnitSdkManager.js +38 -0
- package/lib/module/unitSdkManager/UnitSdkManager.js.map +1 -0
- package/lib/module/webComponent/WebComponent.js +34 -14
- package/lib/module/webComponent/WebComponent.js.map +1 -1
- package/lib/module/webComponent/html.js +18 -44
- package/lib/module/webComponent/html.js.map +1 -1
- package/lib/typescript/assets/images/index.d.ts +1 -0
- package/lib/typescript/components/UNActivityComponent/UNActivityComponent.d.ts +6 -0
- package/lib/typescript/components/UNActivityComponent/UNActivityComponent.utils.d.ts +2 -0
- package/lib/typescript/components/UNBookPaymentComponent/UNBookPaymentComponent.d.ts +11 -0
- package/lib/typescript/components/UNBookPaymentComponent/UNBookPaymentComponent.utils.d.ts +3 -0
- package/lib/typescript/components/UNBottomSheetComponent/UNBottomSheetComponent.constants.d.ts +1 -0
- package/lib/typescript/components/{BottomSheet/BottomSheetComponent.d.ts → UNBottomSheetComponent/UNBottomSheetComponent.d.ts} +0 -0
- package/lib/typescript/components/UNBottomSheetComponent/UNBottomSheetComponent.styles.d.ts +9 -0
- package/lib/typescript/components/UNBottomSheetComponent/UNBottomSheetComponent.utils.d.ts +5 -0
- package/lib/typescript/components/{Card/CardComponent.d.ts → UNCardComponent/UNCardComponent.d.ts} +3 -1
- package/lib/typescript/components/UNCardComponent/UNCardComponent.utils.d.ts +6 -0
- package/lib/typescript/components/index.d.ts +4 -2
- package/lib/typescript/helpers/{BottomSheet.d.ts → BottomSheet/BottomSheet.d.ts} +1 -0
- package/lib/typescript/helpers/BottomSheet/BottomSheet.styles.d.ts +63 -0
- package/lib/typescript/helpers/EventBus.d.ts +5 -7
- package/lib/typescript/hooks/listenerToBus.d.ts +7 -0
- package/lib/typescript/hooks/useAppStateListener.d.ts +1 -0
- package/lib/typescript/index.d.ts +2 -0
- package/lib/typescript/messages/nativeMessages/index.d.ts +3 -0
- package/lib/typescript/messages/webMessages/bookPaymentMessage.d.ts +8 -0
- package/lib/typescript/{webComponent → messages}/webMessages/cardMessage.d.ts +3 -2
- package/lib/typescript/messages/webMessages/index.d.ts +11 -0
- package/lib/typescript/{webComponent → messages}/webMessages/pageMessage.d.ts +0 -0
- package/lib/typescript/{webComponent → messages}/webMessages/unitMessages.d.ts +0 -0
- package/lib/typescript/scripts/html/bodyHtml.d.ts +7 -0
- package/lib/typescript/scripts/html/bodyScript.d.ts +11 -0
- package/lib/typescript/sharedTypes/bookPayment.types.d.ts +26 -0
- package/lib/typescript/sharedTypes/card.types.d.ts +56 -0
- package/lib/typescript/sharedTypes/index.d.ts +2 -0
- package/lib/typescript/sharedTypes/types.d.ts +27 -0
- package/lib/typescript/styles/variables.d.ts +9 -0
- package/lib/typescript/unitSdkManager/UnitSdk.api.d.ts +3 -0
- package/lib/typescript/unitSdkManager/UnitSdkManager.d.ts +15 -0
- package/lib/typescript/webComponent/WebComponent.d.ts +8 -11
- package/lib/typescript/webComponent/html.d.ts +6 -1
- package/package.json +9 -5
- package/{unit-react-native-components.podspec → react-native-unit-components.podspec} +1 -1
- package/src/assets/images/close.png +0 -0
- package/src/assets/images/index.ts +1 -0
- package/src/components/UNActivityComponent/UNActivityComponent.tsx +21 -0
- package/src/components/UNActivityComponent/UNActivityComponent.utils.ts +11 -0
- package/src/components/UNBookPaymentComponent/UNBookPaymentComponent.tsx +37 -0
- package/src/components/UNBookPaymentComponent/UNBookPaymentComponent.utils.ts +29 -0
- package/src/components/UNBottomSheetComponent/UNBottomSheetComponent.constants.ts +1 -0
- package/src/components/UNBottomSheetComponent/UNBottomSheetComponent.styles.ts +13 -0
- package/src/components/UNBottomSheetComponent/UNBottomSheetComponent.tsx +136 -0
- package/src/components/UNBottomSheetComponent/UNBottomSheetComponent.utils.ts +34 -0
- package/src/components/UNCardComponent/UNCardComponent.tsx +73 -0
- package/src/components/UNCardComponent/UNCardComponent.utils.ts +28 -0
- package/src/components/index.ts +4 -2
- package/src/custom.d.ts +5 -0
- package/src/helpers/BottomSheet/BottomSheet.styles.ts +70 -0
- package/src/helpers/{BottomSheet.tsx → BottomSheet/BottomSheet.tsx} +72 -110
- package/src/helpers/EventBus.ts +13 -13
- package/src/hooks/listenerToBus.ts +23 -0
- package/src/hooks/useAppStateListener.ts +25 -0
- package/src/index.tsx +5 -1
- package/src/messages/nativeMessages/index.ts +3 -0
- package/src/messages/webMessages/bookPaymentMessage.ts +12 -0
- package/src/{webComponent → messages}/webMessages/cardMessage.ts +4 -2
- package/src/messages/webMessages/index.ts +21 -0
- package/src/{webComponent → messages}/webMessages/pageMessage.ts +0 -0
- package/src/{webComponent → messages}/webMessages/unitMessages.ts +1 -0
- package/src/nativeComponenet/NativeComponentExample.tsx +2 -2
- package/src/scripts/html/bodyHtml.ts +46 -0
- package/src/scripts/html/bodyScript.ts +67 -0
- package/src/sharedTypes/bookPayment.types.ts +27 -0
- package/src/sharedTypes/card.types.ts +59 -0
- package/src/sharedTypes/index.ts +2 -0
- package/src/sharedTypes/types.ts +35 -0
- package/src/styles/variables.ts +9 -0
- package/src/unitSdkManager/UnitSdk.api.ts +31 -0
- package/src/unitSdkManager/UnitSdkManager.ts +33 -0
- package/src/webComponent/WebComponent.tsx +43 -45
- package/src/webComponent/html.ts +22 -46
- package/lib/commonjs/components/BottomSheet/BottomSheetComponent.js.map +0 -1
- package/lib/commonjs/components/Card/CardComponent.js.map +0 -1
- package/lib/commonjs/helpers/BottomSheet.js.map +0 -1
- package/lib/commonjs/webComponent/webMessages/cardMessage.js.map +0 -1
- package/lib/commonjs/webComponent/webMessages/unitMessages.js.map +0 -1
- package/lib/module/components/BottomSheet/BottomSheetComponent.js +0 -118
- package/lib/module/components/BottomSheet/BottomSheetComponent.js.map +0 -1
- package/lib/module/components/Card/CardComponent.js +0 -75
- package/lib/module/components/Card/CardComponent.js.map +0 -1
- package/lib/module/helpers/BottomSheet.js.map +0 -1
- package/lib/module/webComponent/webMessages/cardMessage.js +0 -6
- package/lib/module/webComponent/webMessages/cardMessage.js.map +0 -1
- package/lib/module/webComponent/webMessages/unitMessages.js.map +0 -1
- package/src/components/BottomSheet/BottomSheetComponent.tsx +0 -113
- package/src/components/Card/CardComponent.tsx +0 -75
package/src/helpers/EventBus.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
2
|
+
import type { NativeMessage } from '../messages/nativeMessages';
|
|
3
|
+
import type { WebViewMessageType } from '../messages/webMessages';
|
|
4
|
+
|
|
5
|
+
export type BusEventKey = NativeMessage | WebViewMessageType
|
|
6
6
|
|
|
7
7
|
export default class EventBus {
|
|
8
8
|
private static _instance: EventBus;
|
|
9
9
|
|
|
10
|
-
private eventListeners: { [name: string]: Array<(data: any) => void> } = {}
|
|
10
|
+
private eventListeners: { [name: string]: Array<(data: any) => void> } = {};
|
|
11
11
|
|
|
12
12
|
private constructor() {
|
|
13
13
|
this.eventListeners = {};
|
|
@@ -17,19 +17,19 @@ export default class EventBus {
|
|
|
17
17
|
return this._instance || (this._instance = new this());
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
-
public event(event:
|
|
21
|
-
|
|
20
|
+
public event(event: BusEventKey, data: any) {
|
|
21
|
+
const listeners = this.eventListeners[event.valueOf()];
|
|
22
22
|
if (Array.isArray(listeners)) {
|
|
23
23
|
listeners.map(listener => {
|
|
24
24
|
if (typeof listener === 'function') {
|
|
25
25
|
listener(data);
|
|
26
26
|
}
|
|
27
|
-
})
|
|
27
|
+
});
|
|
28
28
|
}
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
-
public addListener(event:
|
|
32
|
-
|
|
31
|
+
public addListener(event: BusEventKey, listener: (data: any) => void) {
|
|
32
|
+
const listeners = this.eventListeners[event.valueOf()];
|
|
33
33
|
if (Array.isArray(listeners)) {
|
|
34
34
|
listeners.push(listener);
|
|
35
35
|
} else {
|
|
@@ -39,14 +39,14 @@ export default class EventBus {
|
|
|
39
39
|
|
|
40
40
|
public removeListener(listener: (data: any) => void) {
|
|
41
41
|
Object.keys(this.eventListeners).map(eventName => {
|
|
42
|
-
|
|
42
|
+
const listeners = this.eventListeners[eventName];
|
|
43
43
|
if (listeners) {
|
|
44
44
|
this._remove(listeners, listener);
|
|
45
45
|
if (listeners.length === 0) {
|
|
46
46
|
delete this.eventListeners[eventName];
|
|
47
47
|
}
|
|
48
48
|
}
|
|
49
|
-
})
|
|
49
|
+
});
|
|
50
50
|
}
|
|
51
51
|
|
|
52
52
|
private _remove(array: Array<(data: any) => void>, item: (data: string) => void) {
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
2
|
+
import { useEffect } from 'react';
|
|
3
|
+
import EventBus, { BusEventKey } from '../helpers/EventBus';
|
|
4
|
+
|
|
5
|
+
type Listener = {
|
|
6
|
+
busEventKey: BusEventKey,
|
|
7
|
+
action: (data: any) => void
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export const useListenerToBus = (listeners: Listener[]) => {
|
|
11
|
+
useEffect(() => {
|
|
12
|
+
{
|
|
13
|
+
listeners.map((listener: {busEventKey: BusEventKey, action: (data: any) => void}) => {
|
|
14
|
+
EventBus.Instance.addListener(listener.busEventKey, listener.action);
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
return (() => {
|
|
18
|
+
listeners.map((listener: {busEventKey: BusEventKey, action: (data: any) => void}) => {
|
|
19
|
+
EventBus.Instance.removeListener(listener.action);
|
|
20
|
+
});
|
|
21
|
+
});
|
|
22
|
+
}, []);
|
|
23
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
2
|
+
import { useEffect, useRef, useState } from 'react';
|
|
3
|
+
import { AppState, AppStateStatus } from 'react-native';
|
|
4
|
+
|
|
5
|
+
const getIsAppActive = (currentAppState: AppStateStatus) => {
|
|
6
|
+
return currentAppState !== 'background' && currentAppState !== 'inactive';
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
export const useAppStateListener = () => {
|
|
10
|
+
const appState = useRef(AppState.currentState);
|
|
11
|
+
const [isAppActive, setIsAppActive] = useState<boolean>(getIsAppActive(appState.current));
|
|
12
|
+
|
|
13
|
+
useEffect(() => {
|
|
14
|
+
const subscription = AppState.addEventListener('change', nextAppState => {
|
|
15
|
+
appState.current = nextAppState;
|
|
16
|
+
setIsAppActive(getIsAppActive(appState.current));
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
return () => {
|
|
20
|
+
subscription.remove();
|
|
21
|
+
};
|
|
22
|
+
}, []);
|
|
23
|
+
|
|
24
|
+
return isAppActive;
|
|
25
|
+
};
|
package/src/index.tsx
CHANGED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { UNBookPaymentData } from '../../sharedTypes';
|
|
2
|
+
|
|
3
|
+
export enum BookPaymentMessage {
|
|
4
|
+
PAYMENT_CREATED = 'unitPaymentCreated'
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export interface PaymentCreatedEvent {
|
|
8
|
+
data: UNBookPaymentData
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export type BookPaymentEvent =
|
|
12
|
+
| PaymentCreatedEvent
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
+
import type { UNCardData } from '../../sharedTypes';
|
|
2
|
+
|
|
1
3
|
export enum CardMessage {
|
|
2
|
-
|
|
4
|
+
CARD_STATUS_CHANGED = 'unitCardStatusChanged'
|
|
3
5
|
}
|
|
4
6
|
|
|
5
7
|
export interface CardStatusChangedEvent {
|
|
6
|
-
card:
|
|
8
|
+
card: UNCardData;
|
|
7
9
|
}
|
|
8
10
|
|
|
9
11
|
export type CardEvent =
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { BookPaymentEvent, BookPaymentMessage } from './bookPaymentMessage';
|
|
2
|
+
import type { CardEvent, CardMessage } from './cardMessage';
|
|
3
|
+
import type { PageEvent, PageMessage } from './pageMessage';
|
|
4
|
+
import type { UnitEvent, UnitMessage } from './unitMessages';
|
|
5
|
+
|
|
6
|
+
export type WebViewMessageType =
|
|
7
|
+
| PageMessage
|
|
8
|
+
| CardMessage
|
|
9
|
+
| UnitMessage
|
|
10
|
+
| BookPaymentMessage
|
|
11
|
+
|
|
12
|
+
type WebViewEvent =
|
|
13
|
+
| PageEvent
|
|
14
|
+
| UnitEvent
|
|
15
|
+
| CardEvent
|
|
16
|
+
| BookPaymentEvent
|
|
17
|
+
|
|
18
|
+
export interface WebViewMessage {
|
|
19
|
+
type: WebViewMessageType,
|
|
20
|
+
details?: WebViewEvent
|
|
21
|
+
}
|
|
File without changes
|
|
@@ -6,8 +6,8 @@ import {
|
|
|
6
6
|
} from 'react-native';
|
|
7
7
|
|
|
8
8
|
const LINKING_ERROR =
|
|
9
|
-
|
|
10
|
-
Platform.select({ ios:
|
|
9
|
+
'The package \'react-native-unit-components\' doesn\'t seem to be linked. Make sure: \n\n' +
|
|
10
|
+
Platform.select({ ios: '- You have run \'pod install\'\n', default: '' }) +
|
|
11
11
|
'- You rebuilt the app after installing the package\n' +
|
|
12
12
|
'- You are not using Expo managed workflow\n';
|
|
13
13
|
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
export const webViewId = 'webViewContainer';
|
|
2
|
+
|
|
3
|
+
export enum PresentationMode {
|
|
4
|
+
/*
|
|
5
|
+
CoverInjectedHeight - give id (<webViewId> param) to enable style injection to the root. Then cover the injected height.
|
|
6
|
+
|
|
7
|
+
Inherit - inherit the parent size by style of 100 view height
|
|
8
|
+
|
|
9
|
+
Default - return the unit component script
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
CoverInjectedHeight = 'coverInjectedHeight',
|
|
13
|
+
Inherit = 'inherit',
|
|
14
|
+
Default = 'deafult'
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export const getHtmlBody = (unitComponent: string, unitComponentProps?: string, presentationMode?: PresentationMode) => {
|
|
18
|
+
const currentComponent = `<${unitComponent} ${unitComponentProps || ''}> </${unitComponent}>`;
|
|
19
|
+
|
|
20
|
+
switch (presentationMode) {
|
|
21
|
+
case PresentationMode.CoverInjectedHeight:
|
|
22
|
+
return getCoverInjectedHeightBodyScript(currentComponent);
|
|
23
|
+
case PresentationMode.Inherit:
|
|
24
|
+
return getInheritParentSizeScript(currentComponent);
|
|
25
|
+
default:
|
|
26
|
+
return currentComponent;
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
const getCoverInjectedHeightBodyScript = (currentUnitScript: string) => {
|
|
31
|
+
return `
|
|
32
|
+
<div id=${webViewId}>
|
|
33
|
+
<div style="height: 100%; display: block; padding: 1px;">
|
|
34
|
+
${currentUnitScript}
|
|
35
|
+
</div>
|
|
36
|
+
</div>
|
|
37
|
+
`;
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
const getInheritParentSizeScript = (currentUnitScript: string) => {
|
|
41
|
+
return `
|
|
42
|
+
<div style="height: 100vh">
|
|
43
|
+
${currentUnitScript}
|
|
44
|
+
</div>
|
|
45
|
+
`;
|
|
46
|
+
};
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { CardMessage } from '../../messages/webMessages/cardMessage';
|
|
2
|
+
import { PageMessage } from '../../messages/webMessages/pageMessage';
|
|
3
|
+
import { UnitMessage } from '../../messages/webMessages/unitMessages';
|
|
4
|
+
|
|
5
|
+
export const POST_MESSAGE_TO_SDK = `
|
|
6
|
+
const postMessageToSDK = (message) => {
|
|
7
|
+
if ('ReactNativeWebView' in window) {
|
|
8
|
+
const messageString = JSON.stringify(message)
|
|
9
|
+
window['ReactNativeWebView'].postMessage(messageString)
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
`;
|
|
13
|
+
|
|
14
|
+
export const POST_PAGE_HEIGHT = `
|
|
15
|
+
const postHeight = () => {
|
|
16
|
+
setTimeout(() => {
|
|
17
|
+
const height = window.document.documentElement.getBoundingClientRect().height
|
|
18
|
+
postMessageToSDK({ type: "${PageMessage.PAGE_HEIGHT}", details: { height } })
|
|
19
|
+
})
|
|
20
|
+
}
|
|
21
|
+
`;
|
|
22
|
+
|
|
23
|
+
export const LISTENERS = {
|
|
24
|
+
isPageLoaded:`
|
|
25
|
+
window.addEventListener('DOMContentLoaded', e => {
|
|
26
|
+
postMessageToSDK({ type: "${PageMessage.PAGE_LOADED}" })
|
|
27
|
+
});
|
|
28
|
+
`,
|
|
29
|
+
requestRendering: `
|
|
30
|
+
window.addEventListener("${UnitMessage.UNIT_REQUEST_RENDERING}", (e) => {
|
|
31
|
+
postMessageToSDK({ type: "${UnitMessage.UNIT_REQUEST_RENDERING}", details: { data: JSON.stringify(e.detail) }})
|
|
32
|
+
});
|
|
33
|
+
`,
|
|
34
|
+
onLoad: `
|
|
35
|
+
window.addEventListener("${UnitMessage.UNIT_ON_LOAD}", (e) => {
|
|
36
|
+
postHeight()
|
|
37
|
+
postMessageToSDK({ type: "${UnitMessage.UNIT_ON_LOAD}" })
|
|
38
|
+
});
|
|
39
|
+
`,
|
|
40
|
+
requestCloseFlow: `
|
|
41
|
+
window.addEventListener("${UnitMessage.UNIT_REQUEST_CLOSE_FLOW}", (e) => {
|
|
42
|
+
postMessageToSDK({ type: "${UnitMessage.UNIT_REQUEST_CLOSE_FLOW}" })
|
|
43
|
+
});
|
|
44
|
+
`,
|
|
45
|
+
requestOpenLink: `
|
|
46
|
+
window.addEventListener("${UnitMessage.UNIT_REQUEST_OPEN_LINK}", (e) => {
|
|
47
|
+
postMessageToSDK({ type: "${UnitMessage.UNIT_REQUEST_OPEN_LINK}", details: e.detail })
|
|
48
|
+
});
|
|
49
|
+
`,
|
|
50
|
+
cardStatusChange: `
|
|
51
|
+
window.addEventListener("${CardMessage.CARD_STATUS_CHANGED}", (e) => {
|
|
52
|
+
const response = e.detail
|
|
53
|
+
response.then((data) => {
|
|
54
|
+
postMessageToSDK({ type: "${CardMessage.CARD_STATUS_CHANGED}", details: { card: JSON.stringify(data.data) }})
|
|
55
|
+
}).catch((e) => {
|
|
56
|
+
console.log(e)
|
|
57
|
+
})
|
|
58
|
+
});
|
|
59
|
+
`
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
export const DISPTACH_RENDERING_EVENT = `
|
|
63
|
+
const dispatchRenderingEvent = (details) => {
|
|
64
|
+
const event = new CustomEvent("${UnitMessage.UNIT_REQUEST_RENDERING}",{ detail: JSON.parse(details) })
|
|
65
|
+
window.dispatchEvent(event)
|
|
66
|
+
}
|
|
67
|
+
`;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { Tags, Relationship } from "./types"
|
|
2
|
+
|
|
3
|
+
type BookPaymentStatus = "Sent" | "Rejected"
|
|
4
|
+
|
|
5
|
+
export type UNBookPaymentData = {
|
|
6
|
+
type: "bookPayment",
|
|
7
|
+
id: string,
|
|
8
|
+
attributes: {
|
|
9
|
+
createdAt: string | Date,
|
|
10
|
+
status: BookPaymentStatus,
|
|
11
|
+
reason: string,
|
|
12
|
+
direction: 'Debit' | 'Credit',
|
|
13
|
+
description: string,
|
|
14
|
+
transactionSummaryOverride?: string,
|
|
15
|
+
amount: string,
|
|
16
|
+
tags: Tags,
|
|
17
|
+
},
|
|
18
|
+
relationships: {
|
|
19
|
+
account: Relationship,
|
|
20
|
+
customer?: Relationship,
|
|
21
|
+
customers?: Relationship,
|
|
22
|
+
counterpartyAccount: Relationship,
|
|
23
|
+
counterpartyCustomer: Relationship,
|
|
24
|
+
transaction: Relationship,
|
|
25
|
+
recurringPayment: Relationship
|
|
26
|
+
}
|
|
27
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import type { Address, FullName, Limits, Relationship, Tags } from "./types"
|
|
2
|
+
|
|
3
|
+
export type UNCardData = IndividualDebitCard | BusinessDebitCard
|
|
4
|
+
|
|
5
|
+
type CardStatus = "Active" | "Inactive" | "Stolen" | "Lost" | "Frozen" | "ClosedByCustomer" | "SuspectedFraud"
|
|
6
|
+
|
|
7
|
+
type IndividualDebitCard = {
|
|
8
|
+
id: string,
|
|
9
|
+
type: "individualDebitCard" | "individualVirtualDebitCard",
|
|
10
|
+
attributes: {
|
|
11
|
+
createdAt: string,
|
|
12
|
+
last4Digits: string,
|
|
13
|
+
expirationDate: string,
|
|
14
|
+
status: CardStatus,
|
|
15
|
+
shippingAddress?: Address, /* not exists in virtual card */
|
|
16
|
+
updatedAt?: string,
|
|
17
|
+
design?: string,
|
|
18
|
+
additionalEmbossedText?: string,
|
|
19
|
+
idempotencyKey?: string,
|
|
20
|
+
tags?: Tags,
|
|
21
|
+
limits?: Limits,
|
|
22
|
+
printOnlyBusinessName?: boolean
|
|
23
|
+
},
|
|
24
|
+
relationships: {
|
|
25
|
+
account: Relationship,
|
|
26
|
+
customer: Relationship
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
type BusinessDebitCard = {
|
|
31
|
+
id: string,
|
|
32
|
+
type: "businessDebitCard" | "businessVirtualDebitCard",
|
|
33
|
+
attributes: {
|
|
34
|
+
fullName: FullName,
|
|
35
|
+
dateOfBirth: string,
|
|
36
|
+
address: Address,
|
|
37
|
+
shippingAddress?: Address,
|
|
38
|
+
phone: string,
|
|
39
|
+
email: string,
|
|
40
|
+
createdAt: string,
|
|
41
|
+
last4Digits: string,
|
|
42
|
+
expirationDate: string,
|
|
43
|
+
status: CardStatus,
|
|
44
|
+
updatedAt?: string,
|
|
45
|
+
ssn?: string,
|
|
46
|
+
passport?: string,
|
|
47
|
+
nationality?: string,
|
|
48
|
+
design?: string,
|
|
49
|
+
additionalEmbossedText?: string,
|
|
50
|
+
idempotencyKey?: string,
|
|
51
|
+
tags?: Record<string, string>
|
|
52
|
+
limits?: Limits,
|
|
53
|
+
printOnlyBusinessName?: boolean
|
|
54
|
+
},
|
|
55
|
+
relationships: {
|
|
56
|
+
account: Relationship,
|
|
57
|
+
customer: Relationship
|
|
58
|
+
}
|
|
59
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
export type Address = {
|
|
2
|
+
street: string,
|
|
3
|
+
street2?: string,
|
|
4
|
+
city: string,
|
|
5
|
+
state: string,
|
|
6
|
+
postalCode: string,
|
|
7
|
+
country: string
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export type Limits = {
|
|
11
|
+
dailyWithdrawal?: string | number,
|
|
12
|
+
dailyPurchase?: string | number,
|
|
13
|
+
monthlyWithdrawal?: string | number,
|
|
14
|
+
monthlyPurchase?: string | number,
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
type Data = {
|
|
18
|
+
type: string,
|
|
19
|
+
id: string
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export type Relationship = {
|
|
23
|
+
data:
|
|
24
|
+
| null
|
|
25
|
+
| []
|
|
26
|
+
| Data
|
|
27
|
+
| Data[]
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export type FullName = {
|
|
31
|
+
first: string,
|
|
32
|
+
last: string
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export type Tags = Record<string, string> // TODO: specify Tag type
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import EventBus from '../helpers/EventBus';
|
|
2
|
+
import { NativeMessage } from '../messages/nativeMessages';
|
|
3
|
+
import { UnitSDK, UNIT_SCRIPT_URL } from './UnitSdkManager';
|
|
4
|
+
|
|
5
|
+
let isLoadingScript = false;
|
|
6
|
+
|
|
7
|
+
/** globalUnitScript is exported ONLY to our project components **/
|
|
8
|
+
export let globalUnitScript = '';
|
|
9
|
+
|
|
10
|
+
export const fetchUnitScript = async () => {
|
|
11
|
+
const env = UnitSDK.getEnv();
|
|
12
|
+
if (isLoadingScript || globalUnitScript || !env) {
|
|
13
|
+
// init function is called and success OR in progress
|
|
14
|
+
return null;
|
|
15
|
+
}
|
|
16
|
+
isLoadingScript = true;
|
|
17
|
+
try {
|
|
18
|
+
const unitScriptRes = await fetch(UNIT_SCRIPT_URL[env]);
|
|
19
|
+
const unitScript = await unitScriptRes.text();
|
|
20
|
+
if (unitScript) {
|
|
21
|
+
EventBus.Instance.event(NativeMessage.IS_SCRIPT_FETCHED, { unitScript });
|
|
22
|
+
globalUnitScript = unitScript;
|
|
23
|
+
}
|
|
24
|
+
return null;
|
|
25
|
+
} catch (e) {
|
|
26
|
+
console.log(e);
|
|
27
|
+
return null;
|
|
28
|
+
} finally {
|
|
29
|
+
isLoadingScript = false;
|
|
30
|
+
}
|
|
31
|
+
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { fetchUnitScript } from './UnitSdk.api';
|
|
2
|
+
|
|
3
|
+
export enum UNEnvironment {
|
|
4
|
+
sandbox = 'sandbox',
|
|
5
|
+
production = 'production'
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export const UNIT_SCRIPT_URL = {
|
|
9
|
+
[UNEnvironment.sandbox]: 'https://ui.s.unit.sh/components.js',
|
|
10
|
+
[UNEnvironment.production]: 'https://ui.unit.co/components.js'
|
|
11
|
+
};
|
|
12
|
+
export class UnitSDK {
|
|
13
|
+
protected static env?: UNEnvironment;
|
|
14
|
+
protected static theme?: string;
|
|
15
|
+
|
|
16
|
+
public static init = async (env: UNEnvironment, theme: string) => {
|
|
17
|
+
try {
|
|
18
|
+
this.env = env;
|
|
19
|
+
this.theme = theme;
|
|
20
|
+
await fetchUnitScript();
|
|
21
|
+
} catch (e) {
|
|
22
|
+
console.log(e);
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
public static getEnv = () => {
|
|
27
|
+
return this.env;
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
public static getTheme = () => {
|
|
31
|
+
return this.theme;
|
|
32
|
+
};
|
|
33
|
+
}
|
|
@@ -1,75 +1,73 @@
|
|
|
1
1
|
import React, { useEffect, useState } from 'react';
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
} from '
|
|
7
|
-
import
|
|
8
|
-
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import type { PageEvent, PageMessage } from './webMessages/pageMessage';
|
|
12
|
-
import { RequestRefreshEvent, UnitEvent, UnitMessage } from './webMessages/unitMessages';
|
|
13
|
-
|
|
14
|
-
export type WebViewMessageType =
|
|
15
|
-
| PageMessage
|
|
16
|
-
| CardMessage
|
|
17
|
-
| UnitMessage
|
|
18
|
-
|
|
19
|
-
type WebViewEvent =
|
|
20
|
-
| PageEvent
|
|
21
|
-
| UnitEvent
|
|
22
|
-
| CardEvent
|
|
23
|
-
|
|
24
|
-
export interface WebViewMessage {
|
|
25
|
-
type: WebViewMessageType,
|
|
26
|
-
details?: WebViewEvent
|
|
27
|
-
}
|
|
2
|
+
import { WebView, WebViewMessageEvent } from 'react-native-webview';
|
|
3
|
+
import EventBus from '../helpers/EventBus';
|
|
4
|
+
import html, { HTML_PLACEHOLDER } from './html';
|
|
5
|
+
import { RequestRefreshEvent, UnitMessage } from '../messages/webMessages/unitMessages';
|
|
6
|
+
import { useListenerToBus } from '../hooks/listenerToBus';
|
|
7
|
+
import type { WebViewMessage } from '../messages/webMessages';
|
|
8
|
+
import { getHtmlBody, PresentationMode } from '../scripts/html/bodyHtml';
|
|
9
|
+
import { fetchUnitScript, globalUnitScript } from '../unitSdkManager/UnitSdk.api';
|
|
10
|
+
import { NativeMessage } from '../messages/nativeMessages';
|
|
28
11
|
|
|
29
12
|
export interface WebComponentProps {
|
|
30
13
|
type: WebComponentType;
|
|
14
|
+
presentationMode?: PresentationMode,
|
|
31
15
|
params?: string;
|
|
32
|
-
onMessage
|
|
16
|
+
onMessage?: (message: WebViewMessage) => void;
|
|
33
17
|
script?: string;
|
|
18
|
+
width?: number;
|
|
19
|
+
shouldEnableWebViewScroll?: boolean;
|
|
34
20
|
}
|
|
35
21
|
|
|
36
22
|
export enum WebComponentType {
|
|
37
23
|
card = 'unit-elements-card',
|
|
24
|
+
bookPayment = 'unit-elements-book-payment',
|
|
25
|
+
activity = 'unit-elements-activity',
|
|
38
26
|
slot = 'unit-elements-sdk-slot'
|
|
39
27
|
}
|
|
40
28
|
|
|
41
|
-
export const WebComponent = React.forwardRef<WebView, WebComponentProps>((props, webRef)
|
|
42
|
-
const [
|
|
29
|
+
export const WebComponent = React.forwardRef<WebView, WebComponentProps>(function WebComponent(props, webRef) {
|
|
30
|
+
const [unitScript, setUnitScript] = useState<string | undefined>(globalUnitScript);
|
|
31
|
+
const [sourceHtml, setSourceHtml] = useState<string | null>(null);
|
|
43
32
|
|
|
44
|
-
const
|
|
33
|
+
const listenerAction = (data: { unitScript?: string }) => {
|
|
34
|
+
setUnitScript(data.unitScript);
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
useListenerToBus([{ busEventKey: NativeMessage.IS_SCRIPT_FETCHED, action: listenerAction }]);
|
|
45
38
|
|
|
46
39
|
useEffect(() => {
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
}, [props.params])
|
|
40
|
+
if (!unitScript) {
|
|
41
|
+
fetchUnitScript();
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
52
44
|
|
|
53
|
-
|
|
54
|
-
|
|
45
|
+
let newHtml = html.replace(HTML_PLACEHOLDER.BODY, getHtmlBody(props.type.valueOf(), props.params, props.presentationMode));
|
|
46
|
+
newHtml = newHtml.replace(HTML_PLACEHOLDER.SCRIPT_FROM_NATIVE, props.script || '');
|
|
47
|
+
setSourceHtml(newHtml);
|
|
55
48
|
|
|
49
|
+
}, [props.params, unitScript]);
|
|
50
|
+
|
|
51
|
+
const onMessage = (e: WebViewMessageEvent) => {
|
|
52
|
+
const message = JSON.parse(e.nativeEvent.data) as WebViewMessage;
|
|
56
53
|
if (message.type == UnitMessage.UNIT_REQUEST_REFRESH && message.details) {
|
|
57
|
-
EventBus.Instance.event(
|
|
54
|
+
EventBus.Instance.event(UnitMessage.UNIT_REQUEST_REFRESH, message.details as RequestRefreshEvent);
|
|
58
55
|
} else {
|
|
59
|
-
props.onMessage(message)
|
|
56
|
+
props.onMessage && props.onMessage(message);
|
|
60
57
|
}
|
|
61
|
-
}
|
|
58
|
+
};
|
|
62
59
|
|
|
63
|
-
if (!sourceHtml) return null
|
|
60
|
+
if (!sourceHtml) return null;
|
|
64
61
|
|
|
65
62
|
return (
|
|
66
63
|
<WebView
|
|
67
64
|
ref={webRef}
|
|
68
65
|
cacheEnabled={false}
|
|
69
|
-
scrollEnabled={
|
|
66
|
+
scrollEnabled={props.shouldEnableWebViewScroll}
|
|
70
67
|
overScrollMode="never"
|
|
71
|
-
|
|
68
|
+
injectedJavaScript={unitScript}
|
|
69
|
+
style={{ width: props.width ?? '100%', flex: 1 }}
|
|
72
70
|
source={{ html: sourceHtml }}
|
|
73
71
|
onMessage={onMessage} />
|
|
74
|
-
)
|
|
75
|
-
})
|
|
72
|
+
);
|
|
73
|
+
});
|