update other dialog views
This commit is contained in:
@@ -1,17 +1,11 @@
|
|||||||
import React, {useImperativeHandle} from 'react'
|
import React, {useImperativeHandle} from 'react'
|
||||||
import {StyleProp, View, ViewStyle} from 'react-native'
|
import {StyleProp, TextInput, View, ViewStyle} from 'react-native'
|
||||||
import {useSafeAreaInsets} from 'react-native-safe-area-context'
|
import {useSafeAreaInsets} from 'react-native-safe-area-context'
|
||||||
import {
|
|
||||||
BottomSheetFlatList,
|
|
||||||
BottomSheetFlatListMethods,
|
|
||||||
BottomSheetTextInput,
|
|
||||||
BottomSheetView,
|
|
||||||
} from '@discord/bottom-sheet/src'
|
|
||||||
import {BottomSheetFlatListProps} from '@discord/bottom-sheet/src/components/bottomSheetScrollable/types'
|
|
||||||
import {BlueskyBottomSheetView} from '@haileyok/bluesky-bottom-sheet'
|
import {BlueskyBottomSheetView} from '@haileyok/bluesky-bottom-sheet'
|
||||||
|
|
||||||
import {logger} from '#/logger'
|
import {logger} from '#/logger'
|
||||||
import {useDialogStateControlContext} from '#/state/dialogs'
|
import {useDialogStateControlContext} from '#/state/dialogs'
|
||||||
|
import {List, ListMethods, ListProps} from '#/view/com/util/List'
|
||||||
import {ScrollView} from '#/view/com/util/Views'
|
import {ScrollView} from '#/view/com/util/Views'
|
||||||
import {atoms as a, flatten, useTheme} from '#/alf'
|
import {atoms as a, flatten, useTheme} from '#/alf'
|
||||||
import {Context} from '#/components/Dialog/context'
|
import {Context} from '#/components/Dialog/context'
|
||||||
@@ -27,7 +21,7 @@ export {useDialogContext, useDialogControl} from '#/components/Dialog/context'
|
|||||||
export * from '#/components/Dialog/types'
|
export * from '#/components/Dialog/types'
|
||||||
export * from '#/components/Dialog/utils'
|
export * from '#/components/Dialog/utils'
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
export const Input = createInput(BottomSheetTextInput)
|
export const Input = createInput(TextInput)
|
||||||
|
|
||||||
export function Outer({
|
export function Outer({
|
||||||
children,
|
children,
|
||||||
@@ -125,20 +119,16 @@ export function Outer({
|
|||||||
export function Inner({children, style}: DialogInnerProps) {
|
export function Inner({children, style}: DialogInnerProps) {
|
||||||
const insets = useSafeAreaInsets()
|
const insets = useSafeAreaInsets()
|
||||||
return (
|
return (
|
||||||
<BottomSheetView
|
<View
|
||||||
style={[
|
style={[
|
||||||
a.py_xl,
|
|
||||||
a.px_xl,
|
a.px_xl,
|
||||||
{
|
{
|
||||||
paddingTop: 40,
|
|
||||||
borderTopLeftRadius: 40,
|
|
||||||
borderTopRightRadius: 40,
|
|
||||||
paddingBottom: insets.bottom + a.pb_5xl.paddingBottom,
|
paddingBottom: insets.bottom + a.pb_5xl.paddingBottom,
|
||||||
},
|
},
|
||||||
flatten(style),
|
style,
|
||||||
]}>
|
]}>
|
||||||
{children}
|
{children}
|
||||||
</BottomSheetView>
|
</View>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -155,13 +145,12 @@ export const ScrollableInner = React.forwardRef<ScrollView, DialogInnerProps>(
|
|||||||
)
|
)
|
||||||
|
|
||||||
export const InnerFlatList = React.forwardRef<
|
export const InnerFlatList = React.forwardRef<
|
||||||
BottomSheetFlatListMethods,
|
ListMethods,
|
||||||
BottomSheetFlatListProps<any> & {webInnerStyle?: StyleProp<ViewStyle>}
|
ListProps<any> & {webInnerStyle?: StyleProp<ViewStyle>}
|
||||||
>(function InnerFlatList({style, contentContainerStyle, ...props}, ref) {
|
>(function InnerFlatList({style, contentContainerStyle, ...props}, ref) {
|
||||||
const insets = useSafeAreaInsets()
|
const insets = useSafeAreaInsets()
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<BottomSheetFlatList
|
<List
|
||||||
keyboardShouldPersistTaps="handled"
|
keyboardShouldPersistTaps="handled"
|
||||||
contentContainerStyle={[a.pb_4xl, flatten(contentContainerStyle)]}
|
contentContainerStyle={[a.pb_4xl, flatten(contentContainerStyle)]}
|
||||||
ListFooterComponent={
|
ListFooterComponent={
|
||||||
@@ -169,16 +158,7 @@ export const InnerFlatList = React.forwardRef<
|
|||||||
}
|
}
|
||||||
ref={ref}
|
ref={ref}
|
||||||
{...props}
|
{...props}
|
||||||
style={[
|
style={style}
|
||||||
a.flex_1,
|
|
||||||
a.p_xl,
|
|
||||||
a.pt_0,
|
|
||||||
a.h_full,
|
|
||||||
{
|
|
||||||
marginTop: 40,
|
|
||||||
},
|
|
||||||
flatten(style),
|
|
||||||
]}
|
|
||||||
/>
|
/>
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -3,13 +3,13 @@ import type {ListRenderItemInfo} from 'react-native'
|
|||||||
import {View} from 'react-native'
|
import {View} from 'react-native'
|
||||||
import {AppBskyActorDefs, ModerationOpts} from '@atproto/api'
|
import {AppBskyActorDefs, ModerationOpts} from '@atproto/api'
|
||||||
import {GeneratorView} from '@atproto/api/dist/client/types/app/bsky/feed/defs'
|
import {GeneratorView} from '@atproto/api/dist/client/types/app/bsky/feed/defs'
|
||||||
import {BottomSheetFlatListMethods} from '@discord/bottom-sheet'
|
|
||||||
import {msg, Trans} from '@lingui/macro'
|
import {msg, Trans} from '@lingui/macro'
|
||||||
import {useLingui} from '@lingui/react'
|
import {useLingui} from '@lingui/react'
|
||||||
|
|
||||||
import {useInitialNumToRender} from '#/lib/hooks/useInitialNumToRender'
|
import {useInitialNumToRender} from '#/lib/hooks/useInitialNumToRender'
|
||||||
import {isWeb} from '#/platform/detection'
|
import {isWeb} from '#/platform/detection'
|
||||||
import {useSession} from '#/state/session'
|
import {useSession} from '#/state/session'
|
||||||
|
import {ListMethods} from '#/view/com/util/List'
|
||||||
import {WizardAction, WizardState} from '#/screens/StarterPack/Wizard/State'
|
import {WizardAction, WizardState} from '#/screens/StarterPack/Wizard/State'
|
||||||
import {atoms as a, native, useTheme, web} from '#/alf'
|
import {atoms as a, native, useTheme, web} from '#/alf'
|
||||||
import {Button, ButtonText} from '#/components/Button'
|
import {Button, ButtonText} from '#/components/Button'
|
||||||
@@ -45,7 +45,7 @@ export function WizardEditListDialog({
|
|||||||
const {currentAccount} = useSession()
|
const {currentAccount} = useSession()
|
||||||
const initialNumToRender = useInitialNumToRender()
|
const initialNumToRender = useInitialNumToRender()
|
||||||
|
|
||||||
const listRef = useRef<BottomSheetFlatListMethods>(null)
|
const listRef = useRef<ListMethods>(null)
|
||||||
|
|
||||||
const getData = () => {
|
const getData = () => {
|
||||||
if (state.currentStep === 'Feeds') return state.feeds
|
if (state.currentStep === 'Feeds') return state.feeds
|
||||||
@@ -99,13 +99,7 @@ export function WizardEditListDialog({
|
|||||||
height: 48,
|
height: 48,
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
: [
|
: [a.pb_sm, a.align_end],
|
||||||
a.pb_sm,
|
|
||||||
a.align_end,
|
|
||||||
{
|
|
||||||
height: 68,
|
|
||||||
},
|
|
||||||
],
|
|
||||||
]}>
|
]}>
|
||||||
<View style={{width: 60}} />
|
<View style={{width: 60}} />
|
||||||
<Text style={[a.font_bold, a.text_xl]}>
|
<Text style={[a.font_bold, a.text_xl]}>
|
||||||
@@ -139,8 +133,6 @@ export function WizardEditListDialog({
|
|||||||
paddingHorizontal: 0,
|
paddingHorizontal: 0,
|
||||||
marginTop: 0,
|
marginTop: 0,
|
||||||
paddingTop: 0,
|
paddingTop: 0,
|
||||||
borderTopLeftRadius: 40,
|
|
||||||
borderTopRightRadius: 40,
|
|
||||||
}),
|
}),
|
||||||
]}
|
]}
|
||||||
webInnerStyle={[a.py_0, {maxWidth: 500, minWidth: 200}]}
|
webInnerStyle={[a.py_0, {maxWidth: 500, minWidth: 200}]}
|
||||||
|
|||||||
@@ -6,7 +6,6 @@ import React, {
|
|||||||
useState,
|
useState,
|
||||||
} from 'react'
|
} from 'react'
|
||||||
import {TextInput, View} from 'react-native'
|
import {TextInput, View} from 'react-native'
|
||||||
import {BottomSheetFlatListMethods} from '@discord/bottom-sheet'
|
|
||||||
import {msg, Trans} from '@lingui/macro'
|
import {msg, Trans} from '@lingui/macro'
|
||||||
import {useLingui} from '@lingui/react'
|
import {useLingui} from '@lingui/react'
|
||||||
|
|
||||||
@@ -19,6 +18,7 @@ import {
|
|||||||
} from '#/state/queries/tenor'
|
} from '#/state/queries/tenor'
|
||||||
import {ErrorScreen} from '#/view/com/util/error/ErrorScreen'
|
import {ErrorScreen} from '#/view/com/util/error/ErrorScreen'
|
||||||
import {ErrorBoundary} from '#/view/com/util/ErrorBoundary'
|
import {ErrorBoundary} from '#/view/com/util/ErrorBoundary'
|
||||||
|
import {ListMethods} from '#/view/com/util/List'
|
||||||
import {atoms as a, useBreakpoints, useTheme} from '#/alf'
|
import {atoms as a, useBreakpoints, useTheme} from '#/alf'
|
||||||
import * as Dialog from '#/components/Dialog'
|
import * as Dialog from '#/components/Dialog'
|
||||||
import * as TextField from '#/components/forms/TextField'
|
import * as TextField from '#/components/forms/TextField'
|
||||||
@@ -76,7 +76,7 @@ function GifList({
|
|||||||
const t = useTheme()
|
const t = useTheme()
|
||||||
const {gtMobile} = useBreakpoints()
|
const {gtMobile} = useBreakpoints()
|
||||||
const textInputRef = useRef<TextInput>(null)
|
const textInputRef = useRef<TextInput>(null)
|
||||||
const listRef = useRef<BottomSheetFlatListMethods>(null)
|
const listRef = useRef<ListMethods>(null)
|
||||||
const [undeferredSearch, setSearch] = useState('')
|
const [undeferredSearch, setSearch] = useState('')
|
||||||
const search = useThrottledValue(undeferredSearch, 500)
|
const search = useThrottledValue(undeferredSearch, 500)
|
||||||
|
|
||||||
|
|||||||
@@ -5,10 +5,8 @@ import React, {
|
|||||||
useRef,
|
useRef,
|
||||||
useState,
|
useState,
|
||||||
} from 'react'
|
} from 'react'
|
||||||
import type {TextInput as TextInputType} from 'react-native'
|
import {TextInput, View} from 'react-native'
|
||||||
import {View} from 'react-native'
|
|
||||||
import {AppBskyActorDefs, moderateProfile, ModerationOpts} from '@atproto/api'
|
import {AppBskyActorDefs, moderateProfile, ModerationOpts} from '@atproto/api'
|
||||||
import {BottomSheetFlatListMethods} from '@discord/bottom-sheet'
|
|
||||||
import {msg, Trans} from '@lingui/macro'
|
import {msg, Trans} from '@lingui/macro'
|
||||||
import {useLingui} from '@lingui/react'
|
import {useLingui} from '@lingui/react'
|
||||||
|
|
||||||
@@ -16,15 +14,15 @@ import {sanitizeDisplayName} from '#/lib/strings/display-names'
|
|||||||
import {sanitizeHandle} from '#/lib/strings/handles'
|
import {sanitizeHandle} from '#/lib/strings/handles'
|
||||||
import {isWeb} from '#/platform/detection'
|
import {isWeb} from '#/platform/detection'
|
||||||
import {useModerationOpts} from '#/state/preferences/moderation-opts'
|
import {useModerationOpts} from '#/state/preferences/moderation-opts'
|
||||||
|
import {useActorAutocompleteQuery} from '#/state/queries/actor-autocomplete'
|
||||||
import {useListConvosQuery} from '#/state/queries/messages/list-converations'
|
import {useListConvosQuery} from '#/state/queries/messages/list-converations'
|
||||||
import {useProfileFollowsQuery} from '#/state/queries/profile-follows'
|
import {useProfileFollowsQuery} from '#/state/queries/profile-follows'
|
||||||
import {useSession} from '#/state/session'
|
import {useSession} from '#/state/session'
|
||||||
import {useActorAutocompleteQuery} from 'state/queries/actor-autocomplete'
|
import {ListMethods} from '#/view/com/util/List'
|
||||||
import {UserAvatar} from '#/view/com/util/UserAvatar'
|
import {UserAvatar} from '#/view/com/util/UserAvatar'
|
||||||
import {atoms as a, native, useTheme, web} from '#/alf'
|
import {atoms as a, native, useTheme, web} from '#/alf'
|
||||||
import {Button} from '#/components/Button'
|
import {Button} from '#/components/Button'
|
||||||
import * as Dialog from '#/components/Dialog'
|
import * as Dialog from '#/components/Dialog'
|
||||||
import {TextInput} from '#/components/dms/dialogs/TextInput'
|
|
||||||
import {canBeMessaged} from '#/components/dms/util'
|
import {canBeMessaged} from '#/components/dms/util'
|
||||||
import {useInteractionState} from '#/components/hooks/useInteractionState'
|
import {useInteractionState} from '#/components/hooks/useInteractionState'
|
||||||
import {ChevronLeft_Stroke2_Corner0_Rounded as ChevronLeft} from '#/components/icons/Chevron'
|
import {ChevronLeft_Stroke2_Corner0_Rounded as ChevronLeft} from '#/components/icons/Chevron'
|
||||||
@@ -66,9 +64,9 @@ export function SearchablePeopleList({
|
|||||||
const {_} = useLingui()
|
const {_} = useLingui()
|
||||||
const moderationOpts = useModerationOpts()
|
const moderationOpts = useModerationOpts()
|
||||||
const control = Dialog.useDialogContext()
|
const control = Dialog.useDialogContext()
|
||||||
const listRef = useRef<BottomSheetFlatListMethods>(null)
|
const listRef = useRef<ListMethods>(null)
|
||||||
const {currentAccount} = useSession()
|
const {currentAccount} = useSession()
|
||||||
const inputRef = useRef<TextInputType>(null)
|
const inputRef = useRef<TextInput>(null)
|
||||||
|
|
||||||
const [searchText, setSearchText] = useState('')
|
const [searchText, setSearchText] = useState('')
|
||||||
|
|
||||||
@@ -242,13 +240,12 @@ export function SearchablePeopleList({
|
|||||||
<View
|
<View
|
||||||
style={[
|
style={[
|
||||||
a.relative,
|
a.relative,
|
||||||
a.pt_md,
|
web(a.pt_md),
|
||||||
a.pb_xs,
|
a.pb_xs,
|
||||||
a.px_lg,
|
a.px_lg,
|
||||||
a.border_b,
|
a.border_b,
|
||||||
t.atoms.border_contrast_low,
|
t.atoms.border_contrast_low,
|
||||||
t.atoms.bg,
|
t.atoms.bg,
|
||||||
native([a.pt_lg]),
|
|
||||||
]}>
|
]}>
|
||||||
<View
|
<View
|
||||||
style={[
|
style={[
|
||||||
@@ -474,7 +471,7 @@ function SearchInput({
|
|||||||
value: string
|
value: string
|
||||||
onChangeText: (text: string) => void
|
onChangeText: (text: string) => void
|
||||||
onEscape: () => void
|
onEscape: () => void
|
||||||
inputRef: React.RefObject<TextInputType>
|
inputRef: React.RefObject<TextInput>
|
||||||
}) {
|
}) {
|
||||||
const t = useTheme()
|
const t = useTheme()
|
||||||
const {_} = useLingui()
|
const {_} = useLingui()
|
||||||
|
|||||||
@@ -86,7 +86,9 @@ let RepostButton = ({
|
|||||||
</Text>
|
</Text>
|
||||||
) : undefined}
|
) : undefined}
|
||||||
</Button>
|
</Button>
|
||||||
<Dialog.Outer control={dialogControl}>
|
<Dialog.Outer
|
||||||
|
control={dialogControl}
|
||||||
|
nativeOptions={{preventExpansion: true}}>
|
||||||
<Dialog.Inner label={_(msg`Repost or quote post`)}>
|
<Dialog.Inner label={_(msg`Repost or quote post`)}>
|
||||||
<View style={a.gap_xl}>
|
<View style={a.gap_xl}>
|
||||||
<View style={a.gap_xs}>
|
<View style={a.gap_xs}>
|
||||||
|
|||||||
Reference in New Issue
Block a user