From e76833900a31e37e013a5f67cfe4b58be3dba55e Mon Sep 17 00:00:00 2001 From: Pavan Tiwari Date: Sun, 10 May 2020 13:16:27 -0700 Subject: [PATCH 1/2] Adding support for rendering React component Current ToastContainer.js class can only render Text elements We can use View as a container if the child is not a text to render react component. --- lib/ToastContainer.js | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/lib/ToastContainer.js b/lib/ToastContainer.js index a645d4d..e44f55b 100644 --- a/lib/ToastContainer.js +++ b/lib/ToastContainer.js @@ -227,6 +227,24 @@ class ToastContainer extends Component { bottom: keyboardHeight }; + let toastChildContent + // if the passed content is string then use Text to render + // other wise use view + if(typeof this.props.children === 'string'){ + toastChildContent = + {this.props.children} + + }else{ + // passed component can have their own style. + toastChildContent = + {this.props.children} + + } + return (this.state.visible || this._animating) ? this._root = ele} > - - {this.props.children} - + {toastChildContent} : null; From f4b05f16dc545ba5e5799be45eaf3d5bf2b1d88a Mon Sep 17 00:00:00 2001 From: Pavan Tiwari Date: Sat, 6 Jun 2020 13:30:21 -0700 Subject: [PATCH 2/2] Update ToastContainer.js --- lib/ToastContainer.js | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/ToastContainer.js b/lib/ToastContainer.js index e44f55b..aef4b05 100644 --- a/lib/ToastContainer.js +++ b/lib/ToastContainer.js @@ -230,6 +230,7 @@ class ToastContainer extends Component { 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 =