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

React Native带原生代码项目的判定及定义咨询

How to Identify a React Native Project Created with react-native init & Understand "Project with Native Code Required"

Great questions—this is a super common point of confusion for React Native developers, especially when switching between different project setups. Let’s break this down step by step.

1. What does "Project with Native Code Required" actually mean?

Put simply, this refers to React Native projects that include full access to iOS and Android native codebases. These projects have dedicated ios/ and android/ directories in their root, which contain the platform-specific native code (Objective-C/Swift for iOS, Java/Kotlin for Android).

Unlike Expo Managed projects (which abstract away native code and rely entirely on the Expo SDK), these projects let you:

  • Modify native files directly (e.g., tweak AndroidManifest.xml, add iOS CocoaPods dependencies)
  • Use third-party native modules that require manual linking or custom native setup
  • Compile and run the app directly via Xcode or Android Studio

If a feature or library labels itself "Project with Native Code Required", it means it can’t be used in Expo Managed projects without first ejecting (a process that adds the native code directories to the project).

2. How to check if a project was created with react-native init and has native code?

Here are the most reliable ways to verify:

  • Look for native platform directories: The easiest tell is checking your project root for ios/ and android/ folders. react-native init creates these by default, so if both exist, you’re dealing with a native code project.
  • Inspect package.json scripts: Check the "scripts" section for entries like "run-ios": "react-native run-ios" and "run-android": "react-native run-android". These are standard in react-native init projects, whereas Expo projects will have scripts like "start": "expo start" instead.
  • Check the app entry file: react-native init projects typically use index.js (or index.tsx for TypeScript) as the main entry point. Expo Managed projects usually rely on App.js/App.tsx as the starting file, with no ios//android/ folders present.
  • Test native run commands: Try running react-native run-android or react-native run-ios in your terminal. If the command compiles the app and launches it in an emulator/simulator, it’s a native code project. If you get an error about missing android/ or ios/ directories, it’s likely not.

A quick note: Some projects might have started as Expo Managed and then been ejected (using expo eject), which adds the ios/ and android/ directories. These also count as "projects with native code"—they just didn’t start with react-native init.

内容的提问来源于stack exchange,提问作者Kar

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.05.29 08:15:12