mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-04-23 20:01:01 +08:00
Add secure and login-password types to AlertIOS.
Summary: Request from issue #3893 * Added support for `secure-text` and `login-password` types to AlertIOS. * Fixed and extended the cancel button highlighting functionality, which was broken at some point * Added localization for default `OK` and `Cancel` labels when using UIAlertController Closes https://github.com/facebook/react-native/pull/4401 Reviewed By: javache Differential Revision: D2702052 Pulled By: nicklockwood fb-gh-sync-id: cce312d7fec949f5fd2a7c656e65c657c4832c8f
This commit is contained in:
committed by
facebook-github-bot-7
parent
7242efde0a
commit
f025049b6c
@@ -43,7 +43,7 @@ exports.examples = [{
|
||||
</TouchableHighlight>
|
||||
<TouchableHighlight style={styles.wrapper}
|
||||
onPress={() => AlertIOS.alert(
|
||||
null,
|
||||
'Foo Title',
|
||||
null,
|
||||
[
|
||||
{text: 'Button', onPress: () => console.log('Button Pressed!')},
|
||||
@@ -97,6 +97,87 @@ exports.examples = [{
|
||||
);
|
||||
}
|
||||
},
|
||||
{
|
||||
title: 'Alert Types',
|
||||
render() {
|
||||
return (
|
||||
<View>
|
||||
<TouchableHighlight
|
||||
style={styles.wrapper}
|
||||
onPress={() => AlertIOS.alert(
|
||||
'Hello World',
|
||||
null,
|
||||
[
|
||||
{text: 'OK', onPress: (text) => console.log('OK pressed')},
|
||||
],
|
||||
'default'
|
||||
)}>
|
||||
|
||||
<View style={styles.button}>
|
||||
<Text>
|
||||
{'default'}
|
||||
</Text>
|
||||
</View>
|
||||
|
||||
</TouchableHighlight>
|
||||
<TouchableHighlight
|
||||
style={styles.wrapper}
|
||||
onPress={() => AlertIOS.alert(
|
||||
'Plain Text Entry',
|
||||
null,
|
||||
[
|
||||
{text: 'Submit', onPress: (text) => console.log('Text: ' + text)},
|
||||
],
|
||||
'plain-text'
|
||||
)}>
|
||||
|
||||
<View style={styles.button}>
|
||||
<Text>
|
||||
plain-text
|
||||
</Text>
|
||||
</View>
|
||||
|
||||
</TouchableHighlight>
|
||||
<TouchableHighlight
|
||||
style={styles.wrapper}
|
||||
onPress={() => AlertIOS.alert(
|
||||
'Secure Text Entry',
|
||||
null,
|
||||
[
|
||||
{text: 'Submit', onPress: (text) => console.log('Password: ' + text)},
|
||||
],
|
||||
'secure-text'
|
||||
)}>
|
||||
|
||||
<View style={styles.button}>
|
||||
<Text>
|
||||
secure-text
|
||||
</Text>
|
||||
</View>
|
||||
|
||||
</TouchableHighlight>
|
||||
<TouchableHighlight
|
||||
style={styles.wrapper}
|
||||
onPress={() => AlertIOS.alert(
|
||||
'Login & Password',
|
||||
null,
|
||||
[
|
||||
{text: 'Submit', onPress: (details) => console.log('Login: ' + details.login + '; Password: ' + details.password)},
|
||||
],
|
||||
'login-password'
|
||||
)}>
|
||||
|
||||
<View style={styles.button}>
|
||||
<Text>
|
||||
login-password
|
||||
</Text>
|
||||
</View>
|
||||
|
||||
</TouchableHighlight>
|
||||
</View>
|
||||
);
|
||||
}
|
||||
},
|
||||
{
|
||||
title: 'Prompt',
|
||||
render(): React.Component {
|
||||
@@ -116,10 +197,11 @@ class PromptExample extends React.Component {
|
||||
this.title = 'Type a value';
|
||||
this.defaultValue = 'Default value';
|
||||
this.buttons = [{
|
||||
text: 'Custom cancel',
|
||||
}, {
|
||||
text: 'Custom OK',
|
||||
onPress: this.promptResponse
|
||||
}, {
|
||||
text: 'Custom Cancel',
|
||||
style: 'cancel',
|
||||
}];
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user