Skip to content

Commit 6646847

Browse files
committed
PasswordInput: Fixed overlap for password and show/hide button Fixes: zulip#5614
1 parent ff4e8a3 commit 6646847

File tree

1 file changed

+17
-9
lines changed

1 file changed

+17
-9
lines changed

src/common/PasswordInput.js

+17-9
Original file line numberDiff line numberDiff line change
@@ -3,24 +3,26 @@ import React, { useState, useCallback } from 'react';
33
import type { Node } from 'react';
44
import { View } from 'react-native';
55

6+
import { Icon } from './Icons';
67
import Input from './Input';
78
import type { Props as InputProps } from './Input';
89
import { BRAND_COLOR, createStyleSheet } from '../styles';
9-
import ZulipTextIntl from './ZulipTextIntl';
1010
import Touchable from './Touchable';
1111

1212
const styles = createStyleSheet({
1313
showPasswordButton: {
14-
position: 'absolute',
15-
right: 0,
16-
top: 0,
17-
bottom: 0,
1814
justifyContent: 'center',
1915
},
20-
showPasswordButtonText: {
16+
showPasswordButtonIcon: {
2117
margin: 8,
2218
color: BRAND_COLOR,
2319
},
20+
passwordTextInput: {
21+
flex: 1,
22+
},
23+
passwordInputView: {
24+
flexDirection: 'row',
25+
},
2426
});
2527

2628
// Prettier wants a ", >" here, which is silly.
@@ -44,10 +46,16 @@ export default function PasswordInput(props: Props): Node {
4446
}, []);
4547

4648
return (
47-
<View>
48-
<Input {...props} secureTextEntry={isHidden} autoCorrect={false} autoCapitalize="none" />
49+
<View style={styles.passwordInputView}>
50+
<Input
51+
{...props}
52+
secureTextEntry={isHidden}
53+
autoCorrect={false}
54+
autoCapitalize="none"
55+
style={styles.passwordTextInput}
56+
/>
4957
<Touchable style={styles.showPasswordButton} onPress={handleShow}>
50-
<ZulipTextIntl style={styles.showPasswordButtonText} text={isHidden ? 'show' : 'hide'} />
58+
<Icon name={isHidden ? 'eye-off' : 'eye'} size={24} style={styles.showPasswordButtonIcon} />
5159
</Touchable>
5260
</View>
5361
);

0 commit comments

Comments
 (0)