1:安装依赖的之前,没有检查对应的node版本,在17版本下安装了依赖,在xcode启动的时候报错,如下:
# [Error message "error:0308010C:digital envelope routines::unsupported"]
解决方案:
- 切换node版本到16或者14(根据readMe去看对应的依赖或者问老开发对应的版本)
- 修改环境变量
// Linux&Mac OS(windows git bash)
export NODE_OPTIONS=--openssl-legacy-provider
// Windows command prompt-
set NODE_OPTIONS=--openssl-legacy-provider
附:Mac下修改环境变量流程
// 打开一个窗口光标移动到终端,command+ N代开一个新的窗口
command + N
// 在一个新窗口中建立多个终端窗口
command + T
// 查看当前变量值
echo $PATH
// 查看.bash_profile文件
sudo vi ~/.bash_profile
// 点击i进行修改 然后:wq推出保存
//读取执行
source ~/.bash_profile
2.# react-native项目启动时报错:Module AppRegistry is not registered callable module (calling runApplication)
1.结束所有的node进程(Mac OS系统下可执行 killall -9 node)
2.npm start(或者在xcode启动app即可)
3.获取设备的高度和宽度
import { Dimensions } from “react-native”;
你可以用下面的方法来获取设备的宽高:
const windowWidth = Dimensions.get(“window”).width;
const windowHeight = Dimensions.get(“window”).height;
4.文本换行
flexWrap: wrap,
flex: 1,
5.Remove alpha channel in an image
Open the image
Command-Shift-S to Duplicate (creates a copy)
Command-S to Save
Deselect the "Alpha" checkbox
Delete " copy" from filename (including the space)
This will overwrite your original, if you want to keep the original, just leave "copy" in the name
Save
Click 'Replace' to confirm you want to overwrite the original
Only necessary if you are overwriting your original