[Feature Request] More flexibility of Component props
See original GitHub issueAs requested in #776 by @artyorsh:
Issue type
I’m submitting a …
- feature request
Issue description
Current behavior: Attempting to customize the contents of a Components to compose new, exciting components is impossible. Trying to achieve something like this:
const ImpossibleTopNavigation = (props) => (
<TopNavigation {...props} title={<Image {... someStuff} />} />
);
Ends up with this error:
Type 'Element' is not assignable to type 'string'
(Because title
only allows strings)
Expected behavior: Most Components in UI Kitten with small modifications can receive a different PropType and still function properly… avoiding awkward workarounds:
const PossibleNavigation = (props) => (
<TopNavigation {...props} title={<Image {... someStuff} />} />
);
const LoadingButton: ({ isLoading, children }) => {
<Button>
{/* This doesn't cover disabling it an other stuff, but you get the idea */}
{isLoading ? (<SomeCoolSpinner />) : (children)}
</Button>
};
By allowing for more flexibility in contents of components like Text or Button, probably these kinds of issues probably won’t exist anymore:
I believe that would require repeating #627 on the rest of Components’ Props interfaces/types. I did something similar for my particular need of customizing the TopNavigationBar
Component.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:1
- Comments:8
Top GitHub Comments
Lovely!! Thanks!! Migration looks pretty straightforward, maybe I’ll update my production App. I’ll upgrade my current project to use v5.
I guess I’ll close this issue 😄
@lesmo I’m happy to say this is available in v5 😃 Release notes