You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

React Native执行run-android时出现RCTView.borderTopRadius类型错误求解决

Fixing 'View has no propType for NativeProp RCTView.borderTopRadius' Error in React Native

Hey there, I’ve run into this exact frustrating error before, and as the hint in the error message says, it almost always comes down to a mismatch between your JavaScript React Native code and the native Android code. Let’s walk through actionable, tested steps to fix it:

1. Verify & Sync React Native Versions

First, make sure your JS and native dependencies are perfectly aligned:

  • Check the react-native version listed in your package.json (e.g., "react-native": "0.72.4").
  • Navigate to your android/build.gradle file and confirm the ext.reactNativeVersion value matches the version in package.json.
  • In android/app/build.gradle, ensure the line implementation "com.facebook.react:react-native:${reactNativeVersion}" isn’t using a hardcoded old version—it should pull the synced version variable.

If there’s any mismatch, update the native files to match your JS version, then run npm install or yarn install to sync dependencies fully.

2. Wipe All Caches (Critical Step!)

Cached outdated code is often the hidden culprit. Let’s clear every possible cache layer:

  • Clear npm/yarn cache: npm cache clean --force (use yarn cache clean if you prefer Yarn)
  • Reset React Native’s Metro bundler cache: npx react-native start --reset-cache
  • Clean Android build artifacts: Navigate to your android directory and run ./gradlew clean (Windows users use gradlew clean)

3. Reinstall Dependencies & Rebuild from Scratch

Corrupted node_modules or lock files can cause silent version mismatches:

  • Delete the node_modules folder: rm -rf node_modules (Mac/Linux) or rd /s /q node_modules (Windows)
  • Delete package-lock.json and yarn.lock: rm package-lock.json yarn.lock
  • Reinstall dependencies: npm install or yarn install
  • Rebuild and run your project: npx react-native run-android

4. Check for Misbehaving Third-Party Libraries

If the error sticks around, a third-party UI library might be using outdated prop types that conflict with your RN version:

  • Temporarily comment out all third-party UI components (like custom styled-components, react-native-elements, etc.) from your code.
  • Run npx react-native run-android again. If the error disappears, reintroduce libraries one by one to find the culprit, then check if that library has an update compatible with your RN version.

5. Last Resort: Reset Native Project Structure

If none of the above works, creating a fresh RN project with the same version and migrating your code ensures full version sync:

  • Create a new project: npx react-native init TempProject --version [your exact RN version]
  • Copy your source code (src/ folder, components, business logic) into the new project.
  • Copy over dependencies from your original package.json to the new one, then run npm install.
  • Reconfigure any native settings (like AndroidManifest.xml permissions, signing configs) from your original project.
  • Run npx react-native run-android on the new project.

As your error message explicitly states:

若未自行修改该属性,通常意味着原生代码与JavaScript代码版本不一致,更新两者即可解决。

This is the root cause 9 times out of 10, so focusing on syncing versions and clearing cache should get your app running smoothly again.

内容的提问来源于stack exchange,提问作者deniz baş

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.27 10:01:05