diff --git a/lib/Toast.js b/lib/Toast.js index f765306..107b197 100644 --- a/lib/Toast.js +++ b/lib/Toast.js @@ -14,12 +14,7 @@ class Toast extends Component { static durations = durations; static show = (message, options = {position: positions.BOTTOM, duration: durations.SHORT}) => { - return new RootSiblings( - {message} - ); + return new RootSiblings(); }; static hide = toast => { diff --git a/lib/ToastContainer.js b/lib/ToastContainer.js index 88872a2..c31e4c5 100644 --- a/lib/ToastContainer.js +++ b/lib/ToastContainer.js @@ -64,6 +64,8 @@ class ToastContainer extends Component { static propTypes = { ...ViewPropTypes, containerStyle: ViewPropTypes.style, + message: PropTypes.string, + component: PropTypes.element, duration: PropTypes.number, visible: PropTypes.bool, position: PropTypes.number, @@ -236,24 +238,26 @@ class ToastContainer extends Component { style={[ styles.containerStyle, { marginHorizontal: windowWidth * ((1 - TOAST_MAX_WIDTH) / 2) }, - props.containerStyle, props.backgroundColor && {backgroundColor: props.backgroundColor}, - { - opacity: this.state.opacity - }, + props.containerStyle, + { opacity: this.state.opacity }, props.shadow && styles.shadowStyle, props.shadowColor && {shadowColor: props.shadowColor} ]} pointerEvents="none" ref={ele => this._root = ele} > - - {this.props.children} - + {this.props.component ? ( + this.props.component + ) : ( + + {this.props.message} + + )} : null;