Nitpick naming, use normal Pressable on web
This commit is contained in:
@@ -122,11 +122,13 @@ export const Button = React.forwardRef<View, ButtonProps>(
|
||||
},
|
||||
ref,
|
||||
) => {
|
||||
// This will pick the correct default pressable to use. If we are inside a dialog, we need to use the RNGH
|
||||
// pressable so that it is usable inside the dialog.
|
||||
const {insideDialog} = useDialogContext()
|
||||
/*
|
||||
* This will pick the correct default pressable to use. If we are inside a
|
||||
* native dialog, we need to use the RNGH pressable.
|
||||
*/
|
||||
const {isNativeDialog} = useDialogContext()
|
||||
if (!PressableComponent) {
|
||||
if (insideDialog) {
|
||||
if (isNativeDialog) {
|
||||
PressableComponent = NormalizedRNGHPressable
|
||||
} else {
|
||||
PressableComponent = Pressable
|
||||
|
||||
@@ -10,8 +10,8 @@ import {BottomSheetSnapPoint} from '../../../modules/bottom-sheet/src/BottomShee
|
||||
|
||||
export const Context = React.createContext<DialogContextProps>({
|
||||
close: () => {},
|
||||
insideDialog: false,
|
||||
snapPoint: BottomSheetSnapPoint.Hidden,
|
||||
isNativeDialog: false,
|
||||
nativeSnapPoint: BottomSheetSnapPoint.Hidden,
|
||||
})
|
||||
|
||||
export function useDialogContext() {
|
||||
|
||||
@@ -111,7 +111,7 @@ export function OuterWithoutPortal({
|
||||
)
|
||||
|
||||
const context = React.useMemo(
|
||||
() => ({close, insideDialog: true, snapPoint}),
|
||||
() => ({close, isNativeDialog: true, nativeSnapPoint: snapPoint}),
|
||||
[close, snapPoint],
|
||||
)
|
||||
|
||||
@@ -160,12 +160,12 @@ export function Inner({children, style}: DialogInnerProps) {
|
||||
export const ScrollableInner = React.forwardRef<ScrollView, DialogInnerProps>(
|
||||
function ScrollableInner({children, style}, ref) {
|
||||
const insets = useSafeAreaInsets()
|
||||
const {snapPoint} = useDialogContext()
|
||||
const {nativeSnapPoint} = useDialogContext()
|
||||
return (
|
||||
<ScrollView
|
||||
style={[a.px_xl, style]}
|
||||
ref={ref}
|
||||
bounces={snapPoint === BottomSheetSnapPoint.Full}>
|
||||
bounces={nativeSnapPoint === BottomSheetSnapPoint.Full}>
|
||||
{children}
|
||||
<View style={{height: insets.bottom + a.pt_5xl.paddingTop}} />
|
||||
</ScrollView>
|
||||
|
||||
@@ -103,7 +103,8 @@ export function Outer({
|
||||
const context = React.useMemo(
|
||||
() => ({
|
||||
close,
|
||||
insideDialog: true,
|
||||
isNativeDialog: false,
|
||||
nativeSnapPoint: 0,
|
||||
}),
|
||||
[close],
|
||||
)
|
||||
|
||||
@@ -38,8 +38,8 @@ export type DialogControlProps = DialogControlRefProps & {
|
||||
|
||||
export type DialogContextProps = {
|
||||
close: DialogControlProps['close']
|
||||
insideDialog: boolean
|
||||
snapPoint: BottomSheetSnapPoint
|
||||
isNativeDialog: boolean
|
||||
nativeSnapPoint: BottomSheetSnapPoint
|
||||
}
|
||||
|
||||
export type DialogControlOpenOptions = {
|
||||
|
||||
Reference in New Issue
Block a user