Skip to content

Commit

Permalink
Fix overlap of password entry and Hide/Show button
Browse files Browse the repository at this point in the history
  • Loading branch information
Dashwave authored and burnerlee committed Nov 8, 2024
1 parent 15b5130 commit 81f489b
Showing 1 changed file with 16 additions and 7 deletions.
23 changes: 16 additions & 7 deletions src/common/PasswordInput.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* @flow strict-local */
import React, { useState, useCallback } from 'react';
import type { Node } from 'react';
import { View } from 'react-native';
import { View, TextInput } from 'react-native';

Check warning on line 4 in src/common/PasswordInput.js

View workflow job for this annotation

GitHub Actions / test

'TextInput' is defined but never used

Check warning on line 4 in src/common/PasswordInput.js

View workflow job for this annotation

GitHub Actions / test

'TextInput' is defined but never used

import Input from './Input';
import type { Props as InputProps } from './Input';
Expand All @@ -10,11 +10,14 @@ import ZulipTextIntl from './ZulipTextIntl';
import Touchable from './Touchable';

const styles = createStyleSheet({
container: {
flexDirection: 'row',
alignItems: 'center',
},
input: {
flex: 1,
},
showPasswordButton: {
position: 'absolute',
right: 0,
top: 0,
bottom: 0,
justifyContent: 'center',
},
showPasswordButtonText: {
Expand Down Expand Up @@ -44,8 +47,14 @@ export default function PasswordInput(props: Props): Node {
}, []);

return (
<View>
<Input {...props} secureTextEntry={isHidden} autoCorrect={false} autoCapitalize="none" />
<View style={styles.container}>
<Input
{...props}
style={styles.input}
secureTextEntry={isHidden}
autoCorrect={false}
autoCapitalize="none"
/>
<Touchable style={styles.showPasswordButton} onPress={handleShow}>
<ZulipTextIntl style={styles.showPasswordButtonText} text={isHidden ? 'show' : 'hide'} />
</Touchable>
Expand Down

0 comments on commit 81f489b

Please sign in to comment.