React Native之坑總結(持續更新)

2022-03-29 10:22:33 字數 1581 閱讀 7983

之前我用的是藍疊(bluestack)模擬器,跑rn程式也遇到了一些問題,都通過搜尋引擎解決了,不過沒有記錄。

但是bluestack有一些問題,比如沒有菜單鍵,模擬器預設是橫向的,商業化太嚴重(本來是用來玩遊戲的),介面太醜,等等......

unable to start the virtual device.

virtualbox cannot start the virtual device.

to find out the cause of the problem, start the virtual device from virtualbox.

unable to load virtualbox engine.

make sure that it is properly installed before starting genymotion.

這個問題也是找了各種辦法都沒有用。

內心真是崩潰。。花了近兩個小時終於搞定了。。

解決辦法:在genymotion中settings->adb中選中use custom android sdk tools,選擇android sdk路徑即可。

完整資訊如下:

could not get batchedbridge, make sure your bundle is packaged correctly.
解決方法:點選模擬器的選項鍵或點選搖晃按鈕,會彈出乙個選單,選擇dev settings,在彈出的頁面中點選debug server host & port for device,填入本機ip + ":8081",如:10.138.253.3:8081

獲取本機ip的方法是在cmd中輸入ipconfig

我自然是啟動了packager的,而且應用的debug server host & port for device中也填了本機ip:10.138.253.3:8081。

然後出現這個問題就很奇怪了,後來我在網上找到了這篇帖子,裡面提到了localhost與127.0.0.1,於是我去查了這兩個東西。

發現127.0.0.1一定是本機ip,但是localhost有可能被解析成完全不同的ip位址,也就出現了上面找不到packager的情況。

於是我將應用的debug位址改為了127.0.0.1:8081。果然成功了。

但是很奇怪的問題是為什麼我使用bluestack模擬器的時候填本機ip是沒問題的,到了genymotion就不行了。這個問題暫且擱置。。。

其實大部分是自己寫**的時候沒有注意小細節,rn的ide又沒有這麼智慧型,所以出現了很多奇怪的錯誤。最後的錯誤報告可能和你寫錯的地方一點關係都沒有,很蛋疼。。。

不過這裡的inputitem輸入之後如何提交還需要研究。。

持續更新中……

const  = props;
這裡的props更新之後,就不能再用room來訪問更新的內容了,因為room是之前就確定的乙個常量。

ReactNative學習筆記(五)踩坑總結

原文見這裡 載入 如下 fetch then response response.json then json alert json catch error alert 錯誤 error debug模式下沒有任何問題,但是打成release包時卻報錯 改成這樣也一樣 fetch then respo...

react native 隨手記之打包遇到坑

drawable 中的重名 修改react native的react.gradle檔案。在路徑your project node modules react native路徑下,找到dofirst,在其後新增dolast 由於工程targetsdkversion公升級到28之後,並且compiles...

react native之flex布局總結

style style style style view 當 flexdirection 為 row 的時候,為橫向布局 當 flexdirection 為 column 的時候,為縱向布局 style style style style view 而如果此時 flexdirection colum...