react-native 初探

最近公司打算作一个app 咱们的android 打算采用新技术 ,因此我也投入了学习的大部队中html

首先 学习react-native 他是干什么的  咱们一直知道 安卓和IOS不能互通,因此在开发app的时候,须要一我的开发IOS,一我的开发安卓。而这个react-native 就是一个在安卓和IOS能够使用共通的js的前端框架  前端

1.第一步 安装环境react

对于没有开发过app的我来讲 IOS和android的环境 都没有装过 包括一些编译工具 模拟器等android

 

这是一个配置开发环境的过程 我也是按照这个步骤 配置的网址  ios

https://reactnative.cn/docs/0.36/getting-started.html#contentgit

要分别按照 步骤安装开发环境github

ios的开发环境 比较好配置 编译工具 直接从appstore 下载便可 而后就能够运行 (模拟器第一次启动比较慢)shell

android 的开发环境配置就比较复杂了npm

按照步骤一步步配置 到安装android 工具 android studio  之后 按照 步骤 安装 vim

<1.会报一个 sdk的错误 能够先跳过 这个 之后在进行配置 

<2.当不使用studio的模拟器 使用 下图的模拟器 的时候

须要在进行一次配置

<3.ANDROID_HOME环境变量  配置环境变量的时候 

.bash_profile

.bashrc

.zshrc

这三个 文件 须要配置

这几个文件 默认系统是隐藏的

能够经过 在命令行输入这段代码 来进行显示隐藏

显示隐藏文件
defaults write com.apple.finder AppleShowAllFiles -bool true
osascript -e 'tell application "Finder" to quit'

不显示隐藏文件
defaults write com.apple.finder AppleShowAllFiles -bool false
osascript -e 'tell application "Finder" to quit'

 

下面是个人三个文件的配置 并不适用于每一个人的配置 写在这里 记录一下环境配置的步骤 之后配置的时候 参考错误

在 .bash_profile 中加入

# User configuration

source ~/.bash_profile

source ~/.bashrc

 

.bashrc 中

 

export ANDROID_HOME=~/Library/Android/sdk
#export PATH=${PATH}:~/Library/Android/sdk/platform-tools
export PATH=$PATH:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools
export PATH=/usr/local/bin/brew:$PATH
export PATH=/usr/local/opt/icu4c/bin:$PATH

  .zshrc 中

# If you come from bash you might have to change your $PATH.
# export PATH=$HOME/bin:/usr/local/bin:$PATH

# Path to your oh-my-zsh installation.
export ZSH=$HOME/.oh-my-zsh

# Set name of the theme to load. Optionally, if you set this to "random"
# it'll load a random theme each time that oh-my-zsh is loaded.
# See https://github.com/robbyrussell/oh-my-zsh/wiki/Themes
ZSH_THEME="robbyrussell"

# Set list of themes to load
# Setting this variable when ZSH_THEME=random
# cause zsh load theme from this variable instead of
# looking in ~/.oh-my-zsh/themes/
# An empty array have no effect
# ZSH_THEME_RANDOM_CANDIDATES=( "robbyrussell" "agnoster" )

# Uncomment the following line to use case-sensitive completion.
# CASE_SENSITIVE="true"

# Uncomment the following line to use hyphen-insensitive completion. Case
# sensitive completion must be off. _ and - will be interchangeable.
# HYPHEN_INSENSITIVE="true"

# Uncomment the following line to disable bi-weekly auto-update checks.
# DISABLE_AUTO_UPDATE="true"

# Uncomment the following line to change how often to auto-update (in days).
# export UPDATE_ZSH_DAYS=13

# Uncomment the following line to disable colors in ls.
# DISABLE_LS_COLORS="true"

# Uncomment the following line to disable auto-setting terminal title.
# DISABLE_AUTO_TITLE="true"

# Uncomment the following line to enable command auto-correction.
# ENABLE_CORRECTION="true"

# Uncomment the following line to display red dots whilst waiting for completion.
# COMPLETION_WAITING_DOTS="true"

# Uncomment the following line if you want to disable marking untracked files
# under VCS as dirty. This makes repository status check for large repositories
# much, much faster.
# DISABLE_UNTRACKED_FILES_DIRTY="true"

# Uncomment the following line if you want to change the command execution time
# stamp shown in the history command output.
# The optional three formats: "mm/dd/yyyy"|"dd.mm.yyyy"|"yyyy-mm-dd"
# HIST_STAMPS="mm/dd/yyyy"

# Would you like to use another custom folder than $ZSH/custom?
# ZSH_CUSTOM=/path/to/new-custom-folder

# Which plugins would you like to load? (plugins can be found in ~/.oh-my-zsh/plugins/*)
# Custom plugins may be added to ~/.oh-my-zsh/custom/plugins/
# Example format: plugins=(rails git textmate ruby lighthouse)
# Add wisely, as too many plugins slow down shell startup.
plugins=(
  git
)

source $ZSH/oh-my-zsh.sh

# User configuration
source ~/.bash_profile
source ~/.bashrc

# export MANPATH="/usr/local/man:$MANPATH"

# You may need to manually set your language environment
# export LANG=en_US.UTF-8

# Preferred editor for local and remote sessions
# if [[ -n $SSH_CONNECTION ]]; then
#   export EDITOR='vim'
# else
#   export EDITOR='mvim'
# fi

# Compilation flags
# export ARCHFLAGS="-arch x86_64"

# ssh
# export SSH_KEY_PATH="~/.ssh/rsa_id"

#yarn 
export PATH="$PATH:$HOME/.yarn/bin"
#electron
#ELECTRON_MIRROR="https://npm.taobao.org/mirrors/electron/"

# Set personal aliases, overriding those provided by oh-my-zsh libs,
# plugins, and themes. Aliases can be placed here, though oh-my-zsh
# users are encouraged to define aliases within the ZSH_CUSTOM folder.
# For a full list of active aliases, run `alias`.
#
# Example aliases
# alias zshconfig="mate ~/.zshrc"
# alias ohmyzsh="mate ~/.oh-my-zsh"

 

命令行   检查一下版本

CMCC-AUTO-GT:~ tingguo$ adb
Android Debug Bridge version 1.0.40

  

 

 

 

安卓的模拟器 开启效果 以后 在ws中修改代码之后  在模拟器中 r+r 便可 刷新 查看效果  

未完。。。

相关文章
相关标签/搜索