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

refactor to functional component and typescript #11

Open
allandiego opened this issue Mar 23, 2022 · 3 comments
Open

refactor to functional component and typescript #11

allandiego opened this issue Mar 23, 2022 · 3 comments

Comments

@allandiego
Copy link

@jkdrangel I have refactored this component using functional approach and typescript do you have interest in this pull request?

@jkdrangel
Copy link
Owner

Yes @allandiego thanks for this.

@Ryanjso
Copy link

Ryanjso commented May 9, 2022

Temporary fix for those who may need it

import SwitchSelector from 'react-native-switch-selector'

export const Switch = () => {
    interface SwitchFix extends React.Component {}
    const Switch = SwitchSelector as any as {
        new (): SwitchFix
    }

    const options = [
        { label: 'Delivery', value: 'delivery' },
        { label: 'Pickup', value: 'pickup' },
    ]

    const props: any = {
        options,
        initial: 0
    }

    return <Switch {...props} />
}

@ArthurAssuncao
Copy link

I extract the index to a function component with typescript, see below.
https://gist.github.com/ArthurAssuncao/ebe852e5d7e093389daa2a474e41741b

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

No branches or pull requests

4 participants