-
Notifications
You must be signed in to change notification settings - Fork 24.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Flatten jsdocs to markdown plaintext
Differential Revision: D6261799 fbshipit-source-id: 269e151c5d136c1d508d9f2a060c0c670d0fe0f2
- Loading branch information
1 parent
7df58e2
commit 9ec9567
Showing
124 changed files
with
19,508 additions
and
66 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,156 @@ | ||
--- | ||
id: accessibilityinfo | ||
title: AccessibilityInfo | ||
layout: docs | ||
category: APIs | ||
permalink: docs/accessibilityinfo.html | ||
next: actionsheetios | ||
previous: webview | ||
--- | ||
|
||
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> | ||
); | ||
} | ||
} | ||
``` | ||
|
||
|
||
### Methods | ||
|
||
- [`fetch`](docs/accessibilityinfo.html#fetch) | ||
- [`addEventListener`](docs/accessibilityinfo.html#addeventlistener) | ||
- [`setAccessibilityFocus`](docs/accessibilityinfo.html#setaccessibilityfocus) | ||
- [`announceForAccessibility`](docs/accessibilityinfo.html#announceforaccessibility) | ||
- [`removeEventListener`](docs/accessibilityinfo.html#removeeventlistener) | ||
|
||
|
||
|
||
|
||
--- | ||
|
||
# Reference | ||
|
||
## Methods | ||
|
||
### `fetch()` | ||
|
||
```javascript | ||
static fetch() | ||
``` | ||
|
||
|
||
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. | ||
|
||
|
||
|
||
|
||
--- | ||
|
||
### `addEventListener()` | ||
|
||
```javascript | ||
static addEventListener(eventName, handler) | ||
``` | ||
|
||
|
||
Add an event handler. Supported events: | ||
|
||
- `change`: Fires when the state of the screen reader changes. The argument | ||
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: | ||
- `announcement`: The string announced by the screen reader. | ||
- `success`: A boolean indicating whether the announcement was successfully made. | ||
|
||
|
||
|
||
|
||
--- | ||
|
||
### `setAccessibilityFocus()` | ||
|
||
```javascript | ||
static setAccessibilityFocus(reactTag) | ||
``` | ||
|
||
|
||
iOS-Only. Set accessibility focus to a react component. | ||
|
||
|
||
|
||
|
||
--- | ||
|
||
### `announceForAccessibility()` | ||
|
||
```javascript | ||
static announceForAccessibility(announcement) | ||
``` | ||
|
||
|
||
iOS-Only. Post a string to be announced by the screen reader. | ||
|
||
|
||
|
||
|
||
--- | ||
|
||
### `removeEventListener()` | ||
|
||
```javascript | ||
static removeEventListener(eventName, handler) | ||
``` | ||
|
||
|
||
Remove an event handler. | ||
|
||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
--- | ||
id: actionsheetios | ||
title: ActionSheetIOS | ||
layout: docs | ||
category: APIs | ||
permalink: docs/actionsheetios.html | ||
next: alert | ||
previous: accessibilityinfo | ||
--- | ||
|
||
|
||
|
||
### Methods | ||
|
||
- [`showActionSheetWithOptions`](docs/actionsheetios.html#showactionsheetwithoptions) | ||
- [`showShareActionSheetWithOptions`](docs/actionsheetios.html#showshareactionsheetwithoptions) | ||
|
||
|
||
|
||
|
||
--- | ||
|
||
# Reference | ||
|
||
## Methods | ||
|
||
### `showActionSheetWithOptions()` | ||
|
||
```javascript | ||
static showActionSheetWithOptions(options, callback) | ||
``` | ||
|
||
|
||
Display an iOS action sheet. The `options` object must contain one or more | ||
of: | ||
|
||
- `options` (array of strings) - a list of button titles (required) | ||
- `cancelButtonIndex` (int) - index of cancel button in `options` | ||
- `destructiveButtonIndex` (int) - index of destructive button in `options` | ||
- `title` (string) - a title to show above the action sheet | ||
- `message` (string) - a message to show below the title | ||
|
||
The 'callback' function takes one parameter, the zero-based index | ||
of the selected item. | ||
|
||
Minimal example: | ||
|
||
``` | ||
ActionSheetIOS.showActionSheetWithOptions({ | ||
options: ['Remove', 'Cancel'], | ||
destructiveButtonIndex: 1, | ||
cancelButtonIndex: 0, | ||
}, | ||
(buttonIndex) => { | ||
if (buttonIndex === 1) { // destructive action } | ||
}); | ||
``` | ||
|
||
|
||
|
||
|
||
|
||
--- | ||
|
||
### `showShareActionSheetWithOptions()` | ||
|
||
```javascript | ||
static showShareActionSheetWithOptions(options, failureCallback, successCallback) | ||
``` | ||
|
||
|
||
Display the iOS share sheet. The `options` object should contain | ||
one or both of `message` and `url` and can additionally have | ||
a `subject` or `excludedActivityTypes`: | ||
|
||
- `url` (string) - a URL to share | ||
- `message` (string) - a message to share | ||
- `subject` (string) - a subject for the message | ||
- `excludedActivityTypes` (array) - the activities to exclude from the ActionSheet | ||
|
||
NOTE: if `url` points to a local file, or is a base64-encoded | ||
uri, the file it points to will be loaded and shared directly. | ||
In this way, you can share images, videos, PDF files, etc. | ||
|
||
The 'failureCallback' function takes one parameter, an error object. | ||
The only property defined on this object is an optional `stack` property | ||
of type `string`. | ||
|
||
The 'successCallback' function takes two parameters: | ||
|
||
- a boolean value signifying success or failure | ||
- a string that, in the case of success, indicates the method of sharing | ||
|
||
|
||
|
||
|
Oops, something went wrong.