@@ -29,10 +29,10 @@ import Tabs from '@theme/Tabs'; import TabItem from '@theme/TabItem'; import con
2929进入根目录并运行以下命令:
3030
3131```
32- curl -O https://raw.githubusercontent.com/react-native-community/template/refs/heads/0.76 -stable/template/package.json
32+ curl -O https://raw.githubusercontent.com/react-native-community/template/refs/heads/0.77 -stable/template/package.json
3333```
3434
35- 这将从[ 社区模板] ( https://github.com/react-native-community/template/blob/0.76 -stable/template/package.json ) 复制 ` package.json ` 文件到您的项目中。
35+ 这将从[ 社区模板] ( https://github.com/react-native-community/template/blob/0.77 -stable/template/package.json ) 复制 ` package.json ` 文件到您的项目中。
3636
3737接下来,运行以下命令安装 NPM 包:
3838
@@ -55,7 +55,7 @@ yarn install
5555
5656安装过程创建了一个新的 ` node_modules ` 文件夹。该文件夹存储了构建项目所需的 JavaScript 依赖项。
5757
58- 将 ` node_modules/ ` 添加到您的 ` .gitignore ` 文件中([ 社区默认文件] ( https://github.com/react-native-community/template/blob/0.76 -stable/template/_gitignore ) )。
58+ 将 ` node_modules/ ` 添加到您的 ` .gitignore ` 文件中([ 社区默认文件] ( https://github.com/react-native-community/template/blob/0.77 -stable/template/_gitignore ) )。
5959
6060### 3. 安装开发工具
6161
@@ -87,22 +87,22 @@ brew install cocoapods
8787对于 ** Gemfile** ,请进入您的项目根目录并运行以下命令:
8888
8989``` sh
90- curl -O https://raw.githubusercontent.com/react-native-community/template/refs/heads/0.76 -stable/template/Gemfile
90+ curl -O https://raw.githubusercontent.com/react-native-community/template/refs/heads/0.77 -stable/template/Gemfile
9191```
9292
9393这将下载 Gemfile 文件。
9494对于 ** Podfile** ,请进入您的项目 ` ios ` 文件夹并运行以下命令:
9595
9696``` sh
97- curl -O https://raw.githubusercontent.com/react-native-community/template/refs/heads/0.76 -stable/template/ios/Podfile
97+ curl -O https://raw.githubusercontent.com/react-native-community/template/refs/heads/0.77 -stable/template/ios/Podfile
9898```
9999
100- 请使用社区模板 作为 [ Gemfile] ( https://github.com/react-native-community/template/blob/0.76 -stable/template/Gemfile ) 和 [ Podfile] ( https://github.com/react-native-community/template/blob/0.76 -stable/template/ios/Podfile ) 的参考。
100+ 请使用社区模板 作为 [ Gemfile] ( https://github.com/react-native-community/template/blob/0.77 -stable/template/Gemfile ) 和 [ Podfile] ( https://github.com/react-native-community/template/blob/0.77 -stable/template/ios/Podfile ) 的参考。
101101
102102::: note
103- 请记住更改 [ Podfile] ( https://github.com/react-native-community/template/blob/0.76 -stable/template/ios/Podfile#L17 ) 和 [ Podfile] ( https://github.com/react-native-community/template/blob/0.76 -stable/template/ios/Podfile#L26 ) 中的这两行,以匹配您的应用名称。
103+ 请记住更改 [ Podfile] ( https://github.com/react-native-community/template/blob/0.77 -stable/template/ios/Podfile#L17 ) 和 [ Podfile] ( https://github.com/react-native-community/template/blob/0.77 -stable/template/ios/Podfile#L26 ) 中的这两行,以匹配您的应用名称。
104104
105- 如果您的应用没有测试,请记住删除 [ Podfile] ( https://github.com/react-native-community/template/blob/0.76 -stable/template/ios/Podfile#L26-L29 ) 中的这段代码。
105+ 如果您的应用没有测试,请记住删除 [ Podfile] ( https://github.com/react-native-community/template/blob/0.77 -stable/template/ios/Podfile#L26-L29 ) 中的这段代码。
106106:::
107107
108108现在,我们需要运行一些额外的命令来安装 Ruby Gem 和 Pods。
@@ -127,7 +127,7 @@ bundle exec pod install
127127
128128` index.js ` 是 React Native 应用程序的起点,并且总是需要。它可以是一个小文件,该文件 ` import ` 其他文件,这些文件是您的 React Native 组件或应用程序的一部分,或者它可以包含所有需要的代码。
129129
130- 我们的 ` index.js ` 文件应如下所示([ 社区模板文件] ( https://github.com/react-native-community/template/blob/0.76 -stable/template/index.js ) 作为参考):
130+ 我们的 ` index.js ` 文件应如下所示([ 社区模板文件] ( https://github.com/react-native-community/template/blob/0.77 -stable/template/index.js ) 作为参考):
131131
132132``` js
133133import {AppRegistry } from ' react-native' ;
@@ -138,7 +138,7 @@ AppRegistry.registerComponent('HelloWorld', () => App);
138138
139139### 创建一个 ` App.tsx ` 文件
140140
141- 让我们创建一个 ` App.tsx ` 文件。这是一个 [ TypeScript] ( https://www.typescriptlang.org/ ) 文件,可以包含 [ JSX] ( < https://en.wikipedia.org/wiki/JSX_(JavaScript) > ) 表达式。它包含我们要集成到 iOS 应用程序中的根 React Native 组件([ 链接] ( https://github.com/react-native-community/template/blob/0.76 -stable/template/App.tsx ) ):
141+ 让我们创建一个 ` App.tsx ` 文件。这是一个 [ TypeScript] ( https://www.typescriptlang.org/ ) 文件,可以包含 [ JSX] ( < https://en.wikipedia.org/wiki/JSX_(JavaScript) > ) 表达式。它包含我们要集成到 iOS 应用程序中的根 React Native 组件([ 链接] ( https://github.com/react-native-community/template/blob/0.77 -stable/template/App.tsx ) ):
142142
143143``` tsx
144144import React from ' react' ;
@@ -211,7 +211,7 @@ const styles = StyleSheet.create({
211211export default App ;
212212```
213213
214- [ 社区模板文件] ( https://github.com/react-native-community/template/blob/0.76 -stable/template/App.tsx ) 作为参考
214+ [ 社区模板文件] ( https://github.com/react-native-community/template/blob/0.77 -stable/template/App.tsx ) 作为参考
215215
216216## 5. 与 iOS 代码集成
217217
@@ -349,7 +349,6 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
349349``` diff title="AppDelegate.swift"
350350import UIKit
351351+ import React_RCTAppDelegate
352- + import React_RCTAppDelegate
353352
354353@main
355354- class AppDelegate: UIResponder, UIApplicationDelegate {
@@ -551,7 +550,7 @@ const {getDefaultConfig} = require('@react-native/metro-config');
551550module .exports = getDefaultConfig (__dirname );
552551```
553552
554- 您可以查看[ 社区模板文件] ( https://github.com/react-native-community/template/blob/0.76 -stable/template/metro.config.js ) 作为参考。
553+ 您可以查看[ 社区模板文件] ( https://github.com/react-native-community/template/blob/0.77 -stable/template/metro.config.js ) 作为参考。
555554
556555一旦您有了配置文件,您可以运行 bundler。在项目根目录下运行以下命令:
557556
0 commit comments