From f3905c574bc85d17cdc53e2b57d58ccc0bdcdf4e Mon Sep 17 00:00:00 2001
From: Samuel Newman <mozzius@protonmail.com>
Date: Tue, 26 Aug 2025 01:30:13 +0300
Subject: remove root sibling parent(s??) from composer (#8897)

---
 src/view/com/composer/Composer.tsx | 157 ++++++++++++++++++-------------------
 1 file changed, 76 insertions(+), 81 deletions(-)

(limited to 'src/view/com/composer/Composer.tsx')

diff --git a/src/view/com/composer/Composer.tsx b/src/view/com/composer/Composer.tsx
index c3e0526b9..d0dbdfaba 100644
--- a/src/view/com/composer/Composer.tsx
+++ b/src/view/com/composer/Composer.tsx
@@ -40,7 +40,6 @@ import Animated, {
   ZoomIn,
   ZoomOut,
 } from 'react-native-reanimated'
-import {RootSiblingParent} from 'react-native-root-siblings'
 import {useSafeAreaInsets} from 'react-native-safe-area-context'
 import {type ImagePickerAsset} from 'expo-image-picker'
 import {
@@ -663,88 +662,84 @@ export const ComposePost = ({
   const isWebFooterSticky = !isNative && thread.posts.length > 1
   return (
     <BottomSheetPortalProvider>
-      <RootSiblingParent>
-        <KeyboardAvoidingView
-          testID="composePostView"
-          behavior={isIOS ? 'padding' : 'height'}
-          keyboardVerticalOffset={keyboardVerticalOffset}
-          style={a.flex_1}>
-          <View
-            style={[a.flex_1, viewStyles]}
-            aria-modal
-            accessibilityViewIsModal>
-            <RootSiblingParent>
-              <ComposerTopBar
-                canPost={canPost}
-                isReply={!!replyTo}
-                isPublishQueued={publishOnUpload}
-                isPublishing={isPublishing}
-                isThread={thread.posts.length > 1}
-                publishingStage={publishingStage}
-                topBarAnimatedStyle={topBarAnimatedStyle}
-                onCancel={onPressCancel}
-                onPublish={onPressPublish}>
-                {missingAltError && <AltTextReminder error={missingAltError} />}
-                <ErrorBanner
-                  error={error}
-                  videoState={erroredVideo}
-                  clearError={() => setError('')}
-                  clearVideo={
-                    erroredVideoPostId
-                      ? () => clearVideo(erroredVideoPostId)
-                      : () => {}
-                  }
+      <KeyboardAvoidingView
+        testID="composePostView"
+        behavior={isIOS ? 'padding' : 'height'}
+        keyboardVerticalOffset={keyboardVerticalOffset}
+        style={a.flex_1}>
+        <View
+          style={[a.flex_1, viewStyles]}
+          aria-modal
+          accessibilityViewIsModal>
+          <ComposerTopBar
+            canPost={canPost}
+            isReply={!!replyTo}
+            isPublishQueued={publishOnUpload}
+            isPublishing={isPublishing}
+            isThread={thread.posts.length > 1}
+            publishingStage={publishingStage}
+            topBarAnimatedStyle={topBarAnimatedStyle}
+            onCancel={onPressCancel}
+            onPublish={onPressPublish}>
+            {missingAltError && <AltTextReminder error={missingAltError} />}
+            <ErrorBanner
+              error={error}
+              videoState={erroredVideo}
+              clearError={() => setError('')}
+              clearVideo={
+                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>
-
-              <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}
-                    />
-                    {isWebFooterSticky && post.id === activePost.id && (
-                      <View style={styles.stickyFooterWeb}>{footer}</View>
-                    )}
-                  </React.Fragment>
-                ))}
-              </Animated.ScrollView>
-              {!isWebFooterSticky && footer}
-            </RootSiblingParent>
-          </View>
+                {isWebFooterSticky && post.id === activePost.id && (
+                  <View style={styles.stickyFooterWeb}>{footer}</View>
+                )}
+              </React.Fragment>
+            ))}
+          </Animated.ScrollView>
+          {!isWebFooterSticky && footer}
+        </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>
+        <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>
     </BottomSheetPortalProvider>
   )
 }
-- 
cgit 1.4.1

