e52cab5a7f
Summary: Sometimes is handy to check if a React node is a descendant of another node or not. For instance, I want to check if the focused `TextInput` is descendant of an specific `ScrollView`: ```js const currentlyFocusedField = TextInput.State.currentlyFocusedField() UIManager.viewIsAncestorOf( currentlyFocusedField, this.getInnerViewNode(), (isAncestor) => { if (isAncestor) { console.log('The focused field is a descendant of this ScrollView!') } } ) ``` This function uses the same strategy as the `measureLayout` method to check if one node is an ancestor of other node. As the `measureLayout` method, this is performed outside the main thread. By now I've only implemented the iOS version and its tests, but if this function is going to be merged I'll implement the Android version too. I have objc experience but no Java or Android, so I prefer to validate this functionality before jumping into developing the Android part. Closes https://github.com/facebook/react-native/pull/7876 Differential Revision: D3662045 Pulled By: javache fbshipit-source-id: b9668e8ea94fd01db76651f16243926cf9c2566f |
||
---|---|---|
.. | ||
UIExplorer | ||
UIExplorer.xcodeproj | ||
UIExplorerIntegrationTests | ||
UIExplorerUnitTests | ||
android/app | ||
js | ||
README.md |
README.md
UIExplorer
The UIExplorer is a sample app that showcases React Native views and modules.
Running this app
Before running the app, make sure you ran:
git clone https://github.com/facebook/react-native.git
cd react-native
npm install
Running on iOS
Mac OS and Xcode are required.
- Open
Examples/UIExplorer/UIExplorer.xcodeproj
in Xcode - Hit the Run button
See Running on device if you want to use a physical device.
Running 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:UIExplorer:android:app:installDebug
./packager/packager.sh
Note: Building for the first time can take a while.
Open the UIExplorer app in your emulator.
See Running on Device in case you want to use a physical device.
Running with Buck
Follow the same setup as running with gradle.
Install Buck from here.
Run the following commands from the react-native folder:
./gradlew :ReactAndroid:packageReactNdkLibsForBuck
buck fetch uiexplorer
buck install -r uiexplorer
./packager/packager.sh
Note: The native libs are still built using gradle. Full build with buck is coming soon(tm).
Built from source
Building the app on both iOS and Android means building the React Native framework from source. This way you're running the latest native and JS code the way you see it in your clone of the github repo.
This is different from apps created using react-native init
which have a dependency on a specific version of React Native JS and native code, declared in a package.json
file (and build.gradle
for Android apps).