mirror of
https://github.com/status-im/react-native.git
synced 2025-02-03 13:14:42 +00:00
Set the enabled state on disabled button views
Reviewed By: AaaChiuuu Differential Revision: D4722513 fbshipit-source-id: f4a4e6304594235b5da4e5be36358331e43bdbee
This commit is contained in:
parent
d80f9dfa99
commit
b5327dd388
@ -124,7 +124,7 @@ class Button extends React.Component {
|
||||
disabled={disabled}
|
||||
onPress={onPress}>
|
||||
<View style={buttonStyles}>
|
||||
<Text style={textStyles}>{formattedTitle}</Text>
|
||||
<Text style={textStyles} disabled={disabled}>{formattedTitle}</Text>
|
||||
</View>
|
||||
</Touchable>
|
||||
);
|
||||
|
@ -30,6 +30,7 @@ exports[`TouchableHighlight renders correctly 1`] = `
|
||||
<Text
|
||||
accessible={true}
|
||||
allowFontScaling={true}
|
||||
disabled={false}
|
||||
ellipsizeMode="tail"
|
||||
>
|
||||
Touchable
|
||||
|
@ -202,12 +202,18 @@ const Text = React.createClass({
|
||||
* @platform ios
|
||||
*/
|
||||
minimumFontScale: PropTypes.number,
|
||||
/**
|
||||
* Specifies the disabled state of the text view for testing purposes
|
||||
* @platform android
|
||||
*/
|
||||
disabled: PropTypes.bool,
|
||||
},
|
||||
getDefaultProps(): Object {
|
||||
return {
|
||||
accessible: true,
|
||||
allowFontScaling: true,
|
||||
ellipsizeMode: 'tail',
|
||||
disabled: false,
|
||||
};
|
||||
},
|
||||
getInitialState: function(): Object {
|
||||
|
@ -157,6 +157,11 @@ public class ReactTextViewManager extends BaseViewManager<ReactTextView, ReactTe
|
||||
view.setIncludeFontPadding(includepad);
|
||||
}
|
||||
|
||||
@ReactProp(name = "disabled", defaultBoolean = false)
|
||||
public void setDisabled(ReactTextView view, boolean disabled) {
|
||||
view.setEnabled(!disabled);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateExtraData(ReactTextView view, Object extraData) {
|
||||
ReactTextUpdate update = (ReactTextUpdate) extraData;
|
||||
|
Loading…
x
Reference in New Issue
Block a user