plat merge 2#29213
Merged
chrisnojima merged 28 commits intoMay 18, 2026
Merged
Conversation
Pairs merged (desktop stub + native impl → single file with isMobile guard): - settings/make-icons.page - teams/add-members-wizard/add-contacts - teams/invite-by-contact/team-invite-by-contacts - provision/code-page/qr-scan/scanner - util/expo-image-picker Update explicit .native imports in input.native.tsx, misc.native.tsx, and fs-platform.native.tsx to point to the new merged files.
contacts-list.native and use-contacts.native import expo-contacts and expo-localization. Now that add-contacts.tsx and team-invite-by-contacts.tsx are plain .tsx files, those top-level imports would be bundled by desktop webpack. Move them into require() calls inside the mobile component bodies.
- use-intersection-observer: desktop impl with isMobile stub guard - use-resize-observer: desktop impl with isMobile stub guard - common-adapters/text-url: unified useClickURL with isMobile branch - app/main: two named components, export isMobile ? NativeMain : DesktopMain - globals.native.d.ts: add stubs for browser observer/DOM types used in desktop branches - Update explicit .desktop/.native imports in index files and main2.desktop.tsx
…f import for desktop files
…rl, app/main, observers
…-actions, platform-specific, engine
Metro's dynamic import() calls importAll() which iterates all lazy
getters of a module, including PushNotificationIOS from react-native.
That getter calls NativeEventEmitter before native modules are
registered, causing: "new NativeEventEmitter() requires a non-null
argument".
The original index.native.tsx used static named imports (import
{Linking} from 'react-native') which do not trigger importAll. The
merged file used await import('react-native') which does.
Fix: use require() throughout _getNative to avoid importAll on
react-native and other packages. Also inline the now-synchronous
netInfoSetup and initAudioModes wrappers.
…hy/normal components
- router-v2/linking.tsx: static Linking import; keep push require (cycle)
- router-v2/screen-layout.tsx: static react-native-screens/experimental import
- router-v2/router.tsx: static @callstack/liquid-glass, @react-navigation/bottom-tabs, react-native imports
- engine/index.platform.tsx: static KB2, local-debug, platform, react-native-kb imports; keep require('net')
- native-only-modules.js: add @callstack/liquid-glass, react-native-screens/experimental, @react-navigation/bottom-tabs
- webpack.config.mts: sort aliases longest-first so subpath entries (e.g. foo/bar) match before their prefix (foo)
Contributor
There was a problem hiding this comment.
Pull request overview
This PR merges many desktop/native platform-specific modules into shared implementations gated by runtime platform checks, while updating import paths, webpack aliases, and native type stubs to support the platform merge.
Changes:
- Consolidates utilities, common adapters, chat UI/media components, stores, and app/router entry points from
.desktop/.nativevariants into shared files. - Updates Electron/platform imports to use shared modules and expands desktop webpack/native module stubbing.
- Adds native DOM/type stubs and adjusts media, image, list, popup, and notification wrappers for merged platform code.
Reviewed changes
Copilot reviewed 172 out of 173 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| shared/util/use-resize-observer.tsx | Adds mobile stub and desktop implementation split. |
| shared/util/use-resize-observer.native.tsx | Removes native-specific stub. |
| shared/util/use-intersection-observer.tsx | Adds mobile stub and desktop implementation split. |
| shared/util/use-intersection-observer.native.tsx | Removes native-specific stub. |
| shared/util/storeless-actions.tsx | Merges desktop/mobile storeless actions. |
| shared/util/storeless-actions.desktop.tsx | Removes desktop-specific actions. |
| shared/util/platform-specific/index.tsx | Adds platform guards and desktop fallbacks. |
| shared/util/platform-specific/index.desktop.tsx | Removes desktop-specific platform helpers. |
| shared/util/misc.tsx | Adds merged URL, picker, notification utilities. |
| shared/util/misc.native.tsx | Removes native-specific misc utilities. |
| shared/util/misc.desktop.tsx | Removes desktop-specific misc utilities. |
| shared/util/expo-image-picker.tsx | Adds desktop cancellation guards. |
| shared/util/expo-image-picker.desktop.tsx | Removes desktop-specific image picker stub. |
| shared/util/electron.tsx | Merges Electron desktop implementation with native stub. |
| shared/util/electron.native.tsx | Removes native Electron stub. |
| shared/util/clipboard.desktop.tsx | Updates Electron import path. |
| shared/unlock-folders/main.desktop.tsx | Updates Electron wait import. |
| shared/tsconfig.desktop.json | Excludes native declaration files from desktop config. |
| shared/tracker/main2.desktop.tsx | Updates Electron import path. |
| shared/tracker/main.desktop.tsx | Updates Electron wait import. |
| shared/teams/invite-by-contact/team-invite-by-contacts.tsx | Merges mobile contacts invite with desktop null guard. |
| shared/teams/invite-by-contact/team-invite-by-contacts.desktop.tsx | Removes desktop null component. |
| shared/teams/add-members-wizard/add-contacts.tsx | Merges mobile contacts add-members with desktop null guard. |
| shared/teams/add-members-wizard/add-contacts.desktop.tsx | Removes desktop null component. |
| shared/styles/index.native.tsx | Removes native-specific styles entry. |
| shared/styles/colors.tsx | Static imports DynamicColorIOS. |
| shared/stores/tests/darkmode.test.ts | Updates Electron mock path. |
| shared/stores/settings-phone.tsx | Static imports phone formatting helper. |
| shared/stores/settings-contacts.tsx | Merges native contacts store with desktop no-op dispatch. |
| shared/stores/settings-contacts.desktop.tsx | Removes desktop contacts store. |
| shared/stores/push.tsx | Merges native push store with desktop no-op dispatch. |
| shared/stores/push.desktop.tsx | Removes desktop push store. |
| shared/stores/fs-platform.native.tsx | Removes native FS platform module. |
| shared/stores/fs-platform.desktop.tsx | Removes desktop FS platform module. |
| shared/stores/darkmode.tsx | Updates Electron dynamic import path. |
| shared/settings/make-icons.page.tsx | Adds merged development make-icons page. |
| shared/settings/make-icons.page.native.tsx | Removes native make-icons stub. |
| shared/settings/make-icons.page.desktop.tsx | Removes desktop make-icons page. |
| shared/settings/feedback/container.tsx | Static imports RNKB feedback helpers. |
| shared/router-v2/tab-bar.desktop.tsx | Updates Electron import path. |
| shared/router-v2/screen-layout.tsx | Merges native and desktop screen layout creation. |
| shared/router-v2/screen-layout-modal.desktop.tsx | Exports modal wrapper and removes desktop makeLayout. |
| shared/router-v2/linking.tsx | Static imports React Native Linking. |
| shared/router-v2/header/index.desktop.tsx | Updates Electron import path. |
| shared/router-v2/common.tsx | Converts React import to type-only. |
| shared/provision/code-page/qr-scan/scanner.tsx | Merges QR scanner with desktop null guard. |
| shared/provision/code-page/qr-scan/scanner.desktop.tsx | Removes desktop QR scanner stub. |
| shared/profile/edit-avatar/index.tsx | Static imports picker/zoom helpers and shared Electron path. |
| shared/pinentry/main.desktop.tsx | Updates Electron wait import. |
| shared/people/container.tsx | Static imports phone formatting helper. |
| shared/native-only-modules.js | Adds additional native-only module aliases. |
| shared/menubar/remote-proxy.desktop.tsx | Updates Electron import path. |
| shared/menubar/main.desktop.tsx | Updates Electron wait import. |
| shared/menubar/index.desktop.tsx | Updates Electron import path. |
| shared/login/relogin/index.native.tsx | Removes native relogin implementation. |
| shared/login/relogin/index.desktop.tsx | Removes desktop relogin implementation. |
| shared/local-debug.tsx | Updates Electron require path. |
| shared/globals.native.d.ts | Adds native stubs for DOM/web APIs. |
| shared/git/routes.tsx | Static imports git nav header. |
| shared/engine/index.platform.tsx | Merges desktop and native engine transports. |
| shared/engine/index.platform.native.tsx | Removes native engine transport. |
| shared/desktop/webpack.config.mts | Adds alias sorting and null-loader for native files. |
| shared/desktop/renderer/remote-event-handler.desktop.tsx | Updates init import path. |
| shared/desktop/renderer/preload.desktop.tsx | Updates Electron type/import path. |
| shared/desktop/renderer/main2.desktop.tsx | Updates shared app/style/init imports. |
| shared/desktop/renderer/main.desktop.tsx | Updates Electron import path. |
| shared/desktop/remote/use-serialize-props.desktop.tsx | Updates Electron import path. |
| shared/desktop/remote/use-browser-window.desktop.tsx | Updates Electron import path. |
| shared/desktop/remote/remote-component.desktop.tsx | Updates Electron import path and window access. |
| shared/desktop/remote/component-loader.desktop.tsx | Updates shared styles/Electron imports. |
| shared/desktop/app/paths.desktop.tsx | Updates Electron import path. |
| shared/desktop/app/node.desktop.tsx | Updates shared platform/Electron imports. |
| shared/desktop/app/menu-bar.desktop.tsx | Updates shared platform import. |
| shared/desktop/app/main-window.desktop.tsx | Updates shared platform/Electron imports. |
| shared/desktop/app/kb2-impl.desktop.tsx | Updates Electron type import. |
| shared/desktop/app/ipctypes.tsx | Updates Electron type import. |
| shared/desktop/app/ipc-handlers.desktop.tsx | Updates shared platform/Electron imports. |
| shared/desktop/app/exec.desktop.tsx | Updates shared platform import. |
| shared/desktop/app/dynamic-config.tsx | Updates shared platform import. |
| shared/desktop/app/app-events.desktop.tsx | Updates shared platform/Electron imports. |
| shared/crypto/sub-nav/index.tsx | Merges native and desktop crypto sub-nav. |
| shared/crypto/sub-nav/index.native.tsx | Removes native crypto sub-nav. |
| shared/constants/remote.tsx | Updates Electron import path. |
| shared/constants/platform.native.tsx | Removes native platform constants. |
| shared/constants/platform.desktop.tsx | Removes desktop platform constants. |
| shared/constants/init/desktop-dom-helpers.desktop.tsx | Adds desktop DOM helper functions. |
| shared/common-adapters/zoomable-image.tsx | Static imports native zoom/image helpers. |
| shared/common-adapters/video.tsx | Static imports native video helpers. |
| shared/common-adapters/usernames.tsx | Static imports phone formatting helper. |
| shared/common-adapters/text-url.tsx | Adds merged URL click handlers. |
| shared/common-adapters/text-url.native.tsx | Removes native URL handler. |
| shared/common-adapters/text-url.desktop.tsx | Removes desktop URL handler. |
| shared/common-adapters/team-with-popup.tsx | Static imports team info popup. |
| shared/common-adapters/reanimated.tsx | Static imports reanimated module. |
| shared/common-adapters/profile-card.tsx | Static imports chat/follow buttons. |
| shared/common-adapters/popup/floating-box/index.tsx | Adds merged floating box. |
| shared/common-adapters/popup/floating-box/index.native.tsx | Removes native floating box. |
| shared/common-adapters/popup/floating-box/index.desktop.tsx | Removes desktop floating box. |
| shared/common-adapters/popup/bottom-sheet.tsx | Adds merged bottom-sheet wrappers. |
| shared/common-adapters/popup/bottom-sheet.native.tsx | Removes native bottom-sheet re-export. |
| shared/common-adapters/popup/bottom-sheet.desktop.tsx | Removes desktop bottom-sheet stubs. |
| shared/common-adapters/list.tsx | Adds merged LegendList wrapper. |
| shared/common-adapters/list.native.tsx | Removes native list wrapper. |
| shared/common-adapters/list.desktop.tsx | Removes desktop list wrapper. |
| shared/common-adapters/keyboard-avoiding-view.tsx | Static imports native keyboard helpers. |
| shared/common-adapters/input3.tsx | Static imports native TextInput and CSS. |
| shared/common-adapters/index.tsx | Merges adapter exports for both platforms. |
| shared/common-adapters/index.desktop.tsx | Removes desktop adapter barrel. |
| shared/common-adapters/image.tsx | Adds merged image component. |
| shared/common-adapters/image.native.tsx | Removes native image component. |
| shared/common-adapters/image.desktop.tsx | Removes desktop image component. |
| shared/common-adapters/image-icon.tsx | Static imports RN image and platform helper. |
| shared/common-adapters/icon.tsx | Static imports RN Text. |
| shared/common-adapters/hot-key.tsx | Adjusts document global typing. |
| shared/common-adapters/copyable-text.tsx | Static imports clipboard helper. |
| shared/common-adapters/button.tsx | Static imports native/adapter dependencies. |
| shared/common-adapters/box.tsx | Static imports reanimated. |
| shared/common-adapters/avatar/index.tsx | Static imports Expo Image. |
| shared/common-adapters/avatar/icon-to-img-set.tsx | Static imports asset path helper. |
| shared/chat/conversation/normal/index.tsx | Merges native and desktop conversation layouts. |
| shared/chat/conversation/normal/index.native.tsx | Removes native conversation layout. |
| shared/chat/conversation/messages/text/unfurl/unfurl-list/image/video.tsx | Adds merged unfurl video component. |
| shared/chat/conversation/messages/text/unfurl/unfurl-list/image/video.native.tsx | Removes native unfurl video. |
| shared/chat/conversation/messages/text/unfurl/unfurl-list/image/video.desktop.tsx | Removes desktop unfurl video. |
| shared/chat/conversation/messages/text/bottom.tsx | Static imports text bottom components. |
| shared/chat/conversation/messages/system-users-added-to-conv/wrapper.tsx | Static imports system message component. |
| shared/chat/conversation/messages/system-text/wrapper.tsx | Static imports system text component. |
| shared/chat/conversation/messages/system-simple-to-complex/wrapper.tsx | Static imports system message component. |
| shared/chat/conversation/messages/system-sbs-resolve/wrapper.tsx | Static imports SBS/joined components. |
| shared/chat/conversation/messages/system-new-channel/wrapper.tsx | Static imports new-channel component. |
| shared/chat/conversation/messages/system-left/wrapper.tsx | Static imports left component. |
| shared/chat/conversation/messages/system-joined/wrapper.tsx | Static imports joined component. |
| shared/chat/conversation/messages/system-invite-accepted/wrapper.tsx | Static imports invite-accepted component. |
| shared/chat/conversation/messages/system-git-push/wrapper.tsx | Static imports git-push component. |
| shared/chat/conversation/messages/system-create-team/wrapper.tsx | Static imports create-team component. |
| shared/chat/conversation/messages/system-change-retention/wrapper.tsx | Static imports retention component. |
| shared/chat/conversation/messages/system-change-avatar/wrapper.tsx | Static imports avatar-change component. |
| shared/chat/conversation/messages/system-added-to-team/wrapper.tsx | Static imports added-to-team component. |
| shared/chat/conversation/messages/set-description/wrapper.tsx | Static imports set-description component. |
| shared/chat/conversation/messages/set-channelname/wrapper.tsx | Static imports set-channelname component. |
| shared/chat/conversation/messages/pin/wrapper.tsx | Static imports pin component. |
| shared/chat/conversation/messages/cards/team-journey/wrapper.tsx | Static imports team journey card. |
| shared/chat/conversation/messages/attachment/wrapper.tsx | Static imports attachment renderers. |
| shared/chat/conversation/messages/attachment/video/videoimpl.tsx | Adds merged attachment video implementation. |
| shared/chat/conversation/messages/attachment/video/videoimpl.native.tsx | Removes native attachment video implementation. |
| shared/chat/conversation/messages/attachment/video/videoimpl.desktop.tsx | Removes desktop attachment video implementation. |
| shared/chat/conversation/messages/account-payment/wrapper.tsx | Static imports payment message component. |
| shared/chat/conversation/input-area/location-popup.tsx | Static imports Expo Location. |
| shared/chat/conversation/giphy/index.tsx | Merges native and desktop Giphy search. |
| shared/chat/conversation/giphy/index.native.tsx | Removes native Giphy search. |
| shared/chat/conversation/attachment-fullscreen/index.tsx | Static imports native fullscreen media helpers. |
| shared/chat/audio/audio-video.tsx | Static imports native audio event helpers. |
| shared/app/main.tsx | Merges native and desktop app roots. |
| shared/app/main.desktop.tsx | Removes desktop app root. |
| shared/app/index.native.tsx | Uses shared app main and init imports. |
Comments suppressed due to low confidence (4)
shared/app/main.tsx:7
- This shared entry point is imported by the native app, but it now statically imports the Electron remote-proxy tree. That pulls
.desktopmodules (and their Electron/DOM dependencies) into the mobile bundle before theisMobilebranch can exclude them, so the desktop-only import needs to be lazy/guarded insideDesktopMainor kept in a desktop-specific file.
shared/crypto/sub-nav/index.tsx:17 - The shared sub-nav module is used on native after removing
index.native.tsx, but this static.desktopimport brings the desktop left-nav implementation into the mobile bundle. Since the native export only needsNativeCryptoSubNav, loadLeftNavlazily inside the desktop path (or keep the desktop implementation split) to avoid bundling desktop-only code on mobile.
shared/chat/conversation/giphy/index.tsx:15 DOMRectis a DOM type, but the native tsconfig only includesESNextand the added native globals declareDOMRectReadOnly, notDOMRect. Because this shared file now replaces the native implementation, native typechecking will fail unless this type is stubbed or changed to a local shape.
shared/chat/conversation/normal/index.tsx:18- Because this shared conversation component now replaces the native file, the native Metro build will follow this static
clipboard.desktopimport and the RN transformer explicitly throws on.desktop.tsxfiles. Move the clipboard import into the desktop-only branch (or keep a split desktop wrapper) so native does not transform desktop code.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+50
to
+52
| <video | ||
| ref={videoRef as React.RefObject<HTMLVideoElement>} | ||
| onClick={_onClick} |
| </div> | ||
| ) : ( | ||
| <video | ||
| ref={ref as React.RefObject<HTMLVideoElement>} |
* WIP * WIP
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.