React Native官方DEMO
官方給我們提供了UIExplorer項目,這里邊包含React Native的基本所有組件的使用介紹和方法。
運行官方DEMO步驟如下
- 安裝react native環境
- React Native項目源碼下載
- 下載安裝cygwin軟件
- 下載安裝NDK然后安裝以及配置
- 添加Node依賴模塊:該命令行需要切到react-native項目中,主要運行如下命令
cd react-native以及npm install(這里發生錯誤,是因為npm需要升級的緣故) - 還需要安裝配置python2版本,python3不行
- 開始編譯官方實例UIExploerer項目
打開之前安裝的cygwin終端,切換到當前react-native項目中。注意切換路徑方法以實際項目路徑為準,運行以下命令
./gradlew :Examples:UIExplorer:android:app:installDebug
需要下載很多東西,挺慢的,而且由于網絡原因,經常會失敗,多試幾次才行 - 接下來就是最關鍵的一步啦~執行如下命令進行打包啟動服務.
./packager/packager.sh
References
windows版本編譯運行react-native官方實例
效果如下
該DEMO包含了react native主要組件與API的實例
COMPONETS
- ActivityIndicatorExample
- SliderExample
- ImageExample
- ListViewExample等
AIPS
- AccessibilityAndroidExample
- AlertExample
- AppStateExample
- BorderExample
官方Movie實例
The Movies app is a demonstration of basic concepts, such as fetching data, rendering a list of data including images, and navigating between different screens.
Running this app
Before running the app, make sure you ran:
git clone https://github.com/facebook/react-native.git cd react-native npm installRunning on Android
You’ll need to have all the prerequisites (SDK, NDK) for Building React Native installed.
Start an Android emulator (Genymotion is recommended).
cd react-native ./gradlew :Examples:Movies:android:app:installDebug ./packager/packager.shNote: Building for the first time can take a while.
Open the Movies app in your emulator.
See Running on Device in case you want to use a physical device.
effect
總結
以上是生活随笔為你收集整理的React Native官方DEMO的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: ㊙️【教你用python挣零花钱】自动化
- 下一篇: Retrofit学习入门