Skip to content
This repository was archived by the owner on Sep 5, 2024. It is now read-only.
This repository was archived by the owner on Sep 5, 2024. It is now read-only.

null is not an object (UIManager$getViewMan.Constants) -Android #19

Closed

Description

@nolife08021

null is not an object (evaluating '_UIManager$getViewMan.Constant)

from line:13-> react-native-math-view/src/android/MathView.tsx

Platform: Android
"react-native-math-view": "^3.4.3",

<MathView
      style={{ex: 50, em:50}}
      color='white'
      math={'x=\\frac{-b\\pm\\sqrt{b^2-4ac}}{2a}'}
   />

Activity

  1. ShaMan123 commented on Dec 19, 2019

    @ShaMan123
    Owner

    what version of react-native are you on?

  2. nolife08021 commented on Dec 19, 2019

    @nolife08021
    Author

    what version of react-native are you on?

    react-native: 0.59.8

  3. ShaMan123 commented on Dec 19, 2019

    @ShaMan123
    Owner

    that's it I believe.
    You can upgrade but it is really unnecessary. Try the following:

    -export const { Constants } = UIManager.getViewManagerConfig(nativeViewName);
    +export const { Constants } = UIManager[nativeViewName];

    or even

    -export const { Constants } = UIManager.getViewManagerConfig(nativeViewName);
    +export const { Constants } = {};
  4. nolife08021 commented on Dec 19, 2019

    @nolife08021
    Author

    that's it I believe.
    You can upgrade but it is really unnecessary. Try the following:

    -export const { Constants } = UIManager.getViewManagerConfig(nativeViewName);
    +export const { Constants } = UIManager[nativeViewName];

    or even

    -export const { Constants } = UIManager.getViewManagerConfig(nativeViewName);
    +export const { Constants } = {};

    Okay. I will try it.

  5. ShaMan123 commented on Dec 19, 2019

    @ShaMan123
    Owner

    ios has no constants exported. for now.

  6. nolife08021 commented on Dec 19, 2019

    @nolife08021
    Author

    ios has no constants exported

    my bad, that was a stupid question.

  7. ShaMan123 commented on Dec 19, 2019

    @ShaMan123
    Owner

    try this, it's better:

    export const { Constants } = UIManager.getViewManagerConfig ? UIManager.getViewManagerConfig(nativeViewName) : UIManager[nativeViewName];
    
  8. ShaMan123 commented on Dec 19, 2019

    @ShaMan123
    Owner

    reinstall to version 3.4.5

  9. ShaMan123 commented on Dec 19, 2019

    @ShaMan123
    Owner

    ios has no constants exported

    my bad, that was a stupid question.

    Not at all. In future releaseד it will have

  10. ShaMan123 commented on Dec 19, 2019

    @ShaMan123
    Owner

    please reply that all is working, including #18

  11. nolife08021 commented on Dec 19, 2019

    @nolife08021
    Author

    After I reinstall to version 3.4.5

    The error becomes -> null is not an object (evaluating '_ref.Constant')

  12. ShaMan123 commented on Dec 19, 2019

    @ShaMan123
    Owner

    I am a bit puzzled. but it is not breaking so. reinstall 3.4.7.

  13. nolife08021 commented on Dec 19, 2019

    @nolife08021
    Author

    I am a bit puzzled. but it is not breaking so. reinstall 3.4.7.

    The error still remaining after reinstall to 3.4.7

    null is not an object (evaluating '_ref.Constants)

  14. ShaMan123 commented on Dec 19, 2019

    @ShaMan123
    Owner

    run this, I want to check if it's null.

     console.log(UIManager.getViewManagerConfig)
    
  15. ShaMan123 commented on Dec 20, 2019

    @ShaMan123
    Owner

    changing to this should work

    export const { Constants } = UIManager.getViewManagerConfig(nativeViewName) || {};
    

    make sure it does and I'll bump the version

  16. 2 remaining items

  17. ShaMan123 commented on Dec 20, 2019

    @ShaMan123
    Owner

    RN 0.59 doesn't do automatic linking.
    You need to link the package.

  18. nolife08021 commented on Dec 20, 2019

    @nolife08021
    Author

    react-native link react-native-math-view

    Is there any way that I can perform the linking in expo without using ejecting to ExpoKit?

  19. ShaMan123 commented on Dec 20, 2019

    @ShaMan123
    Owner

    Native modules aren't supported in expo.
    You can render the fallback component which is based on react-native-svg. This is likely to affect performance.

    import MathViewFallback from 'react-native-math-view/src/fallback';
    
  20. pinned this issue on Dec 22, 2019
  21. Repository owner deleted a comment from nolife08021 on Apr 2, 2020
  22. Repository owner deleted a comment from nolife08021 on Apr 2, 2020
  23. Repository owner deleted a comment from nolife08021 on Apr 2, 2020
  24. Repository owner deleted a comment from nolife08021 on Apr 2, 2020
  25. unpinned this issue on May 15, 2020
  26. Youssouf-Ouedraogo commented on Aug 6, 2020

    @Youssouf-Ouedraogo

    @noli

    react-native link react-native-math-view

    Is there any way that I can perform the linking in expo without using ejecting to ExpoKit?

    Did you figure out a way to get it to work in an expo project without ejecting your project? If so, I would greatly appreciate your help. I am getting the same issue

  27. anback commented on Nov 21, 2020

    @anback

    If you are like me and ended up with 400 ts errors when importing this module in typescript then here is the solution:

    create a types/index.d.ts :

    declare module 'react-native-math-view/src/fallback'
    
    declare module 'react-native-math-view/src/android' {
      export type MathViewProps = any
    }
    

    and in tsconfig.json add a path in compilerOptions:

        "paths": {
          "react-native-math-view/src/fallback": ["types"],
          "react-native-math-view/src/android": ["types"]
        }
    
  28. ShaMan123 commented on Nov 24, 2020

    @ShaMan123
    Owner

    If you are like me and ended up with 400 ts errors when importing this module in typescript then here is the solution:

    create a types/index.d.ts :

    declare module 'react-native-math-view/src/fallback'
    
    declare module 'react-native-math-view/src/android' {
      export type MathViewProps = any
    }
    

    and in tsconfig.json add a path in compilerOptions:

        "paths": {
          "react-native-math-view/src/fallback": ["types"],
          "react-native-math-view/src/android": ["types"]
        }
    

    Does this happen on Expo?

  29. manuelg04 commented on Apr 20, 2024

    @manuelg04

    ERROR Invariant Violation: requireNativeComponent: "RNMathView" was not found in the UIManager.

    any solutions?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions