remove use of `pointerEvents` on iOS profile header (#3694)

zio/stable
Hailey 2024-04-24 17:24:20 -07:00 committed by GitHub
parent c3fcd486b3
commit 5b82b15007
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 31 additions and 18 deletions

View File

@ -21,6 +21,7 @@ import {usePreferencesQuery} from '#/state/queries/preferences'
import {useRequireAuth, useSession} from '#/state/session' import {useRequireAuth, useSession} from '#/state/session'
import {useAnalytics} from 'lib/analytics/analytics' import {useAnalytics} from 'lib/analytics/analytics'
import {useHaptics} from 'lib/haptics' import {useHaptics} from 'lib/haptics'
import {isIOS} from 'platform/detection'
import {useProfileShadow} from 'state/cache/profile-shadow' import {useProfileShadow} from 'state/cache/profile-shadow'
import {ProfileMenu} from '#/view/com/profile/ProfileMenu' import {ProfileMenu} from '#/view/com/profile/ProfileMenu'
import * as Toast from '#/view/com/util/Toast' import * as Toast from '#/view/com/util/Toast'
@ -164,10 +165,12 @@ let ProfileHeaderLabeler = ({
moderation={moderation} moderation={moderation}
hideBackButton={hideBackButton} hideBackButton={hideBackButton}
isPlaceholderProfile={isPlaceholderProfile}> isPlaceholderProfile={isPlaceholderProfile}>
<View style={[a.px_lg, a.pt_md, a.pb_sm]} pointerEvents="box-none"> <View
style={[a.px_lg, a.pt_md, a.pb_sm]}
pointerEvents={isIOS ? 'auto' : 'box-none'}>
<View <View
style={[a.flex_row, a.justify_end, a.gap_sm, a.pb_lg]} style={[a.flex_row, a.justify_end, a.gap_sm, a.pb_lg]}
pointerEvents="box-none"> pointerEvents={isIOS ? 'auto' : 'box-none'}>
{isMe ? ( {isMe ? (
<Button <Button
testID="profileHeaderEditProfileButton" testID="profileHeaderEditProfileButton"

View File

@ -12,7 +12,7 @@ import {useLingui} from '@lingui/react'
import {useGate} from '#/lib/statsig/statsig' import {useGate} from '#/lib/statsig/statsig'
import {logger} from '#/logger' import {logger} from '#/logger'
import {isWeb} from '#/platform/detection' import {isIOS, isWeb} from '#/platform/detection'
import {Shadow} from '#/state/cache/types' import {Shadow} from '#/state/cache/types'
import {useModalControls} from '#/state/modals' import {useModalControls} from '#/state/modals'
import { import {
@ -152,10 +152,12 @@ let ProfileHeaderStandard = ({
moderation={moderation} moderation={moderation}
hideBackButton={hideBackButton} hideBackButton={hideBackButton}
isPlaceholderProfile={isPlaceholderProfile}> isPlaceholderProfile={isPlaceholderProfile}>
<View style={[a.px_lg, a.pt_md, a.pb_sm]} pointerEvents="box-none"> <View
style={[a.px_lg, a.pt_md, a.pb_sm]}
pointerEvents={isIOS ? 'auto' : 'box-none'}>
<View <View
style={[a.flex_row, a.justify_end, a.gap_sm, a.pb_sm]} style={[a.flex_row, a.justify_end, a.gap_sm, a.pb_sm]}
pointerEvents="box-none"> pointerEvents={isIOS ? 'auto' : 'box-none'}>
{isMe ? ( {isMe ? (
<Button <Button
testID="profileHeaderEditProfileButton" testID="profileHeaderEditProfileButton"

View File

@ -12,6 +12,7 @@ import {useSession} from '#/state/session'
import {BACK_HITSLOP} from 'lib/constants' import {BACK_HITSLOP} from 'lib/constants'
import {useWebMediaQueries} from 'lib/hooks/useWebMediaQueries' import {useWebMediaQueries} from 'lib/hooks/useWebMediaQueries'
import {NavigationProp} from 'lib/routes/types' import {NavigationProp} from 'lib/routes/types'
import {isIOS} from 'platform/detection'
import {LoadingPlaceholder} from 'view/com/util/LoadingPlaceholder' import {LoadingPlaceholder} from 'view/com/util/LoadingPlaceholder'
import {UserAvatar} from 'view/com/util/UserAvatar' import {UserAvatar} from 'view/com/util/UserAvatar'
import {UserBanner} from 'view/com/util/UserBanner' import {UserBanner} from 'view/com/util/UserBanner'
@ -61,8 +62,8 @@ let ProfileHeaderShell = ({
) )
return ( return (
<View style={t.atoms.bg} pointerEvents="box-none"> <View style={t.atoms.bg} pointerEvents={isIOS ? 'auto' : 'box-none'}>
<View pointerEvents="none"> <View pointerEvents={isIOS ? 'auto' : 'none'}>
{isPlaceholderProfile ? ( {isPlaceholderProfile ? (
<LoadingPlaceholder <LoadingPlaceholder
width="100%" width="100%"
@ -80,7 +81,9 @@ let ProfileHeaderShell = ({
{children} {children}
<View style={[a.px_lg, a.pb_sm]} pointerEvents="box-none"> <View
style={[a.px_lg, a.pb_sm]}
pointerEvents={isIOS ? 'auto' : 'box-none'}>
<ProfileHeaderAlerts moderation={moderation} /> <ProfileHeaderAlerts moderation={moderation} />
{isMe && ( {isMe && (
<LabelsOnMe details={{did: profile.did}} labels={profile.labels} /> <LabelsOnMe details={{did: profile.did}} labels={profile.labels} />

View File

@ -1,26 +1,28 @@
import * as React from 'react' import * as React from 'react'
import { import {
LayoutChangeEvent, LayoutChangeEvent,
NativeScrollEvent,
ScrollView, ScrollView,
StyleSheet, StyleSheet,
View, View,
NativeScrollEvent,
} from 'react-native' } from 'react-native'
import Animated, { import Animated, {
useAnimatedStyle, AnimatedRef,
useSharedValue,
runOnJS, runOnJS,
runOnUI, runOnUI,
scrollTo, scrollTo,
useAnimatedRef,
AnimatedRef,
SharedValue, SharedValue,
useAnimatedRef,
useAnimatedStyle,
useSharedValue,
} from 'react-native-reanimated' } from 'react-native-reanimated'
import {Pager, PagerRef, RenderTabBarFnProps} from 'view/com/pager/Pager'
import {TabBar} from './TabBar'
import {useNonReactiveCallback} from '#/lib/hooks/useNonReactiveCallback' import {useNonReactiveCallback} from '#/lib/hooks/useNonReactiveCallback'
import {ListMethods} from '../util/List'
import {ScrollProvider} from '#/lib/ScrollContext' import {ScrollProvider} from '#/lib/ScrollContext'
import {isIOS} from 'platform/detection'
import {Pager, PagerRef, RenderTabBarFnProps} from 'view/com/pager/Pager'
import {ListMethods} from '../util/List'
import {TabBar} from './TabBar'
export interface PagerWithHeaderChildParams { export interface PagerWithHeaderChildParams {
headerHeight: number headerHeight: number
@ -236,9 +238,12 @@ let PagerTabBar = ({
const headerRef = React.useRef(null) const headerRef = React.useRef(null)
return ( return (
<Animated.View <Animated.View
pointerEvents="box-none" pointerEvents={isIOS ? 'auto' : 'box-none'}
style={[styles.tabBarMobile, headerTransform]}> style={[styles.tabBarMobile, headerTransform]}>
<View ref={headerRef} pointerEvents="box-none" collapsable={false}> <View
ref={headerRef}
pointerEvents={isIOS ? 'auto' : 'box-none'}
collapsable={false}>
{renderHeader?.()} {renderHeader?.()}
{ {
// It wouldn't be enough to place `onLayout` on the parent node because // It wouldn't be enough to place `onLayout` on the parent node because