Skip to content

merge platform files#29212

Open
chrisnojima wants to merge 13 commits into
nojima/HOTPOT-next-670-clean-2from
nojima/HOTPOT-plat-merge
Open

merge platform files#29212
chrisnojima wants to merge 13 commits into
nojima/HOTPOT-next-670-clean-2from
nojima/HOTPOT-plat-merge

Conversation

@chrisnojima
Copy link
Copy Markdown
Contributor

@chrisnojima chrisnojima commented May 17, 2026

Try and merge most .destkop and .native together
Make isMobile etc global and static so dead code elimination works better

ios bundle
Base: 10,912,683 bytes, 4536 modules
Branch: 10,851,820 bytes, 4563 modules (-61KB vs base)

electron bundle:
Branch 28.73 MB (30,127,657 bytes)
Base 29.00 MB (30,403,941 bytes) (-276,284 bytes vs base)

This comment was marked as outdated.

@chrisnojima chrisnojima changed the title WIP: merge platform files merge platform files May 17, 2026
@chrisnojima chrisnojima requested a review from Copilot May 17, 2026 20:15
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot wasn't able to review this pull request because it exceeds the maximum number of files (300). Try reducing the number of changed files and requesting a review from Copilot again.

* Merge 5 stub platform pairs into unified .tsx files

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.

* Fix desktop build: move native-only imports inside mobile code path

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.

* Merge observer hooks and simple util platform pairs

- 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

* Fix Task 2 type errors: DOM stubs in globals.native.d.ts, avoid typeof import for desktop files

* merge platform files: image, list, bottom-sheet, floating-box, text-url, app/main, observers

* merge navigation: screen-layout, crypto sub-nav, relogin

* merge chat components: giphy, input, list-area, video, conversation, inbox

* merge infrastructure: push, settings-contacts, fs-platform, storeless-actions, platform-specific, engine

* merge platform constants and utils: platform, init, electron, misc

* merge router and styles — final large platform splits

* merge common-adapters/index and fix styles/globals native stubs

* fix webpack: null-load .native.tsx files; inline useRootKey in router

* fix lodash require: remove incorrect .default on CommonJS exports

* fix useIntersectionObserver require: access .default for default export

* fix iOS crash: replace await import() with require() in _getNative

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.

* replace dynamic require() with static imports in app/main and chat message wrappers

* replace dynamic require() with static imports in chat audio/video/giphy/normal components

* replace dynamic require() with static imports in chat list/inbox/input/fullscreen

* replace dynamic require() with static imports in common-adapters

* replace dynamic requires with static imports in batch 5

* add expo-clipboard and expo-image to native-only-modules for webpack

* replace dynamic requires with static imports in batch 6

* replace dynamic requires with static imports in batch 7

* replace dynamic requires with static imports in batch 8

* replace dynamic requires with static imports in batch 9

- 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)

* WIP

* WIP

* plat merge 3 cross cleanup (#29214)

* WIP

* WIP
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants