monkeydone / Blog

随便写点
0 stars 0 forks source link

React Native笔记 #5

Open monkeydone opened 6 years ago

monkeydone commented 6 years ago

调出调试菜单

adb shell input keyevent 82

安装某个模块

npm install --save XXX

monkeydone commented 6 years ago

文字居中

textAlign:'center,

monkeydone commented 6 years ago

查看日志

adb logcat *:S ReactNative:V ReactNativeJS:V

monkeydone commented 6 years ago

初始化一个工程

react-native init ADemo

monkeydone commented 6 years ago

运行工程的Android版本

react-native run-android

monkeydone commented 6 years ago

组件的覆盖实现

translateY:-30; 将这个view的位置想上平移30.达到组件覆盖的效果. 更好的效果

monkeydone commented 6 years ago

阴影显示

elevation: 20, shadowOffset: {width: 0, height: 0}, shadowColor: 'black', shadowOpacity: 1, shadowRadius: 5,

elevation:20 只有设置了这个,在Android上才能看到阴影效果

monkeydone commented 6 years ago

一次性安装所有依赖库

cat package.json | grep react-native- | awk -F":" '{print $1}' | sort | xargs -I {} npm install --save {}

monkeydone commented 6 years ago

Print: Entry, ":CFBundleIdentifier", Does Not Exist的某个解决办法

react-native init ProjectName --version 0.44.0 如果发现有ssl库错误 可以考虑复制其他可以运行的~/.rncache下的文件到自己的机器上.可能是这个目录下的文件下载失败的问题.

monkeydone commented 6 years ago

yarn 安装

npm install -g yarn react-native-cli yarn config set registry https://registry.npm.taobao.org --global yarn config set disturl https://npm.taobao.org/dist --global

monkeydone commented 6 years ago

node js 6 安装

curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash - sudo apt-get install -y nodejs

monkeydone commented 6 years ago

访问控制台日志

react-native log-android react-native log-ios