Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 20 additions & 7 deletions lib/ToastContainer.js
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,25 @@ class ToastContainer extends Component {
bottom: keyboardHeight
};

let toastChildContent
// if the passed content is string then use Text to render
// other wise use view
// Passed view will have its own style.
if(typeof this.props.children === 'string'){
toastChildContent = <Text style={[
styles.textStyle,
props.textStyle,
props.textColor && {color: props.textColor}
]}>
{this.props.children}
</Text>
}else{
// passed component can have their own style.
toastChildContent = <View>
{this.props.children}
</View>
}

return (this.state.visible || this._animating) ? <View
style={[
styles.defaultStyle,
Expand Down Expand Up @@ -255,13 +274,7 @@ class ToastContainer extends Component {
pointerEvents="none"
ref={ele => this._root = ele}
>
<Text style={[
styles.textStyle,
props.textStyle,
props.textColor && {color: props.textColor}
]}>
{this.props.children}
</Text>
{toastChildContent}
</Animated.View>
</TouchableWithoutFeedback>
</View> : null;
Expand Down