react-native-simple-router icon indicating copy to clipboard operation
react-native-simple-router copied to clipboard

Unable to pass an Icon to backButtonComponent

Open ericraio opened this issue 9 years ago • 2 comments

When I was setting the back button component, I couldn't just pass in an Icon component, the proptype is expecting a function and not an object. I had to create a new component that returns the Icon and pass it in.

Should we change this?

ericraio avatar Apr 15 '16 02:04 ericraio

As the name of the prop says, it expects a component, which is a function and not an object. I don't see why we should change the usecase for this specific property, as it is semantically correct. If you'd like to introduce a new prop for defining an icon, you're welcome to do that, but generically supporting icons is a slippery slope in my opinion, because there are quite a few ways of doing that. For instance in my project I use custom fonts for icons. But I've also used image sprites before. The implementations may vary vastly, and it's difficult to find a general solution, so I think it might be wise to leave it to the implementor to quickly write a dumb component to display an icon.

I vote no.

davidLeonardi avatar Apr 15 '16 15:04 davidLeonardi

@sethx I think it should take any react element, this would support all components, images, icons. anything that renders

React.PropTypes.func -> React.PropTypes.element,

ericraio avatar Apr 15 '16 17:04 ericraio