Skip to content

Commit d4dbbea

Browse files
stydmastermoo
authored andcommitted
Make non-string value/component as title (#211)
1 parent 951b198 commit d4dbbea

File tree

1 file changed

+14
-6
lines changed

1 file changed

+14
-6
lines changed

ActionButtonItem.js

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,19 @@ export default class ActionButtonItem extends Component {
167167
textContainerStyle
168168
];
169169

170+
const title = (
171+
React.isValidElement(this.props.title) ?
172+
this.props.title
173+
: (
174+
<Text
175+
allowFontScaling={false}
176+
style={[styles.text, this.props.textStyle]}
177+
>
178+
{this.props.title}
179+
</Text>
180+
)
181+
)
182+
170183
return (
171184
<TextTouchable
172185
background={touchableBackground(
@@ -177,12 +190,7 @@ export default class ActionButtonItem extends Component {
177190
onPress={this.props.onPress}
178191
>
179192
<View style={textStyles}>
180-
<Text
181-
allowFontScaling={false}
182-
style={[styles.text, this.props.textStyle]}
183-
>
184-
{this.props.title}
185-
</Text>
193+
{title}
186194
</View>
187195
</TextTouchable>
188196
);

0 commit comments

Comments
 (0)