Skip to content

Commit 124af69

Browse files
committed
Add ability to disable only the visibility button
1 parent f45af84 commit 124af69

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/PasswordField.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ class PasswordField extends React.Component {
102102

103103
render () {
104104
const {
105+
disableButton,
105106
hintText,
106107
errorText,
107108
errorStyle,
@@ -140,7 +141,7 @@ class PasswordField extends React.Component {
140141
onTouchTap={() => this.toggleVisibility()}
141142
iconStyle={styles.visibilityIcon}
142143
style={styles.visibilityButton}
143-
disabled={other.disabled}
144+
disabled={disableButton || other.disabled}
144145
>
145146
{visible ? <Visibility /> : <VisibilityOff />}
146147
</IconButton>
@@ -152,6 +153,7 @@ class PasswordField extends React.Component {
152153
if (process.env.NODE_ENV !== 'production') {
153154
PasswordField.propTypes = {
154155
...TextField.propTypes,
156+
disableButton: PropTypes.bool,
155157
visible: PropTypes.bool,
156158
textFieldStyle: PropTypes.object
157159
}

0 commit comments

Comments
 (0)