React和React Native的关系
React是基础,React Native是专门开发移动应用,需要掌握JavaScript的语法,以及操作运算符,条件语句,循环语句,switch语句,函数,对象。
开发环境搭建for mac
npm 安装比较慢,可以切换到淘宝镜像上,安装。
npm install -g cnpm --registry=https://registry.npm.taobao.org
初始化一个项目:
react-native init AppLearn22
界面提示:
This will walk you through creating a new React Native project in /Users/apple/nrLearn/AppLearn22
Installing react-native...
Consider installing yarn to make this faster: https://yarnpkg.com
npm WARN deprecated core-js@2.6.11: core-js@<3 is no longer maintained and not recommended for usage due to the number of issues. Please, upgrade your dependencies to the actual version of core-js@3.
npm WARN deprecated core-js@1.2.7: core-js@<3 is no longer maintained and not recommended for usage due to the number of issues. Please, upgrade your dependencies to the actual version of core-js@3.
> fsevents@1.2.11 install /Users/apple/nrLearn/AppLearn22/node_modules/fsevents
> node-gyp rebuild
SOLINK_MODULE(target) Release/.node
CXX(target) Release/obj.target/fse/fsevents.o
SOLINK_MODULE(target) Release/fse.node
> core-js@2.6.11 postinstall /Users/apple/nrLearn/AppLearn22/node_modules/core-js
> node -e "try{require('./postinstall')}catch(e){}"
Thank you for using core-js ( https://github.com/zloirock/core-js ) for polyfilling JavaScript standard library!
The project needs your help! Please consider supporting of core-js on Open Collective or Patreon:
> https://opencollective.com/core-js
> https://www.patreon.com/zloirock
Also, the author of core-js ( https://github.com/zloirock ) is looking for a good job -)
npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN react-native@0.61.5 requires a peer of react@16.9.0 but none is installed. You must install peer dependencies yourself.
+ react-native@0.61.5
added 716 packages from 431 contributors in 71.181s
4 packages are looking for funding
run `npm fund` for details
info Setting up new React Native app in /Users/apple/nrLearn/AppLearn22
info Adding required dependencies
+ react@16.9.0
added 1 package in 4.568s
4 packages are looking for funding
run `npm fund` for details
info Adding required dev dependencies
npm WARN eslint-plugin-react-native@3.6.0 requires a peer of eslint@^3.17.0 || ^4 || ^5 but none is installed. You must install peer dependencies yourself.
npm WARN @typescript-eslint/eslint-plugin@1.13.0 requires a peer of eslint@^5.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN @typescript-eslint/parser@1.13.0 requires a peer of eslint@^5.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN eslint-plugin-react@7.12.4 requires a peer of eslint@^3.0.0 || ^4.0.0 || ^5.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN tsutils@3.17.1 requires a peer of typescript@>=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev || >= 3.6.0-beta || >= 3.7.0-dev || >= 3.7.0-beta but none is installed. You must install peer dependencies yourself.
+ @react-native-community/eslint-config@0.0.5
+ @babel/core@7.7.7
+ @babel/runtime@7.7.7
+ babel-jest@24.9.0
+ eslint@6.8.0
+ jest@24.9.0
+ metro-react-native-babel-preset@0.56.3
+ react-test-renderer@16.9.0
added 292 packages from 274 contributors and updated 3 packages in 20.116s
18 packages are looking for funding
run `npm fund` for details
info Installing required CocoaPods dependencies
? CocoaPods (https://cocoapods.org/) is not installed. CocoaPods is necessary for the iOS project to run corr
ectly. Do you want to install it? Yes, with gem (may require sudo)