ide / react-native-button

A button for React apps
MIT License
773 stars 129 forks source link

What is the purpose of _renderGroupedChildren? #6

Closed pickhardt closed 9 years ago

pickhardt commented 9 years ago

What's the purpose of _renderGroupedChildren?

I'm trying to include an icon in a button, so it looks like:

    <Button style={{color: 'green'}} onPress={this._handlePress}>
      <View>
        <Text>Click Me</Text>
        <Icon name="rocket" />
      </View>
    </Button>

However, Button seems to only work if you include plain text without any children, like Icon or Text.

ide commented 9 years ago

It was so that you could pass in separate strings that get coalesced into a single component. For example:

<Button>
  Increment count to {currentCount + 1}
</Button>

would create <Text>Increment count to {currentCount + 1}</Text> somewhere in the view hierarchy instead of having two Text components.