Skip to content

Commit

Permalink
Merge branch 'mary-ext-fix/app-password-submit' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
pfrazee committed Feb 6, 2024
2 parents ec86282 + d385837 commit 2d13f3b
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions src/view/com/modals/AddAppPasswords.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,8 @@ export function Component({}: {}) {
const {_} = useLingui()
const {closeModal} = useModalControls()
const {data: passwords} = useAppPasswordsQuery()
const createMutation = useAppPasswordCreateMutation()
const {mutateAsync: mutateAppPassword, isPending} =
useAppPasswordCreateMutation()
const [name, setName] = useState(
shadesOfBlue[Math.floor(Math.random() * shadesOfBlue.length)],
)
Expand Down Expand Up @@ -107,7 +108,7 @@ export function Component({}: {}) {
}

try {
const newPassword = await createMutation.mutateAsync({name})
const newPassword = await mutateAppPassword({name})
if (newPassword) {
setAppPassword(newPassword.password)
} else {
Expand Down Expand Up @@ -170,13 +171,10 @@ export function Component({}: {}) {
autoFocus={true}
maxLength={32}
selectTextOnFocus={true}
multiline={true} // need this to be true otherwise selectTextOnFocus doesn't work
numberOfLines={1} // hack for multiline so only one line shows (android)
scrollEnabled={false} // hack for multiline so only one line shows (ios)
blurOnSubmit={true} // hack for multiline so it submits
editable={!appPassword}
blurOnSubmit={true}
editable={!isPending}
returnKeyType="done"
onEndEditing={createAppPassword}
onSubmitEditing={createAppPassword}
accessible={true}
accessibilityLabel={_(msg`Name`)}
accessibilityHint={_(msg`Input name for app password`)}
Expand Down Expand Up @@ -253,7 +251,6 @@ const styles = StyleSheet.create({
width: '100%',
paddingVertical: 10,
paddingHorizontal: 8,
marginTop: 6,
fontSize: 17,
letterSpacing: 0.25,
fontWeight: '400',
Expand Down

0 comments on commit 2d13f3b

Please sign in to comment.