UNPKG

react-native-unit-components

Version:

Unit React Native components

131 lines (111 loc) 4.59 kB
import type { RequestRenderingEvent } from '../../messages/webMessages/unitComponentsMessages'; import type { WebComponentType } from './webComponent.types'; import { UNAddToWalletComponentProps, } from '../../nativeComponents/UNAddToWallet/UNAddToWalletComponent/UNAddToWalletComponent'; import { UNACHCreditComponentProps } from '../../components/UNACHCreditComponent'; import { UNACHDebitComponentProps } from '../../components/UNACHDebitComponent'; import { UNCheckDepositComponentProps } from '../../components/UNCheckDepositComponent'; import { UNBookPaymentComponentProps } from '../../components/UNBookPaymentComponent'; import { UNWirePaymentComponentProps } from '../../components/UNWirePaymentComponent'; import { UNCreateCardComponentProps } from '../../components/UNCreateCardComponent'; import { UNCheckPaymentComponentProps } from '../../components/UNCheckPaymentComponent'; export enum BottomSheetNativePlaceType { overFullScreen = 'overFullScreen', modal = 'modal', menu = 'menu', contentHeight = 'contentHeight' } export enum ScrollState { /* Web View ScrollState - - Initialization: 'onTop': for a scrollable webView. (onTop means that the webview is onTop of the BottomSheet and we need to recognize the scroll direction). Then, it recognize the scroll direction and update the scroll state as needed. -'unScrollable': for an unscrollable webView */ onTop = 'onTop', unScrollable = 'unScrollable', /* These are only for maintain the bottom sheet scrollState (not an initialize scroll state). It relates to the current scroll state. onlyWebView means that now the scroll is on webview (only). onlyBottomSheet means that now the scroll is on bottomSheet (only). */ onlyWebView = 'webViewScroll', onlyBottomSheet = 'onlyBottomSheet', } export enum BottomSheetRenderingType { Slot, NativeComponent } export enum BottomSheetNativeComponentType { AddToWalletComponent = 'UNAddToWalletComponent', ACHCreditComponent = 'UNACHCreditComponent', ACHDebitComponent = 'UNACHDebitComponent', CheckDepositComponent = 'UNCheckDepositComponent', CheckPaymentComponent = 'UNCheckPaymentComponent', BookPaymentComponent = 'UNBookPaymentComponent', WirePaymentComponent = 'UNWirePaymentComponent', CreateCardComponent = 'UNCreateCardComponent' } export type BottomSheetNativeAddToWalletComponentType = { type: BottomSheetNativeComponentType.AddToWalletComponent, props: UNAddToWalletComponentProps } export type BottomSheetNativeACHCreditComponentType = { type: BottomSheetNativeComponentType.ACHCreditComponent, props: UNACHCreditComponentProps } export type BottomSheetNativeACHDebitComponentType = { type: BottomSheetNativeComponentType.ACHDebitComponent, props: UNACHDebitComponentProps } export type BottomSheetNativeCheckDepositComponentType = { type: BottomSheetNativeComponentType.CheckDepositComponent, props: UNCheckDepositComponentProps } export type BottomSheetNativeCheckPaymentComponentType = { type: BottomSheetNativeComponentType.CheckPaymentComponent, props: UNCheckPaymentComponentProps } export type BottomSheetNativeBookPaymentComponentType = { type: BottomSheetNativeComponentType.BookPaymentComponent, props: UNBookPaymentComponentProps } export type BottomSheetNativeWirePaymentComponentType = { type: BottomSheetNativeComponentType.WirePaymentComponent, props: UNWirePaymentComponentProps } export type BottomSheetNativeCreateCardComponentType = { type: BottomSheetNativeComponentType.CreateCardComponent, props: UNCreateCardComponentProps } export type BottomSheetNativeComponent = BottomSheetNativeAddToWalletComponentType | BottomSheetNativeACHCreditComponentType | BottomSheetNativeACHDebitComponentType | BottomSheetNativeCheckDepositComponentType | BottomSheetNativeCheckPaymentComponentType | BottomSheetNativeBookPaymentComponentType | BottomSheetNativeWirePaymentComponentType | BottomSheetNativeCreateCardComponentType export type BottomSheetSlotData = { // The data that rendered by the web view componentName?: WebComponentType, componentResourceId?: string, requestRenderingEvent: RequestRenderingEvent } export type NativeComponentData = { component: BottomSheetNativeComponent, scrollState?: ScrollState, nativePlace?: BottomSheetNativePlaceType, } export interface SlotRendering { type: BottomSheetRenderingType.Slot, data: BottomSheetSlotData } export interface NativeComponentRendering { type: BottomSheetRenderingType.NativeComponent, data: NativeComponentData }