import * as React from "react"; import { componentsLogger } from "../../Helpers/logger"; import { useScreenAnalytics } from "@applicaster/zapp-react-native-utils/analyticsUtils/helpers/hooks"; import { useScreenComponentResolver } from "./hooks/useScreenComponentResolver"; import { withDefaultScreenContext } from "./withDefaultScreenContext"; const logger = componentsLogger.addSubsystem("ScreenResolver"); type Props = { screenType: string; screenId: string; screenData: any; feedId?: string; feedTitle?: string; focused?: boolean; parentFocus?: { nextFocusDown?: React.Ref; nextFocusRight?: React.Ref; nextFocusLeft?: React.Ref; nextFocusUp?: React.Ref; }; groupId?: string; }; export enum PresentationType { Standalone = "Standalone", Hook = "Hook", } export function ScreenResolverComponent(props: Props) { const { screenType } = props; const component = useScreenComponentResolver(screenType, props); useScreenAnalytics(props); if (component) { return component; } logger.warning({ message: "Could not resolve screen plugin", data: props, }); return null; } export const ScreenResolver = withDefaultScreenContext(ScreenResolverComponent);