Closed power-f-GOD closed 3 years ago
Try reproducing this on expo snack maybe?
Did you follow the instructions to install reanimated 2? Is the Babel plugin setup?
I missed the code on first read here, let's see
Could you see if you can reproduce this on expo snack? I'm not sure why this would happen other than issues with installing reanimated v2 properly and using the latest version or Moti...
Which platform is this? And are you using expo?
Try reproducing this on expo snack maybe?
Did you follow the instructions to install reanimated 2? Is the Babel plugin setup?
Yeah. Here's my babel.config.js
const path = require('path');
module.exports = function (api) {
api.cache(true);
return {
presets: ['babel-preset-expo'],
plugins: [
[
'module-resolver',
{
root: ['./'],
alias: {
src: './src'
}
}
],
'react-native-reanimated/plugin'
]
};
};
And yes, I'm using Expo.
Alright. I'll try reproducing on Snack.
Which versions are you using?
Psst! Turns out Snack doesn't support TypeScript!
Versions? Humm...
My package.json...
{
"main": "node_modules/expo/AppEntry.js",
"scripts": {
"start": "expo start",
"android": "expo start --android",
"ios": "expo start --ios",
"web": "expo start --web",
"eject": "expo eject"
},
"dependencies": {
"@expo-google-fonts/poppins": "^0.2.0",
"@react-navigation/native": "^6.0.1",
"@react-navigation/native-stack": "^6.0.1",
"@react-navigation/stack": "^6.0.1",
"expo": "^42.0.3",
"expo-app-loading": "^1.1.2",
"expo-font": "~9.2.1",
"expo-secure-store": "~10.2.0",
"expo-status-bar": "~1.0.3",
"hermes-engine": "^0.8.1",
"moti": "^0.11.0",
"react": "16.13.1",
"react-dom": "16.13.1",
"react-native": "https://github.com/expo/react-native/archive/sdk-40.0.1.tar.gz",
"react-native-gesture-handler": "~1.10.2",
"react-native-reanimated": "~2.2.0",
"react-native-screens": "~3.4.0",
"react-native-web": "^0.17.1",
"react-redux": "^7.2.4",
"redux": "^4.1.1",
"redux-thunk": "^2.3.0"
},
"devDependencies": {
"@babel/core": "^7.9.0",
"@types/react": "~16.9.35",
"@types/react-dom": "~16.9.8",
"@types/react-native": "~0.63.2",
"typescript": "~4.0.0"
},
"private": true
}
My index or (ideally App).js
import 'react-native-gesture-handler';
import { NavigationContainer, DefaultTheme } from '@react-navigation/native';
import { createNativeStackNavigator } from '@react-navigation/native-stack';
import React, { FC, useEffect } from 'react';
// import { StyleSheet, Platform, StatusBar, View } from 'react-native';
import { connect } from 'react-redux';
import { AuthProps } from 'src/types';
import { Login, Splash, Register, Home } from 'src/screens';
import { dispatch } from 'src/state/store';
import { auth } from 'src/state/actions';
const Stack = createNativeStackNavigator();
const _App: FC<{ auth: AuthProps }> = ({ auth: _auth }) => {
const { authenticated, status: authStatus } = _auth;
useEffect(() => {
setTimeout(() => {
dispatch(auth({ status: 'fulfilled' }));
}, 2000);
}, []);
// if (authStatus !== 'fulfilled') {
// return <Splash />;
// }
return (
<NavigationContainer>
<Stack.Navigator>
{(() => {
if (authStatus !== 'fulfilled') {
return (
<Stack.Screen
name='Splash'
component={Splash}
options={{
// animation: 'none',
headerShown: false
// statusBarAnimation: 'none'
// animationTypeForReplace: 'push'
}}
/>
);
} else if (!authenticated) {
return (
<>
<Stack.Screen
name='Login'
component={Login}
options={{
headerShown: false,
animation: 'none'
}}
/>
<Stack.Screen name='Register' component={Register} />
</>
);
} else {
return (
<>
<Stack.Screen name='Home' component={Home} />
</>
);
}
})()}
</Stack.Navigator>
</NavigationContainer>
);
};
export default connect((state: { auth: AuthProps }) => ({ auth: state.auth }))(
_App
);
Can you just reproduce it on snack? Moti works on snack
Could there be an issue with using Moti inside of a Stack? 'cause it seems like whenever I remove MotiView from the two screens (Splash and Login), the errors cease.
Psst! Turns out Snack doesn't support TypeScript!
Versions? Humm...
My package.json...
{ "main": "node_modules/expo/AppEntry.js", "scripts": { "start": "expo start", "android": "expo start --android", "ios": "expo start --ios", "web": "expo start --web", "eject": "expo eject" }, "dependencies": { "@expo-google-fonts/poppins": "^0.2.0", "@react-navigation/native": "^6.0.1", "@react-navigation/native-stack": "^6.0.1", "@react-navigation/stack": "^6.0.1", "expo": "^42.0.3", "expo-app-loading": "^1.1.2", "expo-font": "~9.2.1", "expo-secure-store": "~10.2.0", "expo-status-bar": "~1.0.3", "hermes-engine": "^0.8.1", "moti": "^0.11.0", "react": "16.13.1", "react-dom": "16.13.1", "react-native": "https://github.com/expo/react-native/archive/sdk-40.0.1.tar.gz", "react-native-gesture-handler": "~1.10.2", "react-native-reanimated": "~2.2.0", "react-native-screens": "~3.4.0", "react-native-web": "^0.17.1", "react-redux": "^7.2.4", "redux": "^4.1.1", "redux-thunk": "^2.3.0" }, "devDependencies": { "@babel/core": "^7.9.0", "@types/react": "~16.9.35", "@types/react-dom": "~16.9.8", "@types/react-native": "~0.63.2", "typescript": "~4.0.0" }, "private": true }
I mentioned earlier that TypeScript doesn't work on there, so I cannot reproduce there.
Just ignore the typescript errors on snack, it still works
Oh. Ok. I'll try again.
I'll just forego doing so for now. Time is against me.
I'll get back to it when I'm, probably, done with project.
Kindly leave the issue open.
Thanks so much for your time.
I'll reopen if there's activity, since there's no reproduction or actionable thing I can do to help
Alright.
Ok. I just fixed it. Found a similar issue: https://github.com/software-mansion/react-native-reanimated/issues/1245#issuecomment-694664417
All I needed do was to clear expo cache on start with expo start --clear
as the reanimated plugin wasn't picked up (after I added it) in my babel.config.js
. I'm so happy now. I can now use Moti!😎 Thank you! 🙌🏼
I was also having the same issue. Clearing expo cache on start with expo start --clear
solved it.
I was also having the same issue. Clearing expo cache on start with expo start --clear solved it.
Trying to use MotiView causes the following error...
What could I be doing wrong?
My code: