項目中經常會用到一些第三方組件,每次使用的時候網上找都能找到好多,一些好用,一些不好用,
現在將自己在項目中使用過的感覺還不錯的組件記錄下來,為了大家也為了自己以后節省一點測試探索的時間。
基本配置github里有詳細的介紹react-native-splash-screen。
首先注明一下,這個親測的RN版本是0.33。
配置的步驟和一般第三方組件差不多,這里就不再贅述。不同的地方就是在./android/app/src/res下面多了layout和drawable文件夾
如圖所示
splash.png就是你想要設置的啟動圖圖片,
launch_screen.xml代碼
<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="match_parent" android:layout_height="match_parent" android:background="@drawable/splash"> </LinearLayout>
主要實例github網站也有示例,使用還是挺方便的。特加以推薦