Skip to content

null is not an object(evaluting '_this._root_setNativeProps') #24

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
combing520 opened this issue Mar 20, 2017 · 2 comments
Open

null is not an object(evaluting '_this._root_setNativeProps') #24

combing520 opened this issue Mar 20, 2017 · 2 comments

Comments

@combing520
Copy link

null is not an object(evaluting '_this._root_setNativeProps') ,当按下 回退键(android)的就会出现该错误。我的 RN 版本为 0.42

@zhaogao
Copy link

zhaogao commented Apr 7, 2017

在源文件中改下代码就好了, 在lib/ToastContainer.js 128行
componentWillUnmount = () => {
this._root&&this._hide();
};

fatimaranile pushed a commit to fatimaranile/react-native-root-toast that referenced this issue Aug 4, 2017
fatimaranile pushed a commit to fatimaranile/react-native-root-toast that referenced this issue Aug 4, 2017
mranile added a commit to mranile/react-native-root-toast that referenced this issue Aug 4, 2017
kbaylosis added a commit to kbaylosis/react-native-root-toast that referenced this issue Aug 4, 2017
eeynard added a commit to eeynard/react-native-root-toast that referenced this issue Aug 8, 2017
@dannyhw
Copy link

dannyhw commented Jul 19, 2023

Was getting this when running on react native web and heres the relevant part of the patch I'm using

     componentWillUnmount = () => {
-        this._hide();
+        this._root && this._hide();
         this.dimensionListener?.remove();
         this.keyboardListener?.remove();
     };
@@ -172,9 +174,11 @@ class ToastContainer extends Component {
         if (!this._animating) {
             clearTimeout(this._hideTimeout);
             this._animating = true;
-            this._root.setNativeProps({
+            if(this._root && this._root.setNativeProps){
+              this._root.setNativeProps({
                 pointerEvents: 'auto'
-            });
+              });
+            }
             this.props.onShow && this.props.onShow(this.props.siblingManager);
             Animated.timing(this.state.opacity, {
                 toValue: this.props.opacity,
@@ -197,7 +201,7 @@ class ToastContainer extends Component {
         clearTimeout(this._showTimeout);
         clearTimeout(this._hideTimeout);
         if (!this._animating) {
-            if (this._root) {
+            if (this._root && this._root.setNativeProps) {
                 this._root.setNativeProps({
                     pointerEvents: 'none'
                 });

basically just a check around every setNativeProps

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants