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

Alert - allow for hiding alert title on iOS #15685

Closed
wants to merge 2 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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 4 additions & 2 deletions Libraries/Alert/AlertIOS.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,8 @@ class AlertIOS {
* @static
* @method alert
* @param title The dialog's title.
*
* An empty string hides the title.
* @param message An optional message that appears below
* the dialog's title.
* @param callbackOrButtons This optional argument should
Expand Down Expand Up @@ -209,7 +211,7 @@ class AlertIOS {
var callback = type;
var defaultValue = message;
RCTAlertManager.alertWithArgs({
title: title || undefined,
title: title,
type: 'plain-text',
defaultValue,
}, (id, value) => {
Expand Down Expand Up @@ -242,7 +244,7 @@ class AlertIOS {
}

RCTAlertManager.alertWithArgs({
title: title || undefined,
title: title,
message: message || undefined,
buttons,
type: type || undefined,
Expand Down
12 changes: 12 additions & 0 deletions RNTester/js/AlertExample.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,18 @@ class SimpleAlertExampleBlock extends React.Component {
<Text>Alert that cannot be dismissed</Text>
</View>
</TouchableHighlight>
<TouchableHighlight style={styles.wrapper}
onPress={() => Alert.alert(
'',
alertMessage,
[
{text: 'OK', onPress: () => console.log('OK Pressed!')},
]
)}>
<View style={styles.button}>
<Text>Alert without title</Text>
</View>
</TouchableHighlight>
</View>
);
}
Expand Down