diff --git a/src/components/Toast/index.test.tsx b/src/components/Toast/index.test.tsx index 6ed68bb..a288a38 100644 --- a/src/components/Toast/index.test.tsx +++ b/src/components/Toast/index.test.tsx @@ -8,15 +8,15 @@ import Text from '../Text'; const props1 = { showIcon: true, customIcon: 'iso_janis', - showClose: true, - link: 'Open', + showCloseIcon: true, + actionTitle: 'Open', iconStyle: {color: 'red'}, }; const props2 = { ...props1, onCloseCb: jest.fn(), - linkCb: jest.fn(), + actionCb: jest.fn(), }; const validProps = { @@ -68,8 +68,8 @@ describe('Toast', () => { props={props1} /> ); - const [link, close] = root.findAllByType(TouchableOpacity); - const {onPress: linkOnPress} = link.props; + const [actionTitle, close] = root.findAllByType(TouchableOpacity); + const {onPress: linkOnPress} = actionTitle.props; const {onPress: closeOnPress} = close.props; linkOnPress(); closeOnPress(); diff --git a/src/components/Toast/index.tsx b/src/components/Toast/index.tsx index 2eb3c1e..ce17a1a 100644 --- a/src/components/Toast/index.tsx +++ b/src/components/Toast/index.tsx @@ -12,10 +12,10 @@ export interface ToastProps extends BaseToastProps { props?: { showIcon?: boolean; customIcon?: string; - showClose?: boolean; - link?: string; + showCloseIcon?: boolean; + actionTitle?: string; onCloseCb?: () => void; - linkCb?: () => void; + actionCb?: () => void; iconStyle?: TextStyle; }; } @@ -32,10 +32,10 @@ const Toast: FC = ({type, text1, text2, style, props}) => { const { showIcon = false, customIcon = null, - showClose = false, - link = null, + showCloseIcon = false, + actionTitle = null, onCloseCb = () => {}, - linkCb = () => {}, + actionCb = () => {}, iconStyle = {}, } = props || {}; @@ -82,7 +82,7 @@ const Toast: FC = ({type, text1, text2, style, props}) => { closeIcon: { paddingLeft: scaledForDevice(10, moderateScale), }, - link: { + actionTitle: { marginRight: scaledForDevice(5, moderateScale), marginLeft: scaledForDevice(10, moderateScale), fontFamily: 'Roboto-Medium', @@ -108,12 +108,12 @@ const Toast: FC = ({type, text1, text2, style, props}) => { - {link && ( - - {link} + {actionTitle && ( + + {actionTitle} )} - {showClose && ( + {showCloseIcon && ( diff --git a/storybook/stories/Toast/Toast.stories.js b/storybook/stories/Toast/Toast.stories.js index 11f8f0a..d0036b0 100644 --- a/storybook/stories/Toast/Toast.stories.js +++ b/storybook/stories/Toast/Toast.stories.js @@ -23,7 +23,7 @@ export default { Janis: 'iso_janis', }, }, - link: { + actionTitle: { control: {type: 'select'}, options: { None: null, @@ -51,10 +51,10 @@ export const DefaultProps = (props) => ( text2: props.text2, autoHide: props.autoHide, props: { - link: props.link, + actionTitle: props.actionTitle, showIcon: props.showIcon, customIcon: props.customIcon, - showClose: props.showClose, + showCloseIcon: props.showCloseIcon, iconStyle: props.iconStyle, onCloseCb: Toast.hide, }, @@ -72,8 +72,8 @@ DefaultProps.args = { 'Lorem ipsum dolor sit amet, consectetur adipiscingsed ipsum dolorrrrdfds ipsum dolor sit amet.', autoHide: true, showIcon: true, - showClose: true, + showCloseIcon: true, customIcon: null, - link: null, + actionTitle: null, iconStyle: {}, };