jmurzy/react-router-native

<Link> component has excessive required props.

Closed this issue · 1 comments

The Aviato example and the actual flow types defined for the Link component are pretty different. Currently when using the Link component the state, and onPress props are required, even though the values for them are optional. Leading to errors like this.

screen shot 2016-11-11 at 3 08 46 pm

The source code for Link has a guard clause for onPress that doesn't try to call the function if it isn't provided, but it's a pain to have to provide the prop, even if it's null.

I think the flow type should have a question mark appended to the key in order to make passing that actual prop optional. Something like onPress?: ?Function. Is it intentional to have the the onPress and state marked as non-optional?

Side question: What exactly can go into state?

By the way, thanks for this awesome library, I'm looking forward to contributing some PR's. 💃