原生RN開發(fā)過程問題記錄

1:安裝依賴的之前,沒有檢查對應(yīng)的node版本,在17版本下安裝了依賴,在xcode啟動(dòng)的時(shí)候報(bào)錯(cuò),如下:

# [Error message "error:0308010C:digital envelope routines::unsupported"]
解決方案:
- 切換node版本到16或者14(根據(jù)readMe去看對應(yīng)的依賴或者問老開發(fā)對應(yīng)的版本)
- 修改環(huán)境變量
  // Linux&Mac OS(windows git bash)
    export NODE_OPTIONS=--openssl-legacy-provider
  // Windows command prompt-
    set NODE_OPTIONS=--openssl-legacy-provider

附:Mac下修改環(huán)境變量流程

// 打開一個(gè)窗口光標(biāo)移動(dòng)到終端,command+ N代開一個(gè)新的窗口
command + N
// 在一個(gè)新窗口中建立多個(gè)終端窗口
command + T
// 查看當(dāng)前變量值
 echo $PATH
// 查看.bash_profile文件
sudo vi ~/.bash_profile
// 點(diǎn)擊i進(jìn)行修改 然后:wq推出保存
//讀取執(zhí)行
source ~/.bash_profile
2.# react-native項(xiàng)目啟動(dòng)時(shí)報(bào)錯(cuò):Module AppRegistry is not registered callable module (calling runApplication)
1.結(jié)束所有的node進(jìn)程(Mac OS系統(tǒng)下可執(zhí)行 killall -9 node)
2.npm start(或者在xcode啟動(dòng)app即可)
3.獲取設(shè)備的高度和寬度
import { Dimensions } from “react-native”;
你可以用下面的方法來獲取設(shè)備的寬高:
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
最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡書系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容