Merge branch 'mary-ext-fix/app-password-submit' into main
commit
2d13f3b367
|
@ -62,7 +62,8 @@ export function Component({}: {}) {
|
||||||
const {_} = useLingui()
|
const {_} = useLingui()
|
||||||
const {closeModal} = useModalControls()
|
const {closeModal} = useModalControls()
|
||||||
const {data: passwords} = useAppPasswordsQuery()
|
const {data: passwords} = useAppPasswordsQuery()
|
||||||
const createMutation = useAppPasswordCreateMutation()
|
const {mutateAsync: mutateAppPassword, isPending} =
|
||||||
|
useAppPasswordCreateMutation()
|
||||||
const [name, setName] = useState(
|
const [name, setName] = useState(
|
||||||
shadesOfBlue[Math.floor(Math.random() * shadesOfBlue.length)],
|
shadesOfBlue[Math.floor(Math.random() * shadesOfBlue.length)],
|
||||||
)
|
)
|
||||||
|
@ -107,7 +108,7 @@ export function Component({}: {}) {
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const newPassword = await createMutation.mutateAsync({name})
|
const newPassword = await mutateAppPassword({name})
|
||||||
if (newPassword) {
|
if (newPassword) {
|
||||||
setAppPassword(newPassword.password)
|
setAppPassword(newPassword.password)
|
||||||
} else {
|
} else {
|
||||||
|
@ -170,13 +171,10 @@ export function Component({}: {}) {
|
||||||
autoFocus={true}
|
autoFocus={true}
|
||||||
maxLength={32}
|
maxLength={32}
|
||||||
selectTextOnFocus={true}
|
selectTextOnFocus={true}
|
||||||
multiline={true} // need this to be true otherwise selectTextOnFocus doesn't work
|
blurOnSubmit={true}
|
||||||
numberOfLines={1} // hack for multiline so only one line shows (android)
|
editable={!isPending}
|
||||||
scrollEnabled={false} // hack for multiline so only one line shows (ios)
|
|
||||||
blurOnSubmit={true} // hack for multiline so it submits
|
|
||||||
editable={!appPassword}
|
|
||||||
returnKeyType="done"
|
returnKeyType="done"
|
||||||
onEndEditing={createAppPassword}
|
onSubmitEditing={createAppPassword}
|
||||||
accessible={true}
|
accessible={true}
|
||||||
accessibilityLabel={_(msg`Name`)}
|
accessibilityLabel={_(msg`Name`)}
|
||||||
accessibilityHint={_(msg`Input name for app password`)}
|
accessibilityHint={_(msg`Input name for app password`)}
|
||||||
|
@ -253,7 +251,6 @@ const styles = StyleSheet.create({
|
||||||
width: '100%',
|
width: '100%',
|
||||||
paddingVertical: 10,
|
paddingVertical: 10,
|
||||||
paddingHorizontal: 8,
|
paddingHorizontal: 8,
|
||||||
marginTop: 6,
|
|
||||||
fontSize: 17,
|
fontSize: 17,
|
||||||
letterSpacing: 0.25,
|
letterSpacing: 0.25,
|
||||||
fontWeight: '400',
|
fontWeight: '400',
|
||||||
|
|
Loading…
Reference in New Issue