Nitpick naming, use normal Pressable on web

This commit is contained in:
Eric Bailey
2024-10-02 21:18:53 -05:00
parent 639a7ea3b0
commit 31e6fb8c35
5 changed files with 15 additions and 12 deletions
+6 -4
View File
@@ -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
+2 -2
View File
@@ -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() {
+3 -3
View File
@@ -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>
+2 -1
View File
@@ -103,7 +103,8 @@ export function Outer({
const context = React.useMemo(
() => ({
close,
insideDialog: true,
isNativeDialog: false,
nativeSnapPoint: 0,
}),
[close],
)
+2 -2
View File
@@ -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 = {