【问题标题】:Attempted import error: 'EasingNode' is not exported from 'react-native-reanimated'尝试导入错误:“EasingNode”未从“react-native-reanimated”导出
【发布时间】:2020-12-06 01:39:11
【问题描述】:

我在我的 expo 应用程序中使用 @react-navigation/stack 并且一切正常。我想开始向我的应用程序添加标签/抽屉导航,并在尝试导入时继续遇到以下 2 个错误

import { createMaterialBottomTabNavigator } from '@react-navigation/material-bottom-tabs';
import { createMaterialTopTabNavigator } from '@react-navigation/material-top-tabs';
Attempted import error: 'EasingNode' is not exported from 'react-native-reanimated'.

Attempted import error: 'Appearance' is not exported from 'react-native-web/dist/index'.

以下是我的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": {
    "@react-native-community/async-storage": "^1.11.0",
    "@react-native-community/masked-view": "0.1.10",
    "@react-navigation/material-bottom-tabs": "^5.2.16",
    "@react-navigation/material-top-tabs": "^5.2.16",
    "@react-navigation/native": "^5.7.3",
    "@react-navigation/stack": "^5.9.0",
    "@reduxjs/toolkit": "^1.4.0",
    "expo": "~38.0.8",
    "expo-status-bar": "^1.0.2",
    "react": "~16.11.0",
    "react-dom": "~16.11.0",
    "react-native": "https://github.com/expo/react-native/archive/sdk-38.0.2.tar.gz",
    "react-native-elements": "^2.2.1",
    "react-native-gesture-handler": "~1.6.0",
    "react-native-paper": "^4.0.1",
    "react-native-reanimated": "~1.9.0",
    "react-native-safe-area-context": "~3.0.7",
    "react-native-screens": "~2.9.0",
    "react-native-tab-view": "^2.15.1",
    "react-native-web": "~0.11.7",
    "react-redux": "^7.2.1",
    "redux": "^4.0.5"
  },
  "devDependencies": {
    "@babel/core": "^7.8.6",
    "babel-preset-expo": "~8.1.0"
  },
  "private": true
}

我已经创建了一个全新的 expo 应用程序来解决这个问题 - 但是一旦我导入底部/顶部选项卡导航器,我仍然会碰壁。知道如何解决这个问题吗?

【问题讨论】:

  • 应用程序还能编译/运行吗?我收到了同样的警告,但我仍然可以使用选项卡导航器,并且该应用程序仍然可以正常编译和运行。
  • 任何解决方法?

标签: react-native react-navigation react-native-ios react-navigation-stack react-navigation-v5


【解决方案1】:

react-native-paper 降级为4.0.0-alpha.1 解决了我的问题。 expo@38.0.0 似乎与 react-native-paper@^4.0.1 不兼容。

【讨论】:

    【解决方案2】:

    node_modules\react-native-floating-label-input\src\index.tsx

    import Animated, { EasingNode, timing, interpolateColors } from 'react-native-reanimated';
    

    用以下内容替换文件,它将被修复。

    import Animated, { Easing as EasingNode, timing, interpolateColors } from 'react-native-reanimated';
    

    【讨论】:

    • 您的答案可以通过额外的支持信息得到改进。请edit 添加更多详细信息,例如引用或文档,以便其他人可以确认您的答案是正确的。你可以找到更多关于如何写好答案的信息in the help center
    猜你喜欢
    • 2019-06-06
    • 1970-01-01
    • 2021-02-13
    • 1970-01-01
    • 1970-01-01
    • 2019-10-24
    • 2021-10-20
    • 2019-12-19
    • 2023-03-11
    相关资源
    最近更新 更多