merge platform files#29212
Open
chrisnojima wants to merge 13 commits into
Open
Conversation
* 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
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.
Try and merge most .destkop and .native together
Make
isMobileetc global and static so dead code elimination works betterios 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)