diff --git a/docs/Accessibility.md b/docs/Accessibility.md index c7c5f291824..b0921506497 100644 --- a/docs/Accessibility.md +++ b/docs/Accessibility.md @@ -5,7 +5,7 @@ layout: docs category: Guides permalink: docs/accessibility.html next: timers -previous: debugging +previous: animations --- ## Native App Accessibility (iOS and Android) diff --git a/docs/AndroidBuildingFromSource.md b/docs/AndroidBuildingFromSource.md index 326828a7f6e..5b6ecb90b82 100644 --- a/docs/AndroidBuildingFromSource.md +++ b/docs/AndroidBuildingFromSource.md @@ -153,11 +153,11 @@ Start by following the `Point Gradle to your Android SDK` section of this page. ./gradlew ReactAndroid:installArchives ``` -This will package everything that would typically be included in the `android` directory of your `node_modules/react-native/` installation in the root directory of your React Native checkout. +This will package everything that would typically be included in the `android` directory of your `node_modules/react-native/` installation in the root directory of your React Native checkout. ## Testing -If you made changes to React Native and submit a pull request, all tests will run on your pull request automatically. To run the tests locally, see [Testing](docs/testing.html). +If you made changes to React Native and submit a pull request, all tests will run on your pull request automatically. To run the tests locally, see [Running Tests](docs/testing.html). ## Troubleshooting diff --git a/docs/Animations.md b/docs/Animations.md index faaea60ea6c..11fa2792997 100644 --- a/docs/Animations.md +++ b/docs/Animations.md @@ -4,8 +4,8 @@ title: Animations layout: docs category: Guides permalink: docs/animations.html -next: navigation -previous: handling-touches +next: accessibility +previous: images --- Animations are very important to create a great user experience. diff --git a/docs/BuildingForAppleTV.md b/docs/BuildingForAppleTV.md index a735a1a718f..05bf08f0d83 100644 --- a/docs/BuildingForAppleTV.md +++ b/docs/BuildingForAppleTV.md @@ -2,7 +2,7 @@ id: building-for-apple-tv title: Building For Apple TV layout: docs -category: Guides (Apple TV) +category: Guides (iOS) permalink: docs/building-for-apple-tv.html banner: ejected next: native-modules-android @@ -84,12 +84,10 @@ class Game2048 extends React.Component { ``` -- *TV remote animations*: `RCTTVView` native code implements Apple-recommended parallax animations to help guide the eye as the user navigates through views. The animations can be disabled or adjusted with new optional view properties. +- *TV remote animations*: `RCTTVView` native code implements Apple-recommended parallax animations to help guide the eye as the user navigates through views. The animations can be disabled or adjusted with new optional view properties. - *Back navigation with the TV remote menu button*: The `BackHandler` component, originally written to support the Android back button, now also supports back navigation on the Apple TV using the menu button on the TV remote. - *Known issues*: - [ListView scrolling](https://github.com/facebook/react-native/issues/12793). The issue can be easily worked around by setting `removeClippedSubviews` to false in ListView and similar components. For more discussion of this issue, see [this PR](https://github.com/facebook/react-native/pull/12944). - - diff --git a/docs/Colors.md b/docs/Colors.md index a1b7f8f3923..ccdcf2d5c9a 100644 --- a/docs/Colors.md +++ b/docs/Colors.md @@ -1,11 +1,11 @@ --- id: colors -title: Colors +title: Color Reference layout: docs category: Guides permalink: docs/colors.html -next: platform-specific-code -previous: images +next: integration-with-existing-apps +previous: direct-manipulation --- Components in React Native are [styled using JavaScript](docs/styles.html). Color properties usually match how [CSS works on the web](https://developer.mozilla.org/en-US/docs/Web/CSS/color_value). diff --git a/docs/Debugging.md b/docs/Debugging.md index a2298188018..1b7b4c8c017 100644 --- a/docs/Debugging.md +++ b/docs/Debugging.md @@ -4,8 +4,8 @@ title: Debugging layout: docs category: Guides permalink: docs/debugging.html -next: accessibility -previous: platform-specific-code +next: performance +previous: timers --- ## Enabling Keyboard Shortcuts diff --git a/docs/DirectManipulation.md b/docs/DirectManipulation.md index ae0924cde9f..1982d2b7d26 100644 --- a/docs/DirectManipulation.md +++ b/docs/DirectManipulation.md @@ -4,7 +4,7 @@ title: Direct Manipulation layout: docs category: Guides permalink: docs/direct-manipulation.html -next: performance +next: colors previous: javascript-environment --- @@ -227,3 +227,43 @@ By [intelligently applying you can avoid the unnecessary overhead involved in reconciling unchanged component subtrees, to the point where it may be performant enough to use `setState` instead of `setNativeProps`. + +## Other native methods + +The methods described here are available on most of the default components provided by React Native. Note, however, that they are *not* available on composite components that aren't directly backed by a native view. This will generally include most components that you define in your own app. + +### measure(callback) + +Determines the location on screen, width, and height of the given view and returns the values via an async callback. If successful, the callback will be called with the following arguments: + +* x +* y +* width +* height +* pageX +* pageY + +Note that these measurements are not available until after the rendering has been completed in native. If you need the measurements as soon as possible, consider using the [`onLayout` prop](docs/view.html#onlayout) instead. + +### measureInWindow(callback) + +Determines the location of the given view in the window and returns the values via an async callback. If the React root view is embedded in another native view, this will give you the absolute coordinates. If successful, the callback will be called with the following arguments: + +* x +* y +* width +* height + +### measureLayout(relativeToNativeNode, onSuccess, onFail) + +Like `measure()`, but measures the view relative an ancestor, specified as `relativeToNativeNode`. This means that the returned x, y are relative to the origin x, y of the ancestor view. + +As always, to obtain a native node handle for a component, you can use `ReactNative.findNodeHandle(component)`. + +### focus() + +Requests focus for the given input or view. The exact behavior triggered will depend on the platform and type of view. + +### blur() + +Removes focus from an input or view. This is the opposite of `focus()`. diff --git a/docs/GestureResponderSystem.md b/docs/GestureResponderSystem.md index a53faef6c59..52c22533ccf 100644 --- a/docs/GestureResponderSystem.md +++ b/docs/GestureResponderSystem.md @@ -4,7 +4,7 @@ title: Gesture Responder System layout: docs category: Guides permalink: docs/gesture-responder-system.html -next: testing +next: javascript-environment previous: performance --- diff --git a/docs/HandlingTextInput.md b/docs/HandlingTextInput.md index 9fe4b979789..1e1ef3478a7 100644 --- a/docs/HandlingTextInput.md +++ b/docs/HandlingTextInput.md @@ -4,7 +4,7 @@ title: Handling Text Input layout: docs category: The Basics permalink: docs/handling-text-input.html -next: using-a-scrollview +next: handling-touches previous: flexbox --- diff --git a/docs/HandlingTouches.md b/docs/HandlingTouches.md index c295b125371..0b1416cb32c 100644 --- a/docs/HandlingTouches.md +++ b/docs/HandlingTouches.md @@ -2,41 +2,97 @@ id: handling-touches title: Handling Touches layout: docs -category: Guides +category: The Basics permalink: docs/handling-touches.html -next: animations -previous: components +next: using-a-scrollview +previous: handling-text-input --- -Users interact with mobile apps mainly through touch. They can use a combination of gestures, such as tapping on a button, scrolling a list, or zooming on a map. +Users interact with mobile apps mainly through touch. They can use a combination of gestures, such as tapping on a button, scrolling a list, or zooming on a map. React Native provides components to handle all sorts of common gestures, as well as a comprehensive [gesture responder system](docs/gesture-responder-system.html) to allow for more advanced gesture recognition, but the one component you will most likely be interested in is the basic Button. -React Native provides components to handle common gestures, such as taps and swipes, as well as a comprehensive [gesture responder system](docs/gesture-responder-system.html) to allow for more advanced gesture recognition. +## Displaying a basic button -## Tappable Components - -You can use "Touchable" components when you want to capture a tapping gesture. They take a function through the `onPress` props which will be called when the touch begins and ends within the bounds of the component. - -Example: +[Button](docs/button.html) provides a basic button component that is rendered nicely on all platforms. The minimal example to display a button looks like this: ```javascript -class MyButton extends Component { +