Files
super-app/components/widgets/ButtonTestWidget.tsx
2024-03-27 15:06:03 +00:00

65 lines
1.7 KiB
TypeScript

import { Text, View, ViewStyle } from "react-native";
import { TouchableOpacity } from "react-native-gesture-handler";
import { GenericActionPayload } from "../../App/common/actions/GenericAction";
import { TitleWidgetData } from "../../App/common/interface/widgets/widgetData/TitleWidgetData";
import { NativeDeeplinkNavigatorModule } from "../../App/common/native-module/NativeModules";
const ButtonTestWidget = ({
widgetData,
widgetStyle,
handleActions,
widgetIndex,
}: {
widgetData: TitleWidgetData;
widgetStyle: ViewStyle;
handleActions: (
value: any | undefined | null,
screenActionPayload: GenericActionPayload
) => void;
widgetIndex: number;
}) => {
const handleButtonClick = (): void => {
NativeDeeplinkNavigatorModule.navigateToNaviDeeplinkNavigator(
JSON.stringify({
url: "gi/fresh_policy_form/form",
type: "REDIRECTION_CTA",
parameters: [
{
key: "type",
value: "FRESH_POLICY",
},
{
key: "applicationType",
value: "FRESH_POLICY",
},
{
key: "landingPageVersion",
value: "3",
},
],
})
);
// handleActions({
// actionType: WidgetActionTypes.UPDATE_WIDGET_DATA,
// metaData: {
// widgetActionMeta: {
// targetWidgetId: "title_widget_1",
// keyPath: "subtitle.text",
// newValue: "THIS IS THE SUBTITLE"
// }
// }
// }
// );
};
return (
<View style={widgetStyle}>
<TouchableOpacity onPress={handleButtonClick}>
<Text>Click me</Text>
</TouchableOpacity>
</View>
);
};
export default ButtonTestWidget;