remove root sibling parent(s??) from composer (#8897)

This commit is contained in:
Samuel Newman
2025-08-26 01:30:13 +03:00
committed by GitHub
parent 27c591f031
commit f3905c574b
+76 -81
View File
@@ -40,7 +40,6 @@ import Animated, {
ZoomIn, ZoomIn,
ZoomOut, ZoomOut,
} from 'react-native-reanimated' } from 'react-native-reanimated'
import {RootSiblingParent} from 'react-native-root-siblings'
import {useSafeAreaInsets} from 'react-native-safe-area-context' import {useSafeAreaInsets} from 'react-native-safe-area-context'
import {type ImagePickerAsset} from 'expo-image-picker' import {type ImagePickerAsset} from 'expo-image-picker'
import { import {
@@ -663,88 +662,84 @@ export const ComposePost = ({
const isWebFooterSticky = !isNative && thread.posts.length > 1 const isWebFooterSticky = !isNative && thread.posts.length > 1
return ( return (
<BottomSheetPortalProvider> <BottomSheetPortalProvider>
<RootSiblingParent> <KeyboardAvoidingView
<KeyboardAvoidingView testID="composePostView"
testID="composePostView" behavior={isIOS ? 'padding' : 'height'}
behavior={isIOS ? 'padding' : 'height'} keyboardVerticalOffset={keyboardVerticalOffset}
keyboardVerticalOffset={keyboardVerticalOffset} style={a.flex_1}>
style={a.flex_1}> <View
<View style={[a.flex_1, viewStyles]}
style={[a.flex_1, viewStyles]} aria-modal
aria-modal accessibilityViewIsModal>
accessibilityViewIsModal> <ComposerTopBar
<RootSiblingParent> canPost={canPost}
<ComposerTopBar isReply={!!replyTo}
canPost={canPost} isPublishQueued={publishOnUpload}
isReply={!!replyTo} isPublishing={isPublishing}
isPublishQueued={publishOnUpload} isThread={thread.posts.length > 1}
isPublishing={isPublishing} publishingStage={publishingStage}
isThread={thread.posts.length > 1} topBarAnimatedStyle={topBarAnimatedStyle}
publishingStage={publishingStage} onCancel={onPressCancel}
topBarAnimatedStyle={topBarAnimatedStyle} onPublish={onPressPublish}>
onCancel={onPressCancel} {missingAltError && <AltTextReminder error={missingAltError} />}
onPublish={onPressPublish}> <ErrorBanner
{missingAltError && <AltTextReminder error={missingAltError} />} error={error}
<ErrorBanner videoState={erroredVideo}
error={error} clearError={() => setError('')}
videoState={erroredVideo} clearVideo={
clearError={() => setError('')} erroredVideoPostId
clearVideo={ ? () => clearVideo(erroredVideoPostId)
erroredVideoPostId : () => {}
? () => clearVideo(erroredVideoPostId) }
: () => {} />
} </ComposerTopBar>
<Animated.ScrollView
ref={scrollViewRef}
layout={native(LinearTransition)}
onScroll={scrollHandler}
contentContainerStyle={a.flex_grow}
style={a.flex_1}
keyboardShouldPersistTaps="always"
onContentSizeChange={onScrollViewContentSizeChange}
onLayout={onScrollViewLayout}>
{replyTo ? <ComposerReplyTo replyTo={replyTo} /> : undefined}
{thread.posts.map((post, index) => (
<React.Fragment key={post.id}>
<ComposerPost
post={post}
dispatch={composerDispatch}
textInput={post.id === activePost.id ? textInput : null}
isFirstPost={index === 0}
isLastPost={index === thread.posts.length - 1}
isPartOfThread={thread.posts.length > 1}
isReply={index > 0 || !!replyTo}
isActive={post.id === activePost.id}
canRemovePost={thread.posts.length > 1}
canRemoveQuote={index > 0 || !initQuote}
onSelectVideo={selectVideo}
onClearVideo={clearVideo}
onPublish={onComposerPostPublish}
onError={setError}
/> />
</ComposerTopBar> {isWebFooterSticky && post.id === activePost.id && (
<View style={styles.stickyFooterWeb}>{footer}</View>
)}
</React.Fragment>
))}
</Animated.ScrollView>
{!isWebFooterSticky && footer}
</View>
<Animated.ScrollView <Prompt.Basic
ref={scrollViewRef} control={discardPromptControl}
layout={native(LinearTransition)} title={_(msg`Discard draft?`)}
onScroll={scrollHandler} description={_(msg`Are you sure you'd like to discard this draft?`)}
contentContainerStyle={a.flex_grow} onConfirm={onClose}
style={a.flex_1} confirmButtonCta={_(msg`Discard`)}
keyboardShouldPersistTaps="always" confirmButtonColor="negative"
onContentSizeChange={onScrollViewContentSizeChange} />
onLayout={onScrollViewLayout}> </KeyboardAvoidingView>
{replyTo ? <ComposerReplyTo replyTo={replyTo} /> : undefined}
{thread.posts.map((post, index) => (
<React.Fragment key={post.id}>
<ComposerPost
post={post}
dispatch={composerDispatch}
textInput={post.id === activePost.id ? textInput : null}
isFirstPost={index === 0}
isLastPost={index === thread.posts.length - 1}
isPartOfThread={thread.posts.length > 1}
isReply={index > 0 || !!replyTo}
isActive={post.id === activePost.id}
canRemovePost={thread.posts.length > 1}
canRemoveQuote={index > 0 || !initQuote}
onSelectVideo={selectVideo}
onClearVideo={clearVideo}
onPublish={onComposerPostPublish}
onError={setError}
/>
{isWebFooterSticky && post.id === activePost.id && (
<View style={styles.stickyFooterWeb}>{footer}</View>
)}
</React.Fragment>
))}
</Animated.ScrollView>
{!isWebFooterSticky && footer}
</RootSiblingParent>
</View>
<Prompt.Basic
control={discardPromptControl}
title={_(msg`Discard draft?`)}
description={_(msg`Are you sure you'd like to discard this draft?`)}
onConfirm={onClose}
confirmButtonCta={_(msg`Discard`)}
confirmButtonColor="negative"
/>
</KeyboardAvoidingView>
</RootSiblingParent>
</BottomSheetPortalProvider> </BottomSheetPortalProvider>
) )
} }