Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F32276672
D5489.1765261698.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
3 KB
Referenced Files
None
Subscribers
None
D5489.1765261698.diff
View Options
diff --git a/native/account/log-in-panel.react.js b/native/account/log-in-panel.react.js
--- a/native/account/log-in-panel.react.js
+++ b/native/account/log-in-panel.react.js
@@ -37,6 +37,7 @@
setNativeCredentials,
} from './native-credentials';
import { PanelButton, Panel } from './panel-components.react';
+import PasswordInput from './password-input.react';
export type LogInState = {
+usernameInputText: ?string,
@@ -59,7 +60,7 @@
};
class LogInPanel extends React.PureComponent<Props> {
usernameInput: ?TextInput;
- passwordInput: ?TextInput;
+ passwordInput: ?PasswordInput;
componentDidMount() {
this.attemptToFetchCredentials();
@@ -132,14 +133,14 @@
color="#555"
style={styles.icon}
/>
- <TextInput
+ <PasswordInput
style={styles.input}
value={this.passwordInputText}
onChangeText={this.onChangePasswordInputText}
placeholder="Password"
- secureTextEntry={true}
textContentType="password"
autoComplete="password"
+ autoCapitalize="none"
returnKeyType="go"
blurOnSubmit={false}
onSubmitEditing={this.onSubmit}
@@ -170,7 +171,7 @@
this.usernameInput.focus();
};
- passwordInputRef: (passwordInput: ?TextInput) => void = passwordInput => {
+ passwordInputRef: (passwordInput: ?PasswordInput) => void = passwordInput => {
this.passwordInput = passwordInput;
};
diff --git a/native/account/password-input.react.js b/native/account/password-input.react.js
new file mode 100644
--- /dev/null
+++ b/native/account/password-input.react.js
@@ -0,0 +1,76 @@
+// @flow
+
+import * as React from 'react';
+import { TextInput as BaseTextInput, View, StyleSheet } from 'react-native';
+
+import Button from '../components/button.react';
+import SWMansionIcon from '../components/swmansion-icon.react';
+import { TextInput } from './modal-components.react';
+
+type Props = React.ElementConfig<typeof BaseTextInput>;
+
+type State = {
+ +secureTextEntry: boolean,
+};
+
+class PasswordInput extends React.PureComponent<Props, State> {
+ wrappedTextInput: ?TextInput;
+
+ constructor(props: Props) {
+ super(props);
+ this.state = { secureTextEntry: true };
+ }
+
+ onToggleShowPassword: () => void = () => {
+ this.setState(state => ({
+ secureTextEntry: !state.secureTextEntry,
+ }));
+ };
+
+ render(): React.Node {
+ const { style, ...rest } = this.props;
+ return (
+ <View>
+ <TextInput
+ style={[style, styles.inputPassword]}
+ {...rest}
+ secureTextEntry={this.state.secureTextEntry}
+ ref={this.wrappedTextInputRef}
+ />
+ <Button onPress={this.onToggleShowPassword} topStyle={styles.button}>
+ <SWMansionIcon
+ name={this.state.secureTextEntry ? 'eye-open' : 'eye-closed'}
+ size={22}
+ color="#555"
+ />
+ </Button>
+ </View>
+ );
+ }
+
+ wrappedTextInputRef: (wrappedTextInput: ?TextInput) => void = (
+ wrappedTextInput: ?TextInput,
+ ) => {
+ this.wrappedTextInput = wrappedTextInput;
+ };
+
+ focus() {
+ this.wrappedTextInput?.focus();
+ }
+}
+
+const styles = StyleSheet.create({
+ button: {
+ borderRadius: 21,
+ bottom: 0,
+ margin: 2,
+ padding: 8,
+ position: 'absolute',
+ right: -10,
+ },
+ inputPassword: {
+ paddingRight: 30,
+ },
+});
+
+export default PasswordInput;
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Tue, Dec 9, 6:28 AM (4 h, 21 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
5853043
Default Alt Text
D5489.1765261698.diff (3 KB)
Attached To
Mode
D5489: [native] Added show/hide password button.
Attached
Detach File
Event Timeline
Log In to Comment