Closed Anyamborogass closed 1 year ago
+1 getting same with react native CLI "dependencies": { "moti": "^0.20.0", "react": "18.1.0", "react-native": "0.70.2", "react-native-gesture-handler": "^2.7.0", "react-native-reanimated": "^2.10.0" }
Getting the same error when trying to use MotiView in expo.
Also getting this type error:
TypeError: null is not an object (evaluating 'dispatcher.useContext')
This error is located at:
in Moti (created by DetailDescription)
in RCTView (created by View)
in View
in View (created by Card)
in Card (created by Card)
in forwardRef (created by Card)
in Card (created by Card)
in forwardRef (created by DetailDescription)
in DetailDescription (created by EventDetail)
"moti": "^0.20.0" "react": "18.0.0" "expo": "~46.0.13" "react-native": "0.69.6" "react-native-reanimated": "~2.9.1"
Please try this solution, replacing the version with react 18
https://github.com/nandorojo/moti/issues/189#issuecomment-1095085789
Worked like a charm!! Amazing thanks!
Is there an existing issue for this?
Current Behavior
I created a new Expo project to play with different animations (npx create-expo-app my-app), and I installed react-native-reanimated and moti (npx expo install react-native-reanimated moti). When I import it I get no problem, but when I want to do a simple animation I get an Error and the app crashes.
ERROR Warning: Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:
This error is located at: in Moti (created by App) in RCTView (created by View) in View (created by AnimatedComponent) in AnimatedComponent in AnimatedComponentWrapper (created by TouchableOpacity) in TouchableOpacity (created by TouchableOpacity) in TouchableOpacity (created by App) in RCTView (created by View) in View in SafeAreaView (created by App) in App (created by ExpoRoot) in ExpoRoot in RCTView (created by View) in View (created by AppContainer) in RCTView (created by View) in View (created by AppContainer) in AppContainer in main(RootComponent) ERROR TypeError: null is not an object (evaluating 'dispatcher.useContext')
Expected Behavior
No response
Steps To Reproduce
Versions
Screenshots
No response
Reproduction
import 'react-native-reanimated'; import 'react-native-gesture-handler'; import { useReducer} from 'react'; import { StyleSheet, Text, SafeAreaView, TouchableOpacity } from 'react-native'; import { StatusBar } from 'expo-status-bar'; import { MotiView } from 'moti';
export default function App() { const [visible, toggle] = useReducer((s) => !s, true)
return (
); }
const styles = StyleSheet.create({ ... })