Skip to main content

HorizontalButtonsView

Reusable HorizontalButtonsView component for ModalBase

Example

import {
Button,
createStyles,
IButtonTypes,
ModalBase,
Typography,
usePopups,
useStyles,
View,
} from '@lad-tech/mobydick-core';

export const ModalWidget = () => {
const [styles] = useStyles(styleFn);
const {openPopup} = usePopups();

return (
<View style={styles.container}>
<Typography font={'Regular-Primary-H5'}>Modal</Typography>
<Button
text={'ModalBase'}
onPress={() =>
openPopup({
Content: props => (
<ModalBase {...props}>
<ModalBase.HorizontalButtonsView
textLeft={'Left btn'}
textRight={'Right btn'}
typeLeft={IButtonTypes.primary}
typeRight={IButtonTypes.destructive}
onPressRight={props.onClose}
onPressLeft={props.onClose}
/>
</ModalBase>
),
})
}
/>
</View>
);
};

const styleFn = createStyles(({spaces}) => ({
container: {
gap: spaces.Space8,
},
}));

Props

Required
typeLeft

TYPE
IButtonTypes

TypeLeft for left button in HorizontalButtonsView

Required
typeRight

TYPE
IButtonTypes

TypeRight for right button in HorizontalButtonsView

Required
onPressLeft

TYPE
() => void

OnPress for left button in HorizontalButtonsView

Required
onPressRight

TYPE
() => void

OnPress for right button in HorizontalButtonsView

Required
textLeft

TYPE
string

Text for left button in HorizontalButtonsView

Required
textRight

TYPE
string

Text for right button in HorizontalButtonsView

disabledLeft

TYPE
boolean

Disabled for left button in HorizontalButtonsView

disabledRight

TYPE
boolean

Disabled for right button in HorizontalButtonsView