Skip to content
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

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

Closed
nolife08021 opened this issue Dec 19, 2019 · 25 comments
Closed

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

nolife08021 opened this issue Dec 19, 2019 · 25 comments

Comments

@nolife08021
Copy link

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}'}
   />
@ShaMan123
Copy link
Owner

what version of react-native are you on?

@nolife08021
Copy link
Author

what version of react-native are you on?

react-native: 0.59.8

@ShaMan123
Copy link
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 } = {};

@nolife08021
Copy link
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.

@ShaMan123
Copy link
Owner

ShaMan123 commented Dec 19, 2019

ios has no constants exported. for now.

@nolife08021
Copy link
Author

nolife08021 commented Dec 19, 2019

ios has no constants exported

my bad, that was a stupid question.

@ShaMan123
Copy link
Owner

try this, it's better:

export const { Constants } = UIManager.getViewManagerConfig ? UIManager.getViewManagerConfig(nativeViewName) : UIManager[nativeViewName];

@ShaMan123
Copy link
Owner

reinstall to version 3.4.5

@ShaMan123
Copy link
Owner

ShaMan123 commented Dec 19, 2019

ios has no constants exported

my bad, that was a stupid question.

Not at all. In future releaseד it will have

@ShaMan123
Copy link
Owner

please reply that all is working, including #18

@nolife08021
Copy link
Author

After I reinstall to version 3.4.5

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

@ShaMan123
Copy link
Owner

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

@nolife08021
Copy link
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)

@ShaMan123
Copy link
Owner

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

 console.log(UIManager.getViewManagerConfig)

@ShaMan123
Copy link
Owner

ShaMan123 commented Dec 20, 2019

changing to this should work

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

make sure it does and I'll bump the version

@nolife08021
Copy link
Author

After Changing it, I received this
Invariant Violation: requireNativeComponent: "RNMathView" was not found in the UIManager.

Is it because I using the Expo?

@nolife08021
Copy link
Author

line 13:

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

Not able to comment it, because of line 121:
MathViewWrapper.Constants = ControlledMathView.Constants = Constants;

But after I replace it with
export const { Constants } = UIManager.getViewManagerConfig(nativeViewName) || {};

It will show another error Invariant Violation: requireNativeComponent: "RNMathView" was not found in the UIManager.

**I'm not sure that it solved the Constants issue or not.

@ShaMan123
Copy link
Owner

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

@nolife08021
Copy link
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?

@ShaMan123
Copy link
Owner

ShaMan123 commented Dec 20, 2019

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';

@ShaMan123 ShaMan123 pinned this issue Dec 22, 2019
Repository owner deleted a comment from nolife08021 Apr 2, 2020
Repository owner deleted a comment from nolife08021 Apr 2, 2020
Repository owner deleted a comment from nolife08021 Apr 2, 2020
Repository owner deleted a comment from nolife08021 Apr 2, 2020
@ShaMan123 ShaMan123 unpinned this issue May 15, 2020
@Youssouf-Ouedraogo
Copy link

@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

@anback
Copy link

anback commented Nov 21, 2020

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"]
    }

@ShaMan123
Copy link
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?

@ghost
Copy link

ghost commented Jan 19, 2022

It's not because of expo, I'm getting it now too

@manuelg04
Copy link

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
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants