Skip to content

Commit 79e24ed

Browse files
hramosfacebook-github-bot
authored andcommitted
Migrate additional docs to the new format
Summary: [DOCS] Closes #16874 Differential Revision: D6375515 Pulled By: hramos fbshipit-source-id: 64359b45a37c7b478919121573ca04dbb1ce6609
1 parent f587f8d commit 79e24ed

19 files changed

+1336
-1406
lines changed

Libraries/ActionSheetIOS/ActionSheetIOS.js

+15-23
Original file line numberDiff line numberDiff line change
@@ -16,34 +16,27 @@ var RCTActionSheetManager = require('NativeModules').ActionSheetManager;
1616
var invariant = require('fbjs/lib/invariant');
1717
var processColor = require('processColor');
1818

19+
/**
20+
* Display action sheets and share sheets on iOS.
21+
*
22+
* See http://facebook.github.io/react-native/docs/actionsheetios.html
23+
*/
1924
var ActionSheetIOS = {
2025
/**
21-
* Display an iOS action sheet. The `options` object must contain one or more
22-
* of:
23-
*
26+
* Display an iOS action sheet.
27+
*
28+
* The `options` object must contain one or more of:
29+
*
2430
* - `options` (array of strings) - a list of button titles (required)
2531
* - `cancelButtonIndex` (int) - index of cancel button in `options`
2632
* - `destructiveButtonIndex` (int) - index of destructive button in `options`
2733
* - `title` (string) - a title to show above the action sheet
2834
* - `message` (string) - a message to show below the title
29-
* - `tintColor` (color) - tint color of the buttons
30-
*
35+
*
3136
* The 'callback' function takes one parameter, the zero-based index
3237
* of the selected item.
33-
*
34-
* Minimal example:
3538
*
36-
* ```
37-
* ActionSheetIOS.showActionSheetWithOptions({
38-
* options: ['Remove', 'Cancel'],
39-
* destructiveButtonIndex: 1,
40-
* cancelButtonIndex: 0,
41-
* },
42-
* (buttonIndex) => {
43-
* if (buttonIndex === 1) { // destructive action }
44-
* });
45-
* ```
46-
*
39+
* See http://facebook.github.io/react-native/docs/actionsheetios.html#showactionsheetwithoptions
4740
*/
4841
showActionSheetWithOptions(options: Object, callback: Function) {
4942
invariant(
@@ -68,13 +61,10 @@ var ActionSheetIOS = {
6861
* - `url` (string) - a URL to share
6962
* - `message` (string) - a message to share
7063
* - `subject` (string) - a subject for the message
71-
* - `excludedActivityTypes` (array) - the activities to exclude from the ActionSheet
64+
* - `excludedActivityTypes` (array) - the activities to exclude from
65+
* the ActionSheet
7266
* - `tintColor` (color) - tint color of the buttons
7367
*
74-
* NOTE: if `url` points to a local file, or is a base64-encoded
75-
* uri, the file it points to will be loaded and shared directly.
76-
* In this way, you can share images, videos, PDF files, etc.
77-
*
7868
* The 'failureCallback' function takes one parameter, an error object.
7969
* The only property defined on this object is an optional `stack` property
8070
* of type `string`.
@@ -83,6 +73,8 @@ var ActionSheetIOS = {
8373
*
8474
* - a boolean value signifying success or failure
8575
* - a string that, in the case of success, indicates the method of sharing
76+
*
77+
* See http://facebook.github.io/react-native/docs/actionsheetios.html#showshareactionsheetwithoptions
8678
*/
8779
showShareActionSheetWithOptions(
8880
options: Object,

Libraries/Alert/Alert.js

+7-45
Original file line numberDiff line numberDiff line change
@@ -30,54 +30,16 @@ type Options = {
3030

3131
/**
3232
* Launches an alert dialog with the specified title and message.
33-
*
34-
* Optionally provide a list of buttons. Tapping any button will fire the
35-
* respective onPress callback and dismiss the alert. By default, the only
36-
* button will be an 'OK' button.
37-
*
38-
* This is an API that works both on iOS and Android and can show static
39-
* alerts. To show an alert that prompts the user to enter some information,
40-
* see `AlertIOS`; entering text in an alert is common on iOS only.
41-
*
42-
* ## iOS
43-
*
44-
* On iOS you can specify any number of buttons. Each button can optionally
45-
* specify a style, which is one of 'default', 'cancel' or 'destructive'.
46-
*
47-
* ## Android
48-
*
49-
* On Android at most three buttons can be specified. Android has a concept
50-
* of a neutral, negative and a positive button:
51-
*
52-
* - If you specify one button, it will be the 'positive' one (such as 'OK')
53-
* - Two buttons mean 'negative', 'positive' (such as 'Cancel', 'OK')
54-
* - Three buttons mean 'neutral', 'negative', 'positive' (such as 'Later', 'Cancel', 'OK')
55-
*
56-
* By default alerts on Android can be dismissed by tapping outside of the alert
57-
* box. This event can be handled by providing an optional `options` parameter,
58-
* with an `onDismiss` callback property `{ onDismiss: () => {} }`.
59-
*
60-
* Alternatively, the dismissing behavior can be disabled altogether by providing
61-
* an optional `options` parameter with the `cancelable` property set to `false`
62-
* i.e. `{ cancelable: false }`
63-
*
64-
* Example usage:
65-
* ```
66-
* // Works on both iOS and Android
67-
* Alert.alert(
68-
* 'Alert Title',
69-
* 'My Alert Msg',
70-
* [
71-
* {text: 'Ask me later', onPress: () => console.log('Ask me later pressed')},
72-
* {text: 'Cancel', onPress: () => console.log('Cancel Pressed'), style: 'cancel'},
73-
* {text: 'OK', onPress: () => console.log('OK Pressed')},
74-
* ],
75-
* { cancelable: false }
76-
* )
77-
* ```
33+
*
34+
* See http://facebook.github.io/react-native/docs/alert.html
7835
*/
7936
class Alert {
8037

38+
/**
39+
* Launches an alert dialog with the specified title and message.
40+
*
41+
* See http://facebook.github.io/react-native/docs/alert.html#alert
42+
*/
8143
static alert(
8244
title: ?string,
8345
message?: ?string,

Libraries/Alert/AlertIOS.js

+5-90
Original file line numberDiff line numberDiff line change
@@ -77,60 +77,15 @@ export type ButtonsArray = Array<{
7777
}>;
7878

7979
/**
80-
* @description
81-
* `AlertIOS` provides functionality to create an iOS alert dialog with a
82-
* message or create a prompt for user input.
83-
*
84-
* Creating an iOS alert:
85-
*
86-
* ```
87-
* AlertIOS.alert(
88-
* 'Sync Complete',
89-
* 'All your data are belong to us.'
90-
* );
91-
* ```
92-
*
93-
* Creating an iOS prompt:
94-
*
95-
* ```
96-
* AlertIOS.prompt(
97-
* 'Enter a value',
98-
* null,
99-
* text => console.log("You entered "+text)
100-
* );
101-
* ```
102-
*
103-
* We recommend using the [`Alert.alert`](docs/alert.html) method for
104-
* cross-platform support if you don't need to create iOS-only prompts.
80+
* Use `AlertIOS` to display an alert dialog with a message or to create a prompt for user input on iOS. If you don't need to prompt for user input, we recommend using `Alert.alert() for cross-platform support.
10581
*
82+
* See http://facebook.github.io/react-native/docs/alertios.html
10683
*/
10784
class AlertIOS {
10885
/**
10986
* Create and display a popup alert.
110-
* @static
111-
* @method alert
112-
* @param title The dialog's title. Passing null or '' will hide the title.
113-
* @param message An optional message that appears below
114-
* the dialog's title.
115-
* @param callbackOrButtons This optional argument should
116-
* be either a single-argument function or an array of buttons. If passed
117-
* a function, it will be called when the user taps 'OK'.
118-
*
119-
* If passed an array of button configurations, each button should include
120-
* a `text` key, as well as optional `onPress` and `style` keys. `style`
121-
* should be one of 'default', 'cancel' or 'destructive'.
122-
* @param type Deprecated, do not use.
12387
*
124-
* @example <caption>Example with custom buttons</caption>
125-
*
126-
* AlertIOS.alert(
127-
* 'Update available',
128-
* 'Keep your app up to date to enjoy the latest features',
129-
* [
130-
* {text: 'Cancel', onPress: () => console.log('Cancel Pressed'), style: 'cancel'},
131-
* {text: 'Install', onPress: () => console.log('Install Pressed')},
132-
* ],
133-
* );
88+
* See http://facebook.github.io/react-native/docs/alertios.html#alert
13489
*/
13590
static alert(
13691
title: ?string,
@@ -148,48 +103,8 @@ class AlertIOS {
148103

149104
/**
150105
* Create and display a prompt to enter some text.
151-
* @static
152-
* @method prompt
153-
* @param title The dialog's title.
154-
* @param message An optional message that appears above the text
155-
* input.
156-
* @param callbackOrButtons This optional argument should
157-
* be either a single-argument function or an array of buttons. If passed
158-
* a function, it will be called with the prompt's value when the user
159-
* taps 'OK'.
160-
*
161-
* If passed an array of button configurations, each button should include
162-
* a `text` key, as well as optional `onPress` and `style` keys (see
163-
* example). `style` should be one of 'default', 'cancel' or 'destructive'.
164-
* @param type This configures the text input. One of 'plain-text',
165-
* 'secure-text' or 'login-password'.
166-
* @param defaultValue The default text in text input.
167-
* @param keyboardType The keyboard type of first text field(if exists).
168-
* One of 'default', 'email-address', 'numeric', 'phone-pad',
169-
* 'ascii-capable', 'numbers-and-punctuation', 'url', 'number-pad',
170-
* 'name-phone-pad', 'decimal-pad', 'twitter' or 'web-search'.
171-
*
172-
* @example <caption>Example with custom buttons</caption>
173-
*
174-
* AlertIOS.prompt(
175-
* 'Enter password',
176-
* 'Enter your password to claim your $1.5B in lottery winnings',
177-
* [
178-
* {text: 'Cancel', onPress: () => console.log('Cancel Pressed'), style: 'cancel'},
179-
* {text: 'OK', onPress: password => console.log('OK Pressed, password: ' + password)},
180-
* ],
181-
* 'secure-text'
182-
* );
183-
*
184-
* @example <caption>Example with the default button and a custom callback</caption>
185-
*
186-
* AlertIOS.prompt(
187-
* 'Update username',
188-
* null,
189-
* text => console.log("Your username is "+text),
190-
* null,
191-
* 'default'
192-
* );
106+
*
107+
* See http://facebook.github.io/react-native/docs/alertios.html#prompt
193108
*/
194109
static prompt(
195110
title: ?string,

0 commit comments

Comments
 (0)