mirror of https://git.lenooby09.tech/LeNooby09/social-app.git
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

[🐴] Don't submit the message on return press when on a phone (web input) (#4203)

move this to the `onKeyDown` prop

Revert "do the same for tablets"

This reverts commit 47c709e2734f2acf34f89dd5aca42a75a2b56270.

do the same for tablets

don't submit message if the device is a phone on web

move `onTouchStart` to `browser.ts` globals

authored by hailey.at and committed by

GitHub 85782aeb fa039e54

+11 -6
+1 -2
src/components/ProfileHoverCard/index.web.tsx
··· 11 11 import {useModerationOpts} from '#/state/preferences/moderation-opts' 12 12 import {usePrefetchProfileQuery, useProfileQuery} from '#/state/queries/profile' 13 13 import {useSession} from '#/state/session' 14 + import {isTouchDevice} from 'lib/browser' 14 15 import {useProfileShadow} from 'state/cache/profile-shadow' 15 16 import {formatCount} from '#/view/com/util/numeric/format' 16 17 import {UserAvatar} from '#/view/com/util/UserAvatar' ··· 42 43 }, 43 44 }), 44 45 ] 45 - 46 - const isTouchDevice = 'ontouchstart' in window || navigator.maxTouchPoints > 1 47 46 48 47 export function ProfileHoverCard(props: ProfileHoverCardProps) { 49 48 if (props.disable || isTouchDevice) {
+1
src/lib/browser.native.ts
··· 1 1 export const isSafari = false 2 2 export const isFirefox = false 3 + export const isTouchDevice = true
+2 -1
src/lib/browser.ts
··· 2 2 export const isSafari = /^((?!chrome|android).)*safari/i.test( 3 3 navigator.userAgent, 4 4 ) 5 - 6 5 export const isFirefox = /firefox|fxios/i.test(navigator.userAgent) 6 + export const isTouchDevice = 7 + 'ontouchstart' in window || navigator.maxTouchPoints > 1
+7 -3
src/screens/Messages/Conversation/MessageInput.web.tsx
··· 10 10 useMessageDraft, 11 11 useSaveMessageDraft, 12 12 } from '#/state/messages/message-drafts' 13 - import {isSafari} from 'lib/browser' 13 + import {isSafari, isTouchDevice} from 'lib/browser' 14 + import {useWebMediaQueries} from 'lib/hooks/useWebMediaQueries' 14 15 import * as Toast from '#/view/com/util/Toast' 15 16 import {atoms as a, useTheme} from '#/alf' 16 17 import {useSharedInputStyles} from '#/components/forms/TextField' ··· 21 22 }: { 22 23 onSendMessage: (message: string) => void 23 24 }) { 25 + const {isTabletOrDesktop} = useWebMediaQueries() 24 26 const {_} = useLingui() 25 27 const t = useTheme() 26 28 const {getDraft, clearDraft} = useMessageDraft() ··· 74 76 onSubmit() 75 77 } 76 78 }, 77 - [onSubmit, isComposing], 79 + [onSubmit], 78 80 ) 79 81 80 82 const onChange = React.useCallback( ··· 134 136 }} 135 137 onHeightChange={height => setTextAreaHeight(height)} 136 138 onChange={onChange} 137 - onKeyDown={onKeyDown} 139 + // On mobile web phones, we want to keep the same behavior as the native app. Do not submit the message 140 + // in these cases. 141 + onKeyDown={isTouchDevice && isTabletOrDesktop ? undefined : onKeyDown} 138 142 /> 139 143 <Pressable 140 144 accessibilityRole="button"