-
Notifications
You must be signed in to change notification settings - Fork 36
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
Error: Invalid Hook Call #22
Comments
Hey @shoaib2527 I don't see why is it a problem, because counter is some dummy code, you should really remove it and write your lib :) I will double check of course while upgrading to 0.67 but since it was always working before probably some local issue with renaming stuff (as I say in the docs rename script is not bulletproof) |
I have the same problem since this morning. |
@demchenkoalex It looks a problem to me because Counter is a simple example with just one state. Also I tried by just returning a Text, however results were same. |
Its working fine without using rename script. Thanks @demchenkoalex |
Okay, I will double check the script, maybe something's changed with some dependency update |
So I renamed the library to the import React, { useEffect } from 'react'
import RNButtonModule, { Counter } from 'react-native-button'
const App = () => {
useEffect(() => {
console.log(RNButtonModule)
})
return <Counter />
}
export default App Library's import * as React from 'react'
import { Button, NativeModules, StyleSheet, Text, View } from 'react-native'
export const addOne = (input: number) => input + 1
export const Counter = () => {
const [count, setCount] = React.useState(0)
return (
<View style={styles.container}>
<Text>You pressed {count} times</Text>
<Button onPress={() => setCount(addOne(count))} title='Press Me' />
</View>
)
}
const styles = StyleSheet.create({
container: {
flex: 1,
alignItems: 'center',
justifyContent: 'center',
height: 200,
},
})
export default NativeModules.RNButtonModule working good. I did some updates in the meantime maybe it was resolved itself? UPD: also tried with |
@demchenkoalex I get same issue. I found that it's because there's 2 But, I have issue that there's no hot loading when doing changes in library, it seem it reload by the changes but no effect. So, I need to do manual reload for it to take effect, still not sure what's wrong. In this case I setup my own project instead of provided example, also I did renaming with still include native. |
@willymulyana you shouldn't remove the
this one ignores one |
I'm having the same issue. |
see the post above, you should not delete that @scascar do you have |
I am on a windows machine, this is the update I made to bypass the problem:
|
Here is what I did
Got this this Error "Invalid Hook Call".
Note:
Let me know if anyone faced this issue.
Thanks in advance
The text was updated successfully, but these errors were encountered: