From 1dce3da39497b1dcccb268af38830c292d2eecf3 Mon Sep 17 00:00:00 2001 From: Hakan Ozkaptan <ozkaptanhakan@gmail.com> Date: Sat, 23 Nov 2019 16:15:31 +0300 Subject: [PATCH] Easiest way to component render on Toast --- lib/ToastContainer.js | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/lib/ToastContainer.js b/lib/ToastContainer.js index bd51063..362c132 100644 --- a/lib/ToastContainer.js +++ b/lib/ToastContainer.js @@ -253,13 +253,19 @@ 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> + {typeof this.props.children === 'string' ? + <Text style={[ + styles.textStyle, + props.textStyle, + props.textColor && {color: props.textColor} + ]}> + {this.props.children} + </Text> + : + <View> + {this.props.children} + </View> + } </Animated.View> </TouchableWithoutFeedback> </View> : null;