- 🚘ScrollView无法在TouchableOpacity组件内滑动
将ScrollView内的内容用TouchableOpacity进行包裹,并设置onPress={() => {}}属性
- 🚘RN热更新问题
使用codepush进行热更后,src目录下的音频文件在安卓系统中无法引用。需要将文件放到原生系统中。热更的bundle文件无法打包音频文件。
- 🚘RN中获取高度的解释
//屏幕高度(状态栏+安全区+下方虚拟按键操作区)
Dimensions.get('screen').height
//窗口高度(状态栏+安全区)
Dimensions.get('window').height
- 🚘RN强制横屏UI适配问题
通过Dimensions.get()获取到的宽、高并不是横屏后的宽高。使用横屏下宽>高的普遍规则进行页面适配。
- 🚘低版本RN(0.63以下)适配iOS14图片无法显示问题
修改node_modules中react-native/Libraries/Image/RCTUIImageViewAnimates.m文件
if (_currentFrame) { //275行
layer.contentsScale = self.animatedImageScale;
layer.contents = (__bridge id)_currentFrame.CGImage;
} else { //加上这个 不然ios14以上的系统看不见图片
[super displayLayer:layer];
}
- 🚘RN清理缓存
1、watchman watch-del-all
2、rm -rf node_modules && npm install
3、rm -rf /tmp/metro-bundler-cache-* (npm start --reset-cache/react-native start --reset-cache)
4、rm -rf /tmp/haste-map-react-native-packager-*
- 🚘RN navigation参数取值
console.log(this.props.navigation.state.params.data)
- 🚘pod install 或者npm install 443问题处理:
1、添加行(https://www.ipaddress.com可查询域名的ip地址。eg: GitHub.com)
sudo vim /etc/hosts
添加行:
199.232.68.133 raw.githubusercontent.com
140.82.113.3 github.com
2、清空git代理
git config --global --unset http.proxygit config --global --unset https.proxy
git config --global --list
3、设置环境变量
env GIT_SSL_NO_VERIFY=true
- 🚘pod install 卡住,报错 raw.githubusercontent.com无法访问
1、浏览器输入 https://raw.githubusercontent.com/Homebrew/install/master/install看是否能够访问
2、按照提示,执行
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
3、尝试
pod install
- 🚘npm install 问题
npm清缓存+node版本升级
sudo npm cache clean -fsudo
npm install -g nsudo n stable
- 🚘pod install Generated duplicate UUIDs 问题:
$ export COCOAPODS_DISABLE_DETERMINISTIC_UUIDS=YES
或者Podfile中添加
install! 'cocoapods', :deterministic_uuids => false
或者删除Podfile.lock 重新 pod install
- 🚘cocoapods 镜像源修改
$ cd ~/.cocoapods/repos $ pod repo remove master
$ git clone https://mirrors.tuna.tsinghua.edu.cn/git/CocoaPods/Specs.gitmaster
修改Podfile文件
source 'https://mirrors.tuna.tsinghua.edu.cn/git/CocoaPods/Specs.git'
- 🚘npm全局安装权限报错解决
npm install --production --unsafe-perm=true --allow-root
- 🚘cocoapods常见pod方式
pod 'RNSentry', :path => '../node_modules/@sentry/react-native'
pod 'Folly', :podspec => '../node_modules/react-native/third-party-podspecs/Folly.podspec'
pod 'SensorsAnalyticsSDK', :subspecs => ['DISABLE_UIWEBVIEW','ENABLE_REACT_NATIVE_APPCLICK']
pod 'boost-for-react-native', :git => 'https://gitee.com/damon-s/boost-for-react-native.git’
- 🚘package.json依赖引用方式
"apple-authentication": "file:./plugins/apple-authentication"
"@react-native-community/async-storage": "github:react-native-community/async-storage"
"react-native-star-rating-view": "git+https://github.com/ksti/react-native-star-rating-view.git#purejs"
- 🚘卸载安装homebrew卡慢问题
(参考)
1、curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh>> brew_install
2、/bin/bash brew_install
3、brew_install文件修改:BREW_REPO="https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/brew.git"CORE_TAP_REPO="https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-core.git"
4、/bin/bash -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/uninstall)"
- 🚘Xcode命令
//给Xcode命令行工具指定路径
$ sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer/
//查看sdk路径
$ xcrun --sdk iphoneos --show-sdk-path
//查看所有可用sdk
$ xcodebuild -showsdks
- 🚘Mac安装软件提示损坏无法打开
sudo xattr -r -d com.apple.quarantine /Applications/Navicat\ Premium.app
- 🚘Mac环境变量配置路径
a. /etc/profile
b. /etc/paths
c. ~/.bash_profile
d. ~/.bash_login
e. ~/.profile
f. ~/.bashrc
- 🚘Xcode打包编译路径
/Users/tao/Library/Developer/Xcode/DerivedData/rocketcat-fvrjzdyhzrtjeggqrdafxjapdqza/Build/Intermediates.noindex/ArchiveIntermediates/rocketcat/BuildProductsPath
- 🚘iOS APP下载链接拼接
1、https://itunes.apple.com/cn/app/id14940xxx?mt=8
2、itms-apps://itunes.apple.com/cn/app/apple-books/id149407xxx
- 🚘iOS开发者指南
https://developer.apple.com/design/human-interface-guidelines/
- 🚘启动安卓模拟器命令
cd /Users/tao/Library/Android/sdk/emulator
./emulator @Nexus_6P_API_27
- 🚘启动i|OS模拟器命令
open -a Simulator
- 🚘安卓提示android.support.v4不存在(AndroidX 9.0版本适配)解决办法
npx jetify
- 🚘安卓真机调试
1、adb reverse tcp:8081 tcp:8081
2、Android允许我们通过ADB,把Android上的某个端口映射到电脑(adb forward),或者把电脑的某个端口映射到Android系统(adb reverse)
3、假设电脑上开启的服务,监听的端口为8081。Android手机通过USB连接电脑后,执行 adb reverse tcp:8081 tcp:8081,然后在手机中访问127.0.0.1:8081,就可以访问到电脑上启动的服务了。
- 🚘使用adb将安卓模拟器中的文件拉取到外部根路径下
1、执行adb shell 进入命令环境
2、执行adb pull /data/user/0/com.rocketcatwords/files/audio.wav
- 🚘安卓渠道包 apk 360加固保 python2.+
1、打一个安卓apk
2、放进360加固保加固,得到加固后的apk
3、将apk放入android目录下,修改apk名称与config.py中的配置保持一致
4、运行python ApkResigner.py
5、渠道包便生成到了channels目录下sdkBuildToolPath = "/Users/tao/Library/Android/sdk/build-tools/26.0.2"
- 🚘通过命令行启动VLC指定参数播放PCM文件:
/Applications/VLC.app/Contents/MacOS/VLC --demux=rawaud --rawaud-channels 1 --rawaud-samplerate 16000 record_01.pcm
- 🚘网页移动端适配
<meta name="viewport" content="width=device-width,initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
- 🚘中文正则匹配:
[\u4e00-\u9fa5]+
- 🚘端口占用查询与结束进程
sudo lsof -i:9090
sudo kill -9 xxxx(进程ID)
- 🚘du -h 文件 可查询文件大小
- 🚘Git
1、切换git仓库源:git remote set-url origin xxx.git
2、git commit 后git push/git pull 冲突:git stash && git rebase
3、git rebase后无法提交更新:git push --force-with-lease origin dev
4、tag相关:
git tag 查看所有tag
git tag -a v1.0.0 -m '描述'
git push origin v1.0.0 推送指定tag
git push origin --tags 推送本地所有tag
git push origin --delete tag v1.2.0 删除指定tag
5、不提示输入账户和密码:git config --system --unset credential.helper