Warning: isMounted(…) is deprecated in plain Javascript Classes

前端 未结 11 1010
庸人自扰
庸人自扰 2020-12-29 03:20

I am implementing 2 screens using react-navigation. But I got the warning below while navigating to the second page:

Warning: isMounted(...) is deprec

相关标签:
11条回答
  • 2020-12-29 03:37

    Is is actually a React-Native issue

    You can wait and check when a fix is available here: https://github.com/facebook/react-native/issues/18868

    Or in the meantime you can hide the warning like suggested.

    0 讨论(0)
  • 2020-12-29 03:37

    The following solution works for me:

    import { YellowBox } from 'react-native';
    YellowBox.ignoreWarnings(['Warning: isMounted(...) is deprecated', 'Module RCTImageLoader']);
    
    0 讨论(0)
  • This is not from react-navigation as i looked into the node_modules and react-navigation doesn't use isMounted, Its coming from somewhere within React-Native, I have also done same hack used by @Romsun

        import { YellowBox } from 'react-native';
    YellowBox.ignoreWarnings(['Warning: isMounted(...) is deprecated', 'Module RCTImageLoader']);
    
    0 讨论(0)
  • react-navigation issue is now closed, you can look here

    They are stating that it is a problem somewhere inside of react-native

    0 讨论(0)
  • 2020-12-29 03:43

    If you are using an expo client, update your version to expo@27.0.2 which fixes this warning. . .

    0 讨论(0)
提交回复
热议问题