Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding customCancelButton and customConfirmButton types #655

Conversation

luizaugustoventura
Copy link
Contributor

@luizaugustoventura luizaugustoventura commented Aug 25, 2022

Thank you guys for an amazing lib!!

PS: I closed this PR because I had the wrong email in the commit, so the commit's signature was unverified. Consider this Pull Request instead. I am sorry for that!

Overview

The library is missing the CancelButton and ConfirmButton components for the iOS only properties customCancelButtonIOS and customConfirmButtonIOS. I also found a good idea to export their styles, just in case someone (myself included) wants to do some slight changes.

All I mentioned works fine, but whenever you try to import any of these two components or their styles you get some red on your code editor. That's because the declaration file is missing these elements. So all I did was I exported from ìndex.d.ts the CancelButton and ConfirmButton components, told the declaration file the customConfirmButtonIOS and customCancelButtonIOS properties were a React.FunctionComponenet<props> with some extra props. I also exported the style types of both components.

Test Plan

There is not much to do actually, all I did was passing the buttonTextColorIOS property to the custom button I was using. For example:

import ModalDateTimePicker, { CancelButton };

<ModalDateTimePicker
    // ... <normally used props>
    customCancelButtonIOS={(props) => <CancelButton {...props} buttonTextColorIOS="red"  />}
/>

If you want to change the button styles, you might want to do something like that:

import ModalDateTimePicker, { CancelButton, CancelButtonStylePropTypes, cancelButtonStyles };

const customStyles: CancelButtonStylePropTypes = {
    ...cancelButtonStyles,
    text: {
        ...cancelButtonStyles.text,
        color: 'red',
    },
};

<ModalDateTimePicker
    // ... <normally used props>
    customCancelButtonIOS={(props) => <CancelButton {...props} style={customStyles} />}
/>

@luizaugustoventura luizaugustoventura changed the title Add customCancelButton & customConfirmButton types Adding customCancelButton and customConfirmButton types Aug 25, 2022
@luizaugustoventura luizaugustoventura deleted the custom-confirm-and-cancel-buttons-typings branch August 28, 2022 01:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant