Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Docs] Migrate to new documentation format #16790

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,16 @@ type ChangeEventName = $Enum<{

var _subscriptions = new Map();

/**
* Sometimes it's useful to know whether or not the device has a screen reader
* that is currently active. The `AccessibilityInfo` API is designed for this
* purpose. You can use it to query the current state of the screen reader as
* well as to register to be notified when the state of the screen reader
* changes.
*
* See http://facebook.github.io/react-native/docs/accessibilityinfo.html
*/

var AccessibilityInfo = {

fetch: function(): Promise {
Expand Down
85 changes: 30 additions & 55 deletions Libraries/Components/AccessibilityInfo/AccessibilityInfo.ios.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,61 +28,23 @@ type ChangeEventName = $Enum<{
var _subscriptions = new Map();

/**
* Sometimes it's useful to know whether or not the device has a screen reader that is currently active. The
* `AccessibilityInfo` API is designed for this purpose. You can use it to query the current state of the
* screen reader as well as to register to be notified when the state of the screen reader changes.
* Sometimes it's useful to know whether or not the device has a screen reader
* that is currently active. The `AccessibilityInfo` API is designed for this
* purpose. You can use it to query the current state of the screen reader as
* well as to register to be notified when the state of the screen reader
* changes.
*
* Here's a small example illustrating how to use `AccessibilityInfo`:
*
* ```javascript
* class ScreenReaderStatusExample extends React.Component {
* state = {
* screenReaderEnabled: false,
* }
*
* componentDidMount() {
* AccessibilityInfo.addEventListener(
* 'change',
* this._handleScreenReaderToggled
* );
* AccessibilityInfo.fetch().done((isEnabled) => {
* this.setState({
* screenReaderEnabled: isEnabled
* });
* });
* }
*
* componentWillUnmount() {
* AccessibilityInfo.removeEventListener(
* 'change',
* this._handleScreenReaderToggled
* );
* }
*
* _handleScreenReaderToggled = (isEnabled) => {
* this.setState({
* screenReaderEnabled: isEnabled,
* });
* }
*
* render() {
* return (
* <View>
* <Text>
* The screen reader is {this.state.screenReaderEnabled ? 'enabled' : 'disabled'}.
* </Text>
* </View>
* );
* }
* }
* ```
* See http://facebook.github.io/react-native/docs/accessibilityinfo.html
*/
var AccessibilityInfo = {

/**
* Query whether a screen reader is currently enabled. Returns a promise which
* resolves to a boolean. The result is `true` when a screen reader is enabled
* and `false` otherwise.
* Query whether a screen reader is currently enabled.
*
* Returns a promise which resolves to a boolean.
* The result is `true` when a screen reader is enabledand `false` otherwise.
*
* See http://facebook.github.io/react-native/docs/accessibilityinfo.html#fetch
*/
fetch: function(): Promise {
return new Promise((resolve, reject) => {
Expand All @@ -100,10 +62,13 @@ var AccessibilityInfo = {
* to the event handler is a boolean. The boolean is `true` when a screen
* reader is enabled and `false` otherwise.
* - `announcementFinished`: iOS-only event. Fires when the screen reader has
* finished making an announcement. The argument to the event handler is a dictionary
* with these keys:
* finished making an announcement. The argument to the event handler is a
* dictionary with these keys:
* - `announcement`: The string announced by the screen reader.
* - `success`: A boolean indicating whether the announcement was successfully made.
* - `success`: A boolean indicating whether the announcement was
* successfully made.
*
* See http://facebook.github.io/react-native/docs/accessibilityinfo.html#addeventlistener
*/
addEventListener: function (
eventName: ChangeEventName,
Expand All @@ -130,7 +95,11 @@ var AccessibilityInfo = {
},

/**
* iOS-Only. Set accessibility focus to a react component.
* Set accessibility focus to a react component.
*
* @platform ios
*
* See http://facebook.github.io/react-native/docs/accessibilityinfo.html#setaccessibilityfocus
*/
setAccessibilityFocus: function(
reactTag: number
Expand All @@ -139,7 +108,11 @@ var AccessibilityInfo = {
},

/**
* iOS-Only. Post a string to be announced by the screen reader.
* Post a string to be announced by the screen reader.
*
* @platform ios
*
* See http://facebook.github.io/react-native/docs/accessibilityinfo.html#announceforaccessibility
*/
announceForAccessibility: function(
announcement: string
Expand All @@ -149,6 +122,8 @@ var AccessibilityInfo = {

/**
* Remove an event handler.
*
* See http://facebook.github.io/react-native/docs/accessibilityinfo.html#removeeventlistener
*/
removeEventListener: function(
eventName: ChangeEventName,
Expand Down
48 changes: 9 additions & 39 deletions Libraries/Components/ActivityIndicator/ActivityIndicator.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,45 +38,7 @@ type DefaultProps = {
/**
* Displays a circular loading indicator.
*
* ### Example
*
* ```ReactNativeWebPlayer
* import React, { Component } from 'react'
* import {
* ActivityIndicator,
* AppRegistry,
* StyleSheet,
* Text,
* View,
* } from 'react-native'
*
* class App extends Component {
* render() {
* return (
* <View style={[styles.container, styles.horizontal]}>
* <ActivityIndicator size="large" color="#0000ff" />
* <ActivityIndicator size="small" color="#00ff00" />
* <ActivityIndicator size="large" color="#0000ff" />
* <ActivityIndicator size="small" color="#00ff00" />
* </View>
* )
* }
* }
*
* const styles = StyleSheet.create({
* container: {
* flex: 1,
* justifyContent: 'center'
* },
* horizontal: {
* flexDirection: 'row',
* justifyContent: 'space-around',
* padding: 10
* }
* })
*
* AppRegistry.registerComponent('App', () => App)
* ```
* See http://facebook.github.io/react-native/docs/activityindicator.html
*/
const ActivityIndicator = createReactClass({
displayName: 'ActivityIndicator',
Expand All @@ -86,15 +48,21 @@ const ActivityIndicator = createReactClass({
...ViewPropTypes,
/**
* Whether to show the indicator (true, the default) or hide it (false).
*
* See http://facebook.github.io/react-native/docs/activityindicator.html#animating
*/
animating: PropTypes.bool,
/**
* The foreground color of the spinner (default is gray).
*
* See http://facebook.github.io/react-native/docs/activityindicator.html#color
*/
color: ColorPropType,
/**
* Size of the indicator (default is 'small').
* Passing a number to the size prop is only supported on Android.
*
* See http://facebook.github.io/react-native/docs/activityindicator.html#size
*/
size: PropTypes.oneOfType([
PropTypes.oneOf([ 'small', 'large' ]),
Expand All @@ -104,6 +72,8 @@ const ActivityIndicator = createReactClass({
* Whether the indicator should hide when not animating (true by default).
*
* @platform ios
*
* See http://facebook.github.io/react-native/docs/activityindicator.html#hideswhenstopped
*/
hidesWhenStopped: PropTypes.bool,
},
Expand Down
45 changes: 2 additions & 43 deletions Libraries/Components/View/View.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,50 +28,9 @@ import type {ViewProps} from 'ViewPropTypes';
export type Props = ViewProps;

/**
* The most fundamental component for building a UI, `View` is a container that supports layout with
* [flexbox](docs/flexbox.html), [style](docs/style.html),
* [some touch handling](docs/handling-touches.html), and
* [accessibility](docs/accessibility.html) controls. `View` maps directly to the
* native view equivalent on whatever platform React Native is running on, whether that is a
* `UIView`, `<div>`, `android.view`, etc.
* The most fundamental component for building a UI.
*
* `View` is designed to be nested inside other views and can have 0 to many children of any type.
*
* This example creates a `View` that wraps two colored boxes and a text component in a row with
* padding.
*
* ```javascript
* class ViewColoredBoxesWithText extends Component {
* render() {
* return (
* <View style={{flexDirection: 'row', height: 100, padding: 20}}>
* <View style={{backgroundColor: 'blue', flex: 0.3}} />
* <View style={{backgroundColor: 'red', flex: 0.5}} />
* <Text>Hello World!</Text>
* </View>
* );
* }
* }
* ```
*
* > `View`s are designed to be used with [`StyleSheet`](docs/style.html) for clarity
* > and performance, although inline styles are also supported.
*
* ### Synthetic Touch Events
*
* For `View` responder props (e.g., `onResponderMove`), the synthetic touch event passed to them
* are of the following form:
*
* - `nativeEvent`
* - `changedTouches` - Array of all touch events that have changed since the last event.
* - `identifier` - The ID of the touch.
* - `locationX` - The X position of the touch, relative to the element.
* - `locationY` - The Y position of the touch, relative to the element.
* - `pageX` - The X position of the touch, relative to the root element.
* - `pageY` - The Y position of the touch, relative to the root element.
* - `target` - The node id of the element receiving the touch event.
* - `timestamp` - A time identifier for the touch, useful for velocity calculation.
* - `touches` - Array of all current touches on the screen.
* See http://facebook.github.io/react-native/docs/view.html
*/
const View = createReactClass({
displayName: 'View',
Expand Down
Loading