Fixes #14. Children, if present, are required to be of type string, node, or element.#22
Fixes #14. Children, if present, are required to be of type string, node, or element.#22Andrewpk wants to merge 2 commits intoAPSL:masterfrom
Conversation
… must be of type string, node, or element. This should allow nesting of custom elements (icons) inside buttons.
|
Thanks for the PR @Andrewpk! It looks great so let me run a couple of tests and I'll merge it as soon as I can. |
|
Will merge tomorrow! Thanks for the patience @Andrewpk 😉 |
|
No problem @alvaromb. I worked on another change yesterday in a personal branch that would remove the singular text wrapper and allow individual elements to be rendered in their own views within the button. This allows for placement styles (flex, margin, padding, etc.) on individual components within a button. If that sounds like something you'd like to include I'll submit a PR for that when I'm done as well. |
|
Yes, if we have to integrate more than just a |
|
Hello @Andrewpk. Can't merge this PR because the example doesn't run. <Button
style={styles.buttonStyle1} textStyle={styles.textStyle}
onPress={() => {
console.log('world!')
}}>
<View>
<Text>Hello</Text>
</View>
</Button>The solution should be something like wrapping everything into a parent view, not a text, and discriminate between raw strings and a React node. I can plan to develop something like that, but it would be done/merged during the next week. |
|
I'm going to close this PR in favor of #29 |

Fixes #14
Children aren't required - so an empty button is allowed, but if they are present they must be of types:
This should allow nesting of custom elements (icons) inside buttons. This is a more accommodating fix than what was presenting in code by #15 and seems to line up more with @alvaromb's desires for this change.
Here's a screenshot of the proposed solution working with react-native-vector-icons:
And here's the code for the button: