Skip to content

Commit

Permalink
Remove Text from Button if title is empty (#1049)
Browse files Browse the repository at this point in the history
* Remove Text from Button if title is empty

Fixes (#639 , #771 , #901) by not adding redundant `<Text/>` component with `styles.title.padding = 8` if title is empty.

* Handle empty string in title prop of Button

Without this change, `title={null}` works correctly, but `title=""` throws an exception described and resolved in following issue: facebook/react-native#13243 (comment)
This commit makes handles both `title={null}` and `title=""`.
  • Loading branch information
mohammad7t authored and xavier-villelegier committed Apr 1, 2018
1 parent 8843696 commit fa14656
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/buttons/Button.js
Expand Up @@ -92,7 +92,8 @@ class Button extends Component {
{icon}
</View>
)}
{!loading && (
{!loading &&
!!title && (
<Text
style={[
styles.title,
Expand Down

0 comments on commit fa14656

Please sign in to comment.