chore: example app — macOS (react-native-macos 0.81) split-pane#25
Closed
LeslieOA wants to merge 7 commits into
Closed
chore: example app — macOS (react-native-macos 0.81) split-pane#25LeslieOA wants to merge 7 commits into
LeslieOA wants to merge 7 commits into
Conversation
Adds a runnable macOS example under `example/macos-app/`, scaffolded via `@react-native-community/cli init --version 0.81.2` then `react-native-macos-init` (which installs `react-native-macos@^0.81`). Layout per #17 + user's revised spec: a fixed split pane with `<SourceEditor>` on the left and a `<WebView>` preview on the right. Top tab bar switches Markdown / JSON / JavaScript / TypeScript / HTML. Each language seeds a sample and drives the right pane: markdown → marked-rendered HTML, html → the doc itself, JS/TS → captured console output (TS types stripped before exec), JSON / plaintext → monospace dump. Toolchain notes (deliberately different from the iOS example): - Plain RN, no Expo. `react-native run-macos` does NOT auto-pod — `pod install` is the correct manual invocation here. - The `cocoapods-spm` Podfile mods are written directly into `macos/Podfile` (no Expo config plugin to inject them, since there's no `expo prebuild` flow). - `--legacy-peer-deps` required: react-native-macos@0.81.7 declares `react@^19.1.4` as a peer but RN 0.81.2 ships `react@19.1.0`. Mismatch is upstream. - Module resolution mirrors the iOS pattern: `metro.config.js` maps `@workspace-sh/react-native-source-editor` to the repo root via `extraNodeModules` + `watchFolders` + `blockList` for parent react/react-native; tsconfig has the same `paths` mapping. - `@expo/ui` doesn't exist on macOS — the toolbar is plain RN Pressables. No Liquid Glass on this side. Root scripts mirror the Workspace `desktop:*` set: macos:plugin (gem), macos:install (--legacy-peer-deps), macos:pods, macos:clean (wipe Pods/Podfile.lock/build), macos:start / macos:clear, macos:run, macos:dev (concurrent). The unused `ios/` and `android/` scaffolding from `react-native init` is removed — this app is macOS-only. Note: the macOS branch of `SourceEditorView.swift` has never been exercised end-to-end. Compile/runtime issues likely on first build and will be fixed forward on the same branch. Closes #17
Unlike Expo's run:ios, react-native run-macos doesn't start Metro itself. Both READMEs now lead with macos:dev (concurrent Metro + run-macos), with macos:start + macos:run documented as the two-terminal alternative.
RN's vendored fmt failed to compile under Xcode 16/17 + macOS 14 with 'call to consteval function ... is not a constant expression'. post_install patches the fmt target to define FMT_USE_CONSTEVAL=0.
Previous attempt scoped the define to the fmt target only, but the consteval errors instantiate in EVERY pod that includes fmt headers (RCT-Folly, React-jsi, etc.). Now applies the define at the umbrella project level (xcconfig) and on every pod target, via both GCC_PREPROCESSOR_DEFINITIONS and OTHER_CPLUSPLUSFLAGS for safety.
xcconfig and OTHER_CPLUSPLUSFLAGS approaches both failed to make FMT_USE_CONSTEVAL=0 reach fmt's headers in time — the consteval calls were still firing in format-inl.h. Switch to a direct post_install file patch: prepend a guarded `#define FMT_USE_CONSTEVAL 0` to Pods/fmt/include/fmt/base.h. The marker comment makes it idempotent on subsequent installs.
Previous patch ran but didn't visibly land — likely my conditional short-circuited on a path I wasn't expecting, or the file we needed to patch wasn't base.h alone. This version: - Patches base.h, core.h AND format.h (whichever exist) so we cover fmt's auto-detection wherever it lives across versions - ALSO appends GCC_PREPROCESSOR_DEFINITIONS = $(inherited) FMT_USE_CONSTEVAL=0 to every xcconfig under the sandbox, as belt-and-braces in case a header is included before our patched source - Prints diagnostic lines (sandbox path, file existence, patched/ already-patched status) so we can see exactly what ran
…ection chain Top-of-file #define-if-undefined was correctly applied but didn't stick: fmt's auto-detection block (base.h lines 119-138) is NOT wrapped in #ifndef and UNCONDITIONALLY reassigns FMT_USE_CONSTEVAL based on compiler probes. On Apple Clang 17 the `__cpp_consteval` branch fires and sets it back to 1, so by the time FMT_CONSTEVAL expands to consteval, the override is gone. This patch finds the precise anchor between the detection chain's closing #endif and the next `#if FMT_USE_CONSTEVAL` and injects `#undef FMT_USE_CONSTEVAL` + `#define FMT_USE_CONSTEVAL 0` between them. Idempotent via a second marker comment.
Member
Author
|
Superseding via the library refactor (bare RN + codegen Fabric + Expo plugin wrapper, mirroring |
5 tasks
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.
Summary
Adds a runnable macOS example under
example/macos-app/, scaffolded via@react-native-community/cli init --version 0.81.2thenreact-native-macos-init(which pullsreact-native-macos@^0.81.7).Layout
Fixed split pane per #17 + your revised spec:
<SourceEditor>with live syntax highlighting<WebView>per-language preview:markdown→markedrendered HTML in a system-styled dochtml→ the document itselfjavascript/typescript→ captured console output (TS types stripped before exec)json/plaintext→ monospace dumpToolchain (deliberately different from iOS)
expo prebuild+expo run:ios)react-native run-macos)pod installexpo run:iosmacos:podsapp.plugin.jsat prebuildmacos/Podfile@expo/ui(Liquid Glass, SwiftUI Picker)PressablesRoot scripts
Mirrors the Workspace
desktop:*set:macos:plugin,macos:install,macos:pods,macos:clean,macos:start,macos:clear,macos:run,macos:dev.Notes
--legacy-peer-depsrequired throughout: react-native-macos@0.81.7 wantsreact@^19.1.4but RN 0.81.2 shipsreact@19.1.0. Upstream mismatch.ios/andandroid/scaffolding fromreact-native initremoved — this app is macOS-only.expo-module buildboth pass.SourceEditorView.swifthas never been exercised end-to-end. Expect compile/runtime issues on first build — will fix forward on this branch.build-macosjob will be added separately (it's also gated on getting this app to actually build first).Closes #17