danielweinmann / react-native-stateless-form

Stateless form components for React Native
MIT License
105 stars 14 forks source link

PropTypes check for children #6

Open kristian-puccio opened 8 years ago

kristian-puccio commented 8 years ago

I guess we need to do this check so we don't try to focus a non-form element: if (child.type.propTypes && child.type.propTypes.value && child.type.propTypes.valid) {

Just I don't use propTypes as I'm using typescript. So I propose we do this another way: if (typeof child.props.value !== 'undefined') {

That way the presence of the value property (with value or not) is enough.

I guess another way of doing this is to have a 'isSelectable' prop.

Let me know what you think and I'll prepare a pull-request