37 lines
1.3 KiB
TypeScript
37 lines
1.3 KiB
TypeScript
import { View } from "react-native";
|
|
import { CtaData } from "../../interface";
|
|
import { GenericActionPayload } from "../../actions/GenericAction";
|
|
import { ScreenData } from "../../interface/widgets/screenData/ScreenData";
|
|
import { getScreenMapperNameFromCtaData } from "../../utilities/MiscUtils";
|
|
import { commonStyles } from "../../../Container/Navi-Insurance/Styles";
|
|
import { GIScreenMapper } from "./GIScreenMapper";
|
|
import { GI } from "../../constants/NavigationHandlerConstants";
|
|
import { logToSentry } from "../../hooks/useSentryLogging";
|
|
|
|
export const ScreenMapper = {
|
|
getScreenMapper(
|
|
ctaData: CtaData | null | undefined,
|
|
screenData: ScreenData | null,
|
|
handleActions: (actionPayload?: GenericActionPayload) => void
|
|
): JSX.Element {
|
|
if (!!ctaData) {
|
|
const secondIdentifier = getScreenMapperNameFromCtaData(ctaData);
|
|
switch (secondIdentifier) {
|
|
case GI:
|
|
return (
|
|
<View style={commonStyles.flex_1}>
|
|
{GIScreenMapper.getScreen(ctaData, screenData, handleActions)}
|
|
</View>
|
|
);
|
|
default:
|
|
return <View />;
|
|
}
|
|
} else {
|
|
logToSentry(
|
|
`CtaData is missing or invalid: ${ctaData} | MethodName: ScreenMapper.getScreen`
|
|
);
|
|
return <View />;
|
|
}
|
|
},
|
|
};
|