Signed-off-by: kishan kumar <kishan.kumar@navi.com> Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: Chirayu <chirayu.mor@navi.com> Co-authored-by: Prakhar Saxena <prakhar.saxena@navi.com> Co-authored-by: Shivam Goyal <shivam.goyal@navi.com> Co-authored-by: vedant aggarwal <vedant.aggarwal@navi.com> Co-authored-by: A Shrihari Raju <shrihari.raju@navi.com> Co-authored-by: Prajjaval Verma <prajjaval.verma@navi.com> Co-authored-by: Raaj Gopal <raaj.gopal@navi.com> Co-authored-by: Aman S <aman.s@navi.com> Co-authored-by: Aman <amankasyapp@gmail.com> Co-authored-by: Sanjay P <sanjay.p@navi.com> Co-authored-by: Varun Jain <varun.jain@navi.com> Co-authored-by: Shiv Natani <shiv.natani@navi.com> Co-authored-by: Hardik Chaudhary <hardik.chaudhary@navi.com> Co-authored-by: Kishan Kumar <kishan.kumar@navi.com> Co-authored-by: Balrambhai Sharma <sharma.balrambhai@navi.com> Co-authored-by: Ujjwal Kumar <ujjwal.kumar@navi.com> Co-authored-by: Aditya Narayan Malik <aditya.narayan@navi.com> Co-authored-by: Ayushman Sharma <ayushman.sharma@navi.com> Co-authored-by: Anmol Agrawal <anmol.agrawal@navi.com> Co-authored-by: Soumya Ranjan Patra <soumya.ranjan@navi.com> Co-authored-by: Sohan Reddy Atukula <sohan.reddy@navi.com> Co-authored-by: Sayed Owais Ali <sayed.owais@navi.com> Co-authored-by: Ankit Yadav <ankit.yadav@navi.com> Co-authored-by: Shaurya Rehan <shaurya.rehan@navi.com> Co-authored-by: saksham-mahajan_navi <saksham.mahajan@navi.com> Co-authored-by: shankar yadav <shankar.yadav@navi.com> Co-authored-by: Mehul Garg <mehul.garg@navi.com> Co-authored-by: Somarapu Vamshi <somarapu.vamshi@navi.com> Co-authored-by: Kshitij Pramod Ghongadi <kshitij.pramod@navi.com> Co-authored-by: Sandeep Kumar <sandeep.ku@navi.com> Co-authored-by: Aparna Vadlamani <aparna.vadlamani@navi.com> Co-authored-by: Siddiboina Susai <siddiboina.susai@navi.com> Co-authored-by: Kamalesh Garnayak <kamalesh.garnayak@navi.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Divyesh Shinde <divyesh.shinde@navi.com> Co-authored-by: Mohit Rajput <mohit.rajput@navi.com> Co-authored-by: Akshita Singh <akshita.singh@navi.com> Co-authored-by: shreyansu raj <shreyansu.raj@navi.com> Co-authored-by: Venkat Praneeth Reddy <venkat.praneeth@navi.com>
48 lines
1.5 KiB
TypeScript
48 lines
1.5 KiB
TypeScript
import { TouchableHighlight, TouchableOpacity, ViewStyle } from "react-native";
|
|
import { Lottie } from "../../../App/common/constants/StringConstant";
|
|
import { ButtonState } from "../../../App/common/interface/widgets/widgetData/FooterWithCardWidgetData";
|
|
import { LottieFieldData } from "../../../App/common/interface/widgets/widgetData/TitleWidgetData";
|
|
import { StyledLottie } from "../../widgets/styled-lottie/StyledLottie";
|
|
import styles from "./CtaButtonStyle";
|
|
import { Platform } from "react-native";
|
|
import { OsTypeConstants } from "../../../App/common/constants/BuildConfigConstants";
|
|
import LottieView from "../../widgets/styled-lottie/StyledLottieIos";
|
|
|
|
const CtaButton = ({
|
|
onPress,
|
|
style,
|
|
children,
|
|
state,
|
|
}: {
|
|
onPress?: () => void;
|
|
style?: ViewStyle;
|
|
children?: React.ReactNode;
|
|
state?: ButtonState;
|
|
}) => {
|
|
const loaderData: LottieFieldData = {
|
|
url: Lottie.FOOTER_LOADER_URL,
|
|
loop: true,
|
|
lottieStyle: styles.loaderLottieStyle,
|
|
};
|
|
return (
|
|
<TouchableOpacity
|
|
activeOpacity={1}
|
|
onPress={onPress}
|
|
disabled={state === ButtonState.DISABLED || state === ButtonState.LOADING}
|
|
style={[styles.footerButtonContainer, style]}
|
|
>
|
|
{state === ButtonState.LOADING ? (
|
|
Platform.OS === OsTypeConstants.IOS ? (
|
|
<LottieView />
|
|
) : (
|
|
<StyledLottie lottieFieldData={loaderData} />
|
|
)
|
|
) : (
|
|
children
|
|
)}
|
|
</TouchableOpacity>
|
|
);
|
|
};
|
|
|
|
export default CtaButton;
|