Android Rreact Native 常見錯誤總結(jié)
Android Rreact Native 常見錯誤總結(jié)
1.invariant violation:expected a component class,got[object object]
創(chuàng)建自定義組件首字母要大寫,否則會報錯.
2.Module 0 is not a registered callable module.
將gradle升級成最新版本(cd Android 進入android目錄執(zhí)行:sudo ./gradlew clean) 或者通過android studio工具升級.
3.android.view.WindowManager$BadTokenException: Unable to add window -- token null is not valid; is your activity running?
該錯誤屬于安卓Native的錯誤,如果引用的Activity不存在或者已經(jīng)銷毀,再次引用就會報該錯誤,如果是React Native 調(diào)用原生控件的話,創(chuàng)建控件需要引用:getCurrentActivity()
4.android.app.Application cannot be cast to com.facebook.React.ReactApplication
需要將創(chuàng)建的MainApplication在AndroidManifest.xml配置好.
5.Element type is invalid: expected a string (for built-in components) or a class/function but got: object
發(fā)生原生一般是你引用了無效的組件,如果組件確實正確,看下引用的組件是否正常導(dǎo)出:(export defalut)
6.react native undefined is not an object (evaluating this....
發(fā)生該錯誤的一般是忘記bind(this),只要回調(diào)函數(shù)中需要用到this的,一般都需要bind.
7.react native - expected a component class, got [object Object]
該錯誤可能是你引用了小寫的組件,組件首字母一定要大寫,比如<login/>應(yīng)該寫成<Login/>
感謝閱讀,希望能幫助到大家,謝謝大家對本站的支持!
相關(guān)文章
Android中TextView實現(xiàn)部分文字可點擊跳轉(zhuǎn)
這篇文章主要為大家詳細介紹了Android中TextView實現(xiàn)部分文字可點擊跳轉(zhuǎn)的方法,具有一定的參考價值,感興趣的小伙伴們可以參考一下2017-10-10Android使用Jetpack Compose開發(fā)零基礎(chǔ)起步教程
Jetpack Compose是用于構(gòu)建原生Android UI的現(xiàn)代工具包。Jetpack Compose使用更少的代碼,強大的工具和直觀的Kotlin API,簡化并加速了Android上的UI開發(fā)2023-04-04Android應(yīng)用程序中讀寫txt文本文件的基本方法講解
這篇文章主要介紹了Android應(yīng)用程序中讀寫txt文本文件的基本方法講解,基本上依靠context.openFileInput()和context.openFileOutput()兩個方法為主,需要的朋友可以參考下2016-04-04android通過jxl讀excel存入sqlite3數(shù)據(jù)庫
本文主要介紹了android通過jxl去讀excel的內(nèi)容,然后存入sqlite3數(shù)據(jù)庫表,需要用到j(luò)xl的jar包和sqlite 的jar包,圖片是excel的數(shù)據(jù)格式,需要的朋友可以參考下2014-03-03Android開發(fā)中amera2 Preview使用詳解
這篇文章主要介紹了Android開發(fā)中amera2 Preview使用詳解,本文給大家介紹的非常詳細,對大家的學(xué)習(xí)或工作具有一定的參考借鑒價值,需要的朋友可以參考下2021-09-09