Drill in onSelectLanguage callback into dialog too
This commit is contained in:
@@ -97,6 +97,7 @@ export function PostLanguageSelect({
|
|||||||
<PostLanguageSelectDialog
|
<PostLanguageSelectDialog
|
||||||
control={languageDialogControl}
|
control={languageDialogControl}
|
||||||
currentLanguages={currentLanguages}
|
currentLanguages={currentLanguages}
|
||||||
|
onSelectLanguage={onSelectLanguage}
|
||||||
/>
|
/>
|
||||||
</>
|
</>
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -23,13 +23,17 @@ import {TimesLarge_Stroke2_Corner0_Rounded as XIcon} from '#/components/icons/Ti
|
|||||||
import {Text} from '#/components/Typography'
|
import {Text} from '#/components/Typography'
|
||||||
|
|
||||||
export function PostLanguageSelectDialog({
|
export function PostLanguageSelectDialog({
|
||||||
/** Optionally can be passed to show different values than what is saved in
|
|
||||||
* langPrefs. */
|
|
||||||
currentLanguages,
|
|
||||||
control,
|
control,
|
||||||
|
/**
|
||||||
|
* Optionally can be passed to show different values than what is saved in
|
||||||
|
* langPrefs.
|
||||||
|
*/
|
||||||
|
currentLanguages,
|
||||||
|
onSelectLanguage,
|
||||||
}: {
|
}: {
|
||||||
currentLanguages?: string[]
|
|
||||||
control: Dialog.DialogControlProps
|
control: Dialog.DialogControlProps
|
||||||
|
currentLanguages?: string[]
|
||||||
|
onSelectLanguage?: (language: string) => void
|
||||||
}) {
|
}) {
|
||||||
const {height} = useWindowDimensions()
|
const {height} = useWindowDimensions()
|
||||||
const insets = useSafeAreaInsets()
|
const insets = useSafeAreaInsets()
|
||||||
@@ -45,13 +49,22 @@ export function PostLanguageSelectDialog({
|
|||||||
nativeOptions={{minHeight: height - insets.top}}>
|
nativeOptions={{minHeight: height - insets.top}}>
|
||||||
<Dialog.Handle />
|
<Dialog.Handle />
|
||||||
<ErrorBoundary renderError={renderErrorBoundary}>
|
<ErrorBoundary renderError={renderErrorBoundary}>
|
||||||
<DialogInner currentLanguages={currentLanguages} />
|
<DialogInner
|
||||||
|
currentLanguages={currentLanguages}
|
||||||
|
onSelectLanguage={onSelectLanguage}
|
||||||
|
/>
|
||||||
</ErrorBoundary>
|
</ErrorBoundary>
|
||||||
</Dialog.Outer>
|
</Dialog.Outer>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
export function DialogInner({currentLanguages}: {currentLanguages?: string[]}) {
|
export function DialogInner({
|
||||||
|
currentLanguages,
|
||||||
|
onSelectLanguage,
|
||||||
|
}: {
|
||||||
|
currentLanguages?: string[]
|
||||||
|
onSelectLanguage?: (language: string) => void
|
||||||
|
}) {
|
||||||
const control = Dialog.useDialogContext()
|
const control = Dialog.useDialogContext()
|
||||||
const [headerHeight, setHeaderHeight] = useState(0)
|
const [headerHeight, setHeaderHeight] = useState(0)
|
||||||
|
|
||||||
@@ -87,6 +100,7 @@ export function DialogInner({currentLanguages}: {currentLanguages?: string[]}) {
|
|||||||
langsString = langPrefs.primaryLanguage
|
langsString = langPrefs.primaryLanguage
|
||||||
}
|
}
|
||||||
setLangPrefs.setPostLanguage(langsString)
|
setLangPrefs.setPostLanguage(langsString)
|
||||||
|
onSelectLanguage?.(langsString)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user