Move /platform/detection vars into /env (#9707)
* Add platform vars to env * Replace /platform/detection with /env
This commit is contained in:
@@ -5,7 +5,6 @@ import {useLingui} from '@lingui/react'
|
||||
import {useQueryClient} from '@tanstack/react-query'
|
||||
|
||||
import {useInitialNumToRender} from '#/lib/hooks/useInitialNumToRender'
|
||||
import {isIOS, isNative} from '#/platform/detection'
|
||||
import {
|
||||
type FeedDescriptor,
|
||||
RQKEY as FEED_RQKEY,
|
||||
@@ -21,6 +20,7 @@ import {LoadLatestBtn} from '#/view/com/util/load-latest/LoadLatestBtn'
|
||||
import {atoms as a, ios, useTheme} from '#/alf'
|
||||
import {EditBig_Stroke1_Corner0_Rounded as EditIcon} from '#/components/icons/EditBig'
|
||||
import {Text} from '#/components/Typography'
|
||||
import {IS_IOS, IS_NATIVE} from '#/env'
|
||||
import {type SectionRef} from './types'
|
||||
|
||||
interface FeedSectionProps {
|
||||
@@ -53,13 +53,13 @@ export function ProfileFeedSection({
|
||||
const [hasNew, setHasNew] = useState(false)
|
||||
const [isScrolledDown, setIsScrolledDown] = useState(false)
|
||||
const shouldUseAdjustedNumToRender = feed.endsWith('posts_and_author_threads')
|
||||
const isVideoFeed = isNative && feed.endsWith('posts_with_video')
|
||||
const isVideoFeed = IS_NATIVE && feed.endsWith('posts_with_video')
|
||||
const adjustedInitialNumToRender = useInitialNumToRender({
|
||||
screenHeightOffset: headerHeight,
|
||||
})
|
||||
const onScrollToTop = useCallback(() => {
|
||||
scrollElRef.current?.scrollToOffset({
|
||||
animated: isNative,
|
||||
animated: IS_NATIVE,
|
||||
offset: -headerHeight,
|
||||
})
|
||||
truncateAndInvalidate(queryClient, FEED_RQKEY(feed))
|
||||
@@ -85,7 +85,7 @@ export function ProfileFeedSection({
|
||||
}, [_, emptyStateButton, emptyStateIcon, emptyStateMessage])
|
||||
|
||||
useEffect(() => {
|
||||
if (isIOS && isFocused && scrollElRef.current) {
|
||||
if (IS_IOS && isFocused && scrollElRef.current) {
|
||||
const nativeTag = findNodeHandle(scrollElRef.current)
|
||||
setScrollViewTag(nativeTag)
|
||||
}
|
||||
|
||||
@@ -10,7 +10,6 @@ import {msg, Trans} from '@lingui/macro'
|
||||
import {useLingui} from '@lingui/react'
|
||||
|
||||
import {isLabelerSubscribed, lookupLabelValueDefinition} from '#/lib/moderation'
|
||||
import {isIOS, isNative} from '#/platform/detection'
|
||||
import {List, type ListRef} from '#/view/com/util/List'
|
||||
import {atoms as a, ios, tokens, useTheme} from '#/alf'
|
||||
import {Divider} from '#/components/Divider'
|
||||
@@ -19,6 +18,7 @@ import {ListFooter} from '#/components/Lists'
|
||||
import {Loader} from '#/components/Loader'
|
||||
import {LabelerLabelPreference} from '#/components/moderation/LabelPreference'
|
||||
import {Text} from '#/components/Typography'
|
||||
import {IS_IOS, IS_NATIVE} from '#/env'
|
||||
import {ErrorState} from '../ErrorState'
|
||||
import {type SectionRef} from './types'
|
||||
|
||||
@@ -49,7 +49,7 @@ export function ProfileLabelsSection({
|
||||
|
||||
const onScrollToTop = useCallback(() => {
|
||||
scrollElRef.current?.scrollToOffset({
|
||||
animated: isNative,
|
||||
animated: IS_NATIVE,
|
||||
offset: -headerHeight,
|
||||
})
|
||||
}, [scrollElRef, headerHeight])
|
||||
@@ -59,7 +59,7 @@ export function ProfileLabelsSection({
|
||||
}))
|
||||
|
||||
useEffect(() => {
|
||||
if (isIOS && isFocused && scrollElRef.current) {
|
||||
if (IS_IOS && isFocused && scrollElRef.current) {
|
||||
const nativeTag = findNodeHandle(scrollElRef.current)
|
||||
setScrollViewTag(nativeTag)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user