reactjs - undefined 不是对象(评估 '_reactNative.Animated.Text.propTypes.style')
问题描述
将 react-native 版本升级到0.63.0时遇到此错误。我搜索了这个错误,但根据其他来源,它要么是 react-native-material-dropdown 中的问题,要么是 react-native-material-textfield 中的问题。我也尝试在 node_modules 中查找 Animated.Text.propTypes 但它不存在。虽然我在 ios 文件夹的 main.bundle.js 中找到了它。我的 Pod 文件如下:
require_relative '../node_modules/react-native/scripts/react_native_pods'
require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'
platform :ios, '10.0'
target 'Project_name' do
permissions_path = '../node_modules/react-native-permissions/ios'
pod 'RNVectorIcons', :path => '../node_modules/react-native-vector-icons'
pod 'Permission-Camera', :path => "#{permissions_path}/Camera.podspec"
config = use_native_modules!
use_react_native!(:path => config["reactNativePath"])
use_flipper!
post_install do |installer|
flipper_post_install(installer)
end
end
Package.json 文件如下:
{
"name": "Project_name",
"version": "0.0.1",
"private": true,
"scripts": {
"android": "react-native run-android",
"ios": "react-native run-ios",
"start": "react-native start",
"test": "jest",
"lint": "eslint ."
},
"dependencies": {
"@react-native-community/async-storage": "^1.12.0",
"@react-native-community/datetimepicker": "^3.0.1",
"@react-native-community/masked-view": "^0.1.10",
"@react-navigation/native": "^5.7.3",
"@react-navigation/stack": "^5.9.0",
"accordion-collapse-react-native": "^0.3.2",
"axios": "^0.20.0",
"date-fns": "^2.16.1",
"debounce": "^1.2.0",
"fetch-timeout": "0.0.2",
"http": "0.0.1-security",
"https": "^1.0.0",
"install": "^0.13.0",
"lodash": "^4.17.20",
"moment": "^2.27.0",
"native-base": "^2.13.14",
"npm": "^6.14.8",
"react": "16.13.1",
"react-native": "0.63.2",
"react-native-af-video-player": "^0.2.1",
"react-native-asset-library-to-base64": "^1.1.0",
"react-native-autocomplete-input": "^4.2.0",
"react-native-aws3": "0.0.9",
"react-native-background-upload": "^6.1.0",
"react-native-beautiful-video-recorder": "^2.0.1",
"react-native-camera": "^3.38.0",
"react-native-check-box": "^2.1.7",
"react-native-checkbox": "^2.0.0",
"react-native-cookies": "^3.3.0",
"react-native-datepicker": "^1.7.2",
"react-native-device-info": "^6.0.1",
"react-native-dropdown-picker": "^3.6.8",
"react-native-event-listeners": "^1.0.7",
"react-native-fs": "^2.16.6",
"react-native-gallery-manager": "^1.0.9",
"react-native-gesture-handler": "^1.7.0",
"react-native-image-picker": "^2.3.3",
"react-native-keep-awake": "^4.0.0",
"react-native-keyboard-aware-scroll-view": "^0.9.2",
"react-native-keychain": "^6.1.1",
"react-native-material-buttons": "^0.6.0",
"react-native-modal-datetime-picker": "^8.9.3",
"react-native-modal-dropdown": "^0.6.2",
"react-native-navybits-date-time-picker": "^1.2.3",
"react-native-permissions": "^2.2.0",
"react-native-reanimated": "^1.13.0",
"react-native-safe-area-context": "^3.1.7",
"react-native-screens": "^2.10.1",
"react-native-stopwatch-timer": "0.0.21",
"react-native-touch-id": "^4.4.1",
"react-native-video": "^5.1.0-alpha8",
"react-native-video-editor": "^0.2.0",
"react-native-walkthrough-tooltip": "^1.1.10",
"react-navigation": "^4.4.0",
"realm": "^6.1.0"
},
"devDependencies": {
"@babel/core": "7.11.5",
"@babel/runtime": "7.11.2",
"@react-native-community/eslint-config": "1.1.0",
"babel-jest": "25.5.1",
"eslint": "6.8.0",
"jest": "25.5.4",
"metro-react-native-babel-preset": "0.59.0",
"react-test-renderer": "16.13.1"
},
"jest": {
"preset": "react-native"
}
}
解决方案
任何遭受这个噩梦的人都是 react-native-material-button 导致了这个问题。事实证明,vs code 并没有完全搜索节点模块。
推荐阅读
- javascript - 使用 Promise 将数组变量传递给下一个函数的问题
- kubernetes - 不同集群中的 Airflow Kubernetes / DAG
- unity3d - Unity Wegl 在 GitHub 页面中停留在 90%,但在本地运行良好
- graphql - GraphQL - 定义类型
- python - 使用时间序列进行预测的多变量和多步 LSTM 模型
- amazonsellercentral - 为什么亚马逊营销报告终端节点返回一个空的报告文件?
- hl7-fhir - Synthea 名称通常以数字结尾吗
- swiftui - 全屏视图上的 SwiftUI 确认对话框?
- python - QStackedWidget 窗口通信
- sql - 为什么strpos, position, charindex在传递空子字符串时返回1