rilyu / teaset

A UI library for react native, provides 20+ pure JS(ES6) components, focusing on content display and action control.
MIT License
2.94k stars 481 forks source link

Error: Unable to resolve module react-native/Libraries/Animated/src/Easing from D:\working_workspace\waterproof_project\6.code\newWaterproofApp\node_modules\teaset\components\ListRow\TouchableOpacity.js: react-native/Libraries/Animated/src/Easing could not be found within the project or in these directories: #456

Open HY88883 opened 2 years ago

HY88883 commented 2 years ago

Hi! 👋

Firstly, thanks for your work on this project! 🙂

Today I used patch-package to patch teaset@0.7.5 for the project I'm working on.

Here is the diff that solved my problem:

diff --git a/node_modules/teaset/components/ListRow/TouchableOpacity.js b/node_modules/teaset/components/ListRow/TouchableOpacity.js
index 8fc32cf..a4f1fb3 100644
--- a/node_modules/teaset/components/ListRow/TouchableOpacity.js
+++ b/node_modules/teaset/components/ListRow/TouchableOpacity.js
@@ -4,7 +4,7 @@ import React, {Component} from 'react';
 import PropTypes from 'prop-types';

 import {Platform, TouchableWithoutFeedback, Animated, ViewPropTypes} from 'react-native';
-import Easing from 'react-native/Libraries/Animated/src/Easing';
+import Easing from 'react-native/Libraries/Animated/Easing';
 import flattenStyle from 'react-native/Libraries/StyleSheet/flattenStyle';

 if (Platform.constants.reactNativeVersion.major === 0 && Platform.constants.reactNativeVersion.minor < 62) {

This issue body was partially generated by patch-package.

zsswlr commented 2 years ago

这是来自QQ邮箱的假期自动回复邮件。   您好,我最近正在休假中,无法亲自回复您的邮件。我将在假期结束后,尽快给您回复。

DerekCute commented 2 years ago

I faced same issue, Hope to get right answer as soon as possible. Thanks.

champagneht commented 2 years ago

The same problem

cwj10 commented 2 years ago

Add some configuration to babel.config.js

module.exports = {
  presets: ['module:metro-react-native-babel-preset'],
  plugins: [
    [
      require.resolve('babel-plugin-module-resolver'),
      {
        extensions: ['.js', '.png'],
        alias: {
          //
          'react-native/Libraries/Animated/src/Easing': 'react-native/Libraries/Animated/Easing',
        },
      },
    ]
  ],
};