mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-05-07 23:27:05 +08:00
Small cleanup of TextInputExample
Summary: Use array+map like other examples for DRY. Reviewed By: TheSavior Differential Revision: D13222132 fbshipit-source-id: 15171e496eaef8794c02e853950f666d77372923
This commit is contained in:
committed by
Facebook Github Bot
parent
23845fb15c
commit
7b2e3f8159
@@ -781,25 +781,25 @@ exports.examples = [
|
||||
{
|
||||
title: 'Clear button mode',
|
||||
render: function() {
|
||||
return (
|
||||
<View>
|
||||
<WithLabel label="never">
|
||||
<TextInput style={styles.default} clearButtonMode="never" />
|
||||
</WithLabel>
|
||||
<WithLabel label="while editing">
|
||||
<TextInput style={styles.default} clearButtonMode="while-editing" />
|
||||
</WithLabel>
|
||||
<WithLabel label="unless editing">
|
||||
const clearButtonModes = [
|
||||
'never',
|
||||
'while-editing',
|
||||
'unless-editing',
|
||||
'always',
|
||||
];
|
||||
const examples = clearButtonModes.map(mode => {
|
||||
return (
|
||||
<WithLabel label={mode}>
|
||||
<TextInput
|
||||
key={mode}
|
||||
style={styles.default}
|
||||
clearButtonMode="unless-editing"
|
||||
clearButtonMode={mode}
|
||||
defaultValue={mode}
|
||||
/>
|
||||
</WithLabel>
|
||||
<WithLabel label="always">
|
||||
<TextInput style={styles.default} clearButtonMode="always" />
|
||||
</WithLabel>
|
||||
</View>
|
||||
);
|
||||
);
|
||||
});
|
||||
return <View>{examples}</View>;
|
||||
},
|
||||
},
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user