1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-07-16 00:14:34 +02:00

Mobile: Accessibility: Add checked/unchecked accessibility information to the "sort notes by" dialog (#11411)

This commit is contained in:
Henry Heino
2024-11-20 03:39:33 -08:00
committed by GitHub
parent c9608cf4a1
commit d648e43cfb
11 changed files with 135 additions and 39 deletions

View File

@ -1,6 +1,6 @@
import * as React from 'react';
import { Alert, Platform } from 'react-native';
import { DialogControl, DialogType, MenuChoice, PromptButton, PromptDialogData, PromptOptions } from '../types';
import { DialogControl, DialogType, MenuChoice, PromptButtonSpec, PromptDialogData, PromptOptions } from '../types';
import { _ } from '@joplin/lib/locale';
import { useMemo, useRef } from 'react';
@ -32,7 +32,7 @@ const useDialogControl = (setPromptDialogs: SetPromptDialogs) => {
}]);
});
},
prompt: (title: string, message: string, buttons: PromptButton[] = defaultButtons, options?: PromptOptions) => {
prompt: (title: string, message: string, buttons: PromptButtonSpec[] = defaultButtons, options?: PromptOptions) => {
// Alert.alert doesn't work on web.
if (Platform.OS !== 'web') {
// Note: Alert.alert provides a more native style on iOS.
@ -71,11 +71,11 @@ const useDialogControl = (setPromptDialogs: SetPromptDialogs) => {
key: `menu-dialog-${nextDialogIdRef.current++}`,
title: '',
message: title,
buttons: choices.map(choice => ({
text: choice.text,
buttons: choices.map(({ id, ...buttonProps }) => ({
...buttonProps,
onPress: () => {
dismiss();
resolve(choice.id);
resolve(id);
},
})),
onDismiss: dismiss,