react-native/Examples/UIExplorer
Adam Comella fe5c0d2d06 iOS: Enable views to be nested within <Text>
Summary:
Previously, only Text and Image could be nested within Text. Now, any
view can be nested within Text. One restriction of this feature is
that developers must give inline views a width and a height via
the style prop.

Previously, inline Images were supported by using iOS's built-in support
for rendering images with an NSAttributedString via NSTextAttachment.
However, NSAttributedString doesn't support rendering arbitrary views.

This change adds support for nesting views within Text by creating one
NSTextAttachment per inline view. The NSTextAttachments act as placeholders.
They are set to be the size of the corresponding view. After the text is
laid out, we query the text system to find out where it has positioned each
NSTextAttachment. We then position the views to be at those locations.

This commit also contains a change in `RCTShadowText.m`
`_setParagraphStyleOnAttributedString:heightOfTallestSubview:`. It now only sets
`lineHeight`, `textAlign`, and `writingDirection` when they've actua
Closes https://github.com/facebook/react-native/pull/7304

Differential Revision: D3269333

Pulled By: nicklockwood

fbshipit-source-id: 2b59f1c5445a4012f9c29df9f10f5010060ea517
2016-05-17 10:43:30 -07:00
..
AnimatedGratuitousApp Fix up this pattern var React = require('react-native'); 2016-04-08 20:37:22 -07:00
NavigationExperimental Kill <NavigationView /> 2016-05-11 16:23:26 -07:00
Navigator Fix up this pattern var React = require('react-native'); 2016-04-08 20:37:22 -07:00
Thumbnails Fixed zero-size images 2015-11-18 15:23:30 -08:00
UIExplorer Adding emulator, simulator UIExplorer example across docs 2016-04-04 06:05:23 -07:00
UIExplorer.xcodeproj Use xcodebuild and delete "Framework Search Paths" for Xcode 7.3 to un-stall the tests 2016-04-22 23:04:19 -07:00
UIExplorerIntegrationTests Remove 64-bit restriction from React Native tests 2016-05-16 05:28:23 -07:00
UIExplorerUnitTests Move setBridge: off main thread 2016-05-03 09:09:21 -07:00
android/app Allow building UIExplorer with Buck 2016-04-12 13:05:24 -07:00
AccessibilityAndroidExample.android.js Fix up this pattern var React = require('react-native'); 2016-04-08 20:37:22 -07:00
AccessibilityIOSExample.js Fix up this pattern var React = require('react-native'); 2016-04-08 20:37:22 -07:00
ActionSheetIOSExample.js Fix up this pattern var React = require('react-native'); 2016-04-08 20:37:22 -07:00
ActivityIndicatorIOSExample.js Fix up this pattern var React = require('react-native'); 2016-04-08 20:37:22 -07:00
AdSupportIOSExample.js Fix up this pattern var React = require('react-native'); 2016-04-08 20:37:22 -07:00
AlertExample.js Fix up this pattern var React = require('react-native'); 2016-04-08 20:37:22 -07:00
AlertIOSExample.js Fix up this pattern var React = require('react-native'); 2016-04-08 20:37:22 -07:00
AnimatedExample.js Fix up this pattern var React = require('react-native'); 2016-04-08 20:37:22 -07:00
AppStateExample.js Fix up this pattern var React = require('react-native'); 2016-04-08 20:37:22 -07:00
AppStateIOSExample.js Fix up this pattern var React = require('react-native'); 2016-04-08 20:37:22 -07:00
AssetScaledImageExample.js Fix up this pattern var React = require('react-native'); 2016-04-08 20:37:22 -07:00
AsyncStorageExample.js Fix up this pattern var React = require('react-native'); 2016-04-08 20:37:22 -07:00
BorderExample.js Fix 'Can't find variable: React' 2016-04-24 07:13:29 -07:00
BoxShadowExample.js Fix 'React not found' issue 2016-04-24 16:27:25 -07:00
CameraRollExample.js Fix up this pattern var React = require('react-native'); 2016-04-08 20:37:22 -07:00
CameraRollView.js Fix up this pattern var React = require('react-native'); 2016-04-08 20:37:22 -07:00
ClipboardExample.js Fix up this pattern var React = require('react-native'); 2016-04-08 20:37:22 -07:00
DatePickerAndroidExample.js Fix up this pattern var React = require('react-native'); 2016-04-08 20:37:22 -07:00
DatePickerIOSExample.js Fix up this pattern var React = require('react-native'); 2016-04-08 20:37:22 -07:00
ExampleTypes.js Update FBSource to use Flow 0.22 2016-03-08 12:39:29 -08:00
GeolocationExample.js Fix up this pattern var React = require('react-native'); 2016-04-08 20:37:22 -07:00
ImageCapInsetsExample.js Fix up this pattern var React = require('react-native'); 2016-04-08 20:37:22 -07:00
ImageEditingExample.js Fix up this pattern var React = require('react-native'); 2016-04-08 20:37:22 -07:00
ImageExample.js Add a way to prefetch remote images to cache with Image.prefetch 2016-04-13 07:30:28 -07:00
LayoutAnimationExample.js Add support for delete animation in LayoutAnimation on iOS 2016-04-25 00:19:25 -07:00
LayoutEventsExample.js Fix up this pattern var React = require('react-native'); 2016-04-08 20:37:22 -07:00
LayoutExample.js Fix up this pattern var React = require('react-native'); 2016-04-08 20:37:22 -07:00
LinkingExample.js Fix up this pattern var React = require('react-native'); 2016-04-08 20:37:22 -07:00
ListViewExample.js clarify highlightRow usage with UIExplorer example 2016-05-05 03:43:47 -07:00
ListViewGridLayoutExample.js Fix up this pattern var React = require('react-native'); 2016-04-08 20:37:22 -07:00
ListViewPagingExample.js Fix up this pattern var React = require('react-native'); 2016-04-08 20:37:22 -07:00
MapViewExample.js Fix up this pattern var React = require('react-native'); 2016-04-08 20:37:22 -07:00
ModalExample.js Modal Animation Types 2016-04-28 16:00:32 -07:00
NavigatorIOSColorsExample.js Fix up this pattern var React = require('react-native'); 2016-04-08 20:37:22 -07:00
NavigatorIOSExample.js Fix up this pattern var React = require('react-native'); 2016-04-08 20:37:22 -07:00
NetInfoExample.js Fix up this pattern var React = require('react-native'); 2016-04-08 20:37:22 -07:00
PanResponderExample.js Fix up this pattern var React = require('react-native'); 2016-04-08 20:37:22 -07:00
PickerExample.js Display platform-specific examples 2016-05-05 09:10:26 -07:00
PickerIOSExample.js Fix up this pattern var React = require('react-native'); 2016-04-08 20:37:22 -07:00
PointerEventsExample.js Fix up this pattern var React = require('react-native'); 2016-04-08 20:37:22 -07:00
ProgressBarAndroidExample.android.js ProgressBarAndroid: default value for styleAttr 2016-01-07 12:02:37 -08:00
ProgressViewIOSExample.js Fix up this pattern var React = require('react-native'); 2016-04-08 20:37:22 -07:00
PushNotificationIOSExample.js Update PushNotificationIOS documentation 2016-04-22 09:16:21 -07:00
RCTRootViewIOSExample.js Fix up this pattern var React = require('react-native'); 2016-04-08 20:37:22 -07:00
README.md Allow building UIExplorer with Buck 2016-04-12 13:05:24 -07:00
RefreshControlExample.js Allow to set refresh control title color 2016-04-16 15:15:25 -07:00
RootViewSizeFlexibilityExampleApp.js Fix up this pattern var React = require('react-native'); 2016-04-08 20:37:22 -07:00
ScrollViewExample.js Fix up this pattern var React = require('react-native'); 2016-04-08 20:37:22 -07:00
ScrollViewSimpleExample.js Fix up this pattern var React = require('react-native'); 2016-04-08 20:37:22 -07:00
SegmentedControlIOSExample.js Fix up this pattern var React = require('react-native'); 2016-04-08 20:37:22 -07:00
SetPropertiesExampleApp.js Fix up this pattern var React = require('react-native'); 2016-04-08 20:37:22 -07:00
SliderExample.js Fix up this pattern var React = require('react-native'); 2016-04-08 20:37:22 -07:00
SliderIOSExample.js Fix up this pattern var React = require('react-native'); 2016-04-08 20:37:22 -07:00
SnapshotExample.js Fix up this pattern var React = require('react-native'); 2016-04-08 20:37:22 -07:00
StatusBarExample.js Fix up this pattern var React = require('react-native'); 2016-04-08 20:37:22 -07:00
StatusBarIOSExample.js Fix up this pattern var React = require('react-native'); 2016-04-08 20:37:22 -07:00
SwitchExample.js Fix up this pattern var React = require('react-native'); 2016-04-08 20:37:22 -07:00
TabBarIOSExample.js Enable setting color of text and images on unselected tabs 2016-05-03 05:40:29 -07:00
TextExample.android.js Added support for textDecorationLine style prop on Android 2016-04-12 03:37:34 -07:00
TextExample.ios.js iOS: Enable views to be nested within <Text> 2016-05-17 10:43:30 -07:00
TextInputExample.android.js Implement returnKeyType/returnKeyLabel on Android 2016-05-05 10:22:19 -07:00
TextInputExample.ios.js Change returnKeyType in AutoExpandingTextInput example 2016-04-15 02:28:22 -07:00
TimePickerAndroidExample.js Fix up this pattern var React = require('react-native'); 2016-04-08 20:37:22 -07:00
TimerExample.js Fix up this pattern var React = require('react-native'); 2016-04-08 20:37:22 -07:00
ToastAndroidExample.android.js Fix up this pattern var React = require('react-native'); 2016-04-08 20:37:22 -07:00
ToolbarAndroidExample.android.js Fix up this pattern var React = require('react-native'); 2016-04-08 20:37:22 -07:00
TouchableExample.js Reverted commit D3126513 2016-04-24 15:45:19 -07:00
TransformExample.js Fix up this pattern var React = require('react-native'); 2016-04-08 20:37:22 -07:00
TransparentHitTestExample.js Fix up this pattern var React = require('react-native'); 2016-04-08 20:37:22 -07:00
UIExplorerActions.js Kill NavigationExperimental Containers 2016-05-05 16:52:19 -07:00
UIExplorerApp.android.js Kill NavigationExperimental Containers 2016-05-05 16:52:19 -07:00
UIExplorerApp.ios.js Kill NavigationExperimental Containers 2016-05-05 16:52:19 -07:00
UIExplorerBlock.js Fix warnings in UIExplorer example pages 2016-04-07 21:14:29 -07:00
UIExplorerButton.js Fix up this pattern var React = require('react-native'); 2016-04-08 20:37:22 -07:00
UIExplorerExampleList.js Kill NavigationExperimental Containers 2016-05-05 16:52:19 -07:00
UIExplorerList.android.js Display platform-specific examples 2016-05-05 09:10:26 -07:00
UIExplorerList.ios.js Kill NavigationLegacyNavigator. 2016-05-05 10:56:41 -07:00
UIExplorerNavigationReducer.js Fix up this pattern var React = require('react-native'); 2016-04-08 20:37:22 -07:00
UIExplorerPage.js Fix warnings in UIExplorer example pages 2016-04-07 21:14:29 -07:00
UIExplorerStateTitleMap.js Clean up APIs. 2016-03-04 14:57:31 -08:00
UIExplorerTitle.js Fix warnings in UIExplorer example pages 2016-04-07 21:14:29 -07:00
URIActionMap.js Fix up this pattern var React = require('react-native'); 2016-04-08 20:37:22 -07:00
VibrationExample.js Fix up this pattern var React = require('react-native'); 2016-04-08 20:37:22 -07:00
VibrationIOSExample.js Fix up this pattern var React = require('react-native'); 2016-04-08 20:37:22 -07:00
ViewExample.js Revert "Revert "fix border style without borderRadius"" 2016-05-06 09:23:22 -07:00
ViewPagerAndroidExample.android.js Ability to disable/lock the android ViewPager scroll from props 2016-05-11 16:51:17 -07:00
WebSocketExample.js Clean up and simplify WebSocket implementation on the JS side 2016-04-18 15:43:25 -07:00
WebViewExample.js Fix up this pattern var React = require('react-native'); 2016-04-08 20:37:22 -07:00
XHRExample.android.js Add support for ontimeout and onerror handler when using XMLHttpRequest for Android and iOS 2016-04-15 05:17:21 -07:00
XHRExample.ios.js Add support for ontimeout and onerror handler when using XMLHttpRequest for Android and iOS 2016-04-15 05:17:21 -07:00
XHRExampleCookies.js Add WebView integration example to cookies example 2016-04-25 09:44:26 -07:00
XHRExampleFetch.js Fix up this pattern var React = require('react-native'); 2016-04-08 20:37:22 -07:00
XHRExampleHeaders.js Fix up this pattern var React = require('react-native'); 2016-04-08 20:37:22 -07:00
XHRExampleOnTimeOut.js Add support for ontimeout and onerror handler when using XMLHttpRequest for Android and iOS 2016-04-15 05:17:21 -07:00
bunny.png add remote image support to toolbar 2015-09-30 09:21:27 -07:00
createExamplePage.js Fix warnings in UIExplorer example pages 2016-04-07 21:14:29 -07:00
flux@3x.png Managed assets support for RCTConvert 2015-09-29 09:21:39 -07:00
hawk.png add remote image support to toolbar 2015-09-30 09:21:27 -07:00
helloworld.html Support non-image assets in packager 2016-02-03 17:30:39 -08:00
slider-left.png Add option for both min/max track image. 2015-12-21 10:30:39 -08:00
slider-left@2x.png Add option for both min/max track image. 2015-12-21 10:30:39 -08:00
slider-right.png Add option for both min/max track image. 2015-12-21 10:30:39 -08:00
slider-right@2x.png Add option for both min/max track image. 2015-12-21 10:30:39 -08:00
slider.png Add option for both min/max track image. 2015-12-21 10:30:39 -08:00
slider@2x.png Add option for both min/max track image. 2015-12-21 10:30:39 -08:00
uie_comment_highlighted@2x.png Update Image docs and examples to the new asset system 2016-01-27 13:47:45 -08:00
uie_comment_normal@2x.png Update Image docs and examples to the new asset system 2016-01-27 13:47:45 -08:00
uie_thumb_big.png added method to set thumb image 2015-11-24 16:10:04 -08:00
uie_thumb_normal@2x.png Update Image docs and examples to the new asset system 2016-01-27 13:47:45 -08:00
uie_thumb_selected@2x.png Update Image docs and examples to the new asset system 2016-01-27 13:47:45 -08:00
websocket_test_server.js Add support for sending binary data in websockets 2016-04-20 08:53:25 -07:00

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).