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:
Spencer Ahrens
2018-11-27 17:29:48 -08:00
committed by Facebook Github Bot
parent 23845fb15c
commit 7b2e3f8159

View File

@@ -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>;
},
},
{