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