react-native-switch-selector
react-native-switch-selector copied to clipboard
'SwitchSelector' cannot be used as a JSX component.
Welp, I was just trying to replicate the examples, but this SwitchSelector is not working for me
import SwitchSelector from 'react-native-switch-selector';
...
const Homescreen =() => {
...
const options = [
{label: '01:00', value: '1'},
{label: '01:30', value: '1.5'},
{label: '02:00', value: '2'},
];
return (
...`
<SwitchSelector
options={options}
initial={0}
onPress={value => console.log(`Call onPress with value: ${value}`)}
/>
)
...
}
Error:
JSX element class does not support attributes because it does not have a 'props' property.ts(2607) 'SwitchSelector' cannot be used as a JSX component. Its instance type 'SwitchSelector' is not a valid JSX element. Type 'SwitchSelector' is missing the following properties from type 'ElementClass': context, setState, forceUpdate, props, refsts(2786)
Same issue here. Any update? @jkdrangel
My workaround for now is to downgrade to v2.1.4.
I extract the index to a function component with typescript, see below. https://gist.github.com/ArthurAssuncao/ebe852e5d7e093389daa2a474e41741b