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, 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
+2 -2
View File
@@ -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() {
+3 -3
View File
@@ -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>
+2 -1
View File
@@ -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],
) )
+2 -2
View File
@@ -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 = {