Implement TextInput.clearButtonMode added by D1875684 on OSS fork + example

This commit is contained in:
Tadeu Zagallo 2015-02-27 08:40:52 -08:00
parent c7b5a1ddfa
commit 078300ce08
3 changed files with 42 additions and 0 deletions

View File

@ -185,4 +185,37 @@ exports.examples = [
);
}
},
{
title: 'Clear button mode',
render: function () {
return (
<View>
<WithLabel label="never">
<TextInput
style={styles.default}
clearButtonMode={TextInput.clearButtonModeTypes.never}
/>
</WithLabel>
<WithLabel label="while editing">
<TextInput
style={styles.default}
clearButtonMode={TextInput.clearButtonModeTypes.whileEditing}
/>
</WithLabel>
<WithLabel label="unless editing">
<TextInput
style={styles.default}
clearButtonMode={TextInput.clearButtonModeTypes.unlessEditing}
/>
</WithLabel>
<WithLabel label="always">
<TextInput
style={styles.default}
clearButtonMode={TextInput.clearButtonModeTypes.always}
/>
</WithLabel>
</View>
);
}
},
];

View File

@ -1293,6 +1293,14 @@ static void RCTSetShadowViewProps(NSDictionary *props, RCTShadowView *shadowView
@"None": @(UITextAutocapitalizationTypeNone),
},
},
@"UITextField": @{
@"clearButtonMode": @{
@"Never": @(UITextFieldViewModeNever),
@"WhileEditing": @(UITextFieldViewModeWhileEditing),
@"UnlessEditing": @(UITextFieldViewModeUnlessEditing),
@"Always": @(UITextFieldViewModeAlways),
},
},
@"UIView": @{
@"ContentMode": @{
@"ScaleToFill": @(UIViewContentModeScaleToFill),

View File

@ -19,6 +19,7 @@ RCT_EXPORT_VIEW_PROPERTY(enabled)
RCT_EXPORT_VIEW_PROPERTY(placeholder)
RCT_EXPORT_VIEW_PROPERTY(text)
RCT_EXPORT_VIEW_PROPERTY(font)
RCT_EXPORT_VIEW_PROPERTY(clearButtonMode)
RCT_REMAP_VIEW_PROPERTY(autoCapitalize, autocapitalizationType)
RCT_EXPORT_VIEW_PROPERTY(keyboardType)
RCT_REMAP_VIEW_PROPERTY(color, textColor)