Closed saulojoab closed 1 year ago
can you instead follow the docs for the babel module resolver?
https://moti.fyi/skeleton#option-2-react-native-linear-gradient
@nandorojo Sorry, I forgot to mention on the issue: that also does not work, which is why I was importing directly.
This is my babel.config.ts:
export default {
presets: ['module:metro-react-native-babel-preset'],
plugins: [
[
'module-resolver',
{
extensions: ['.ios.js', '.android.js', '.js', '.ts', '.tsx', '.json'],
root: ['./'],
alias: {
'@': './src',
'moti/skeleton': 'moti/skeleton/react-native-linear-gradient',
},
},
],
'react-native-reanimated/plugin',
],
};
This give me this super weird Requiring unknown module "46" error.
If I remove the moti skeleton alias, everything works fine.
Restarting Metro seems to fix the 46 module error. However, It's still trying to use expo-linear-gradient:
Error: Unable to resolve module expo-linear-gradient from /Users/saulojoab/dev/eon-repos/eon/node_modules/moti/build/skeleton/expo.js: expo-linear-gradient could not be found within the project or in these directories:
can you delete node modules and clear all caches and try again? seems like the resolution isn't working
@nandorojo I tried doing that, didn't work.
nothing seems to be working lmao, I'm going insane
I also had the same issue when I tried to use the example in the docs.
@nandorojo I'm not sure this issue should have been closed.
you have to import from moti/skeleton
directly after configuring the babel config
FYI: I just gave up trying to use react-native-linear-gradient
and used the expo package instead.
The original issue that was opened here didn’t follow the docs properly which is why it got that TS error. You should still just import from moti/skeleton
. But using the expo one is a good solution too
Is there an existing issue for this?
Current Behavior
I'm trying to import the Skeleton using react-native-linear-gradient like below:
But I'm getting the following error:
Oddly enough, creating a d.ts declaration file did not work. My app does not break or anything, but the TS error is annoying.
Expected Behavior
Types should be included and no TS error should be shown.
Steps To Reproduce
Versions
Screenshots
Reproduction
Doing what I said above should throw the error.