osamaqarem/react-native-image-colors

I introduced getColors in the RN project and got an undefined

Closed this issue · 4 comments

Bug

Environment info

Library Version
react-native-image-colors 2.4.0
react-native 0.72.5

Steps To Reproduce

1.import { getColors } from 'react-native-image-colors';
2.
const image = require('../assets/placeholder2000x2000.jpg')

const src = 'https://img0.baidu.com/it/u=1934875822,4119553331&fm=253&fmt=auto&app=138&f=JPEG?w=720&h=480'
const base = 'data:image/jpeg;base64...'

export function ImageColors() {
const scrollRef = React.useRef(null);

return (
<View style={{width: '100%', height: '100%', backgroundColor: '#222'}}>
<Button title='image1' onPress={() => getColors(image)}>
<Button title='image2' onPress={() => getColors(src)}>
<Button title='image3' onPress={() => getColors(base)}>
<Image
source={require('../assets/image3.jpg')}
/>

);
}
3. Cannot read property ‘NativeModule’ of undefined

Describe what you expected to happen:

  1. The code 'onPress={() => getColors(image)}' works fine

Reproducible sample code

I also have the same error

It works on version 1.5.2. Please give it a try.

Have you configured the expo package as per requirements?

I just re-tested the library using React Native 74/Expo 51. Please make sure to follow the installation instructions in the readme. Please re-open the issue if you did so and the problem persisted.