iran-react-community / rn-dominant-color

Library to extract the dominant colors from an image in React Native both android and ios!
MIT License
54 stars 15 forks source link

[BUG] null is not an object (evaluating 'RNDominantColor.getColorFromURL') #10

Open wobsoriano opened 4 years ago

wobsoriano commented 4 years ago

Trying to test in both bare and managed workflow expo app with RN v0.62.2. Happens in both ios and android.

Code:

getColorFromURL('https://randomuser.me/api/portraits/men/37.jpg')
        .then((colors) => {
          console.log(colors.primary);
        })
        .catch((err) => {
          console.log(err);
        });

Got this error:

null is not an object (evaluating 'RNDominantColor.getColorFromURL')
- node_modules/rn-dominant-color/index.js:9:21 in Promise$argument_0
- node_modules/promise/setimmediate/core.js:45:6 in tryCallTwo
- node_modules/promise/setimmediate/core.js:200:22 in doResolve
- node_modules/promise/setimmediate/core.js:66:11 in Promise
- node_modules/rn-dominant-color/index.js:8:11 in getColorFromURL
- node_modules/react-native/Libraries/Core/Timers/JSTimers.js:135:14 in _callTimer
- node_modules/react-native/Libraries/Core/Timers/JSTimers.js:387:16 in callTimers
- node_modules/react-native/Libraries/BatchedBridge/MessageQueue.js:425:19 in __callFunction
- node_modules/react-native/Libraries/BatchedBridge/MessageQueue.js:112:6 in __guard$argument_0
- node_modules/react-native/Libraries/BatchedBridge/MessageQueue.js:373:10 in __guard
- node_modules/react-native/Libraries/BatchedBridge/MessageQueue.js:111:4 in callFunctionReturnFlushedQueue
* [native code]:null in callFunctionReturnFlushedQueue
patpij2 commented 4 years ago

I also have this issue

Screenshot 2020-08-16 at 00 34 44

Screenshot 2020-08-16 at 00 35 15

wobsoriano commented 4 years ago

Related to these issues

https://github.com/facebook/react-native/issues/26813 https://github.com/facebook/react-native/issues/29228

CharliBregnballe commented 3 years ago

I am getting the same error. Did any of you find a solution to this?

patpij2 commented 3 years ago

I am getting the same error. Did any of you find a solution to this?

Unfortunately not :(

CharliBregnballe commented 3 years ago

Ah alright. Did you go with another solution? Or?

davidtoluhi commented 3 years ago

@CharliBregnballe I experienced the same issue, and upon a bit of investigation, it turns out react native did not auto-link (despite having RN version 0.60), so I ran npx react-native link rn-dominant-color to link it manually, and voila! everything works fine. It may not help, but I just thought I'd share.

matinzd commented 3 years ago

We are trying to refactor the whole project.

Thanks for your patient.