feat: added example app to support rn0.83 - #10
Conversation
- Bump plugin version to 2.0.0 - Update Amazon peer deps to rn-83 versions (kepler 4.0.0, device-info/localize/async-storage 2.1.9000000000-rn-83) - Update devDeps toolchain to RN 0.83 / React 19 / react-native-builder-bob 0.43 - Pin @segment/analytics-react-native to 2.20.0-beta.2 (2.21.4 has hard native crashes on Kepler 4 New Architecture) - Add native-module-polyfill.js shim to prevent __fbBatchedBridgeConfig crash on Kepler 4 - Chain metro.config.js resolveRequest to Kepler's own resolver to avoid bundling standard RN instead of Kepler runtime - Add @amzn/react-native-kepler extraNodeModules alias to fix Metro asset resolution - Update manifest.toml to kepler_4 runtime module - Fix UI layout in App.tsx and Link.tsx (reduce oversized margins and font sizes for virtual device) - Fix deprecated moduleResolution: node → bundler in both tsconfig files - Remove deprecated baseUrl from root tsconfig - Update README with Vega SDK 0.24 install steps and metro.config.js setup instructions
….21.4 on Kepler 4
Kepler 4 (Vega SDK 0.24) is New Architecture only — NativeModules throws
__fbBatchedBridgeConfig at module-load time and cannot be caught in user code.
Three Metro resolveRequest intercepts replace the offending modules with
pure-JS shims before they are loaded:
- get-random-values-polyfill.js: replaces react-native-get-random-values
with a Math.random fallback (RNGetRandomValues TurboModule absent on Kepler)
- sovran-polyfill.js: replaces @segment/sovran-react-native entry point with
pure-JS store/bridge/persistor exports, bypassing the NativeModules getter
- context-polyfill.js: replaces analytics-react-native context.ts which calls
getNativeModule('AnalyticsReactNative') — safe because the Kepler plugin
provides its own deviceInfoProvider
Also:
- Remove native-module-polyfill.js (superseded by the above three shims)
- Update example-83/package.json to use published 2.21.4 from npm registry
- Update metro.config.js: chain keplerResolveRequest, add transformIgnorePatterns
for @segment scope, remove stale commented-out block
- Fix deprecated moduleResolution: node → bundler in root tsconfig.json
- Update README with complete setup guide including all three shims,
full metro.config.js, and root cause explanation
| "@amazon-devices/react-native-localize": "2.1.9000000000-rn-83", | ||
| "@react-native-async-storage/async-storage": "npm:@amazon-devices/react-native-async-storage__async-storage@2.1.9000000000-rn-83", | ||
| "@segment/analytics-react-native": "2.21.4", | ||
| "@segment/analytics-react-native-plugin-kepler": "file:../segment-analytics-react-native-plugin-kepler-2.0.0.tgz", |
There was a problem hiding this comment.
Just curious, why are we adding a .tgz to the top level? Seems like it's going to go out of date and is kind of opaque.
There was a problem hiding this comment.
Good point. The file: tarball reference is temporary — it's needed because v2.0.0 hasn't been published to npm yet. Once this PR is merged and v2.0.0 is published, this will be updated to "^2" to match the pattern used in the existing example/ app.
| @@ -0,0 +1,2 @@ | |||
| [tools] | |||
| node = "18" | |||
There was a problem hiding this comment.
Node is pinned to 20 elsewhere, should this be updated?
There was a problem hiding this comment.
Checked the repo — the root .mise.toml and example/.mise.toml both pin Node 18, not 20. example-83/.mise.toml was already consistent at 18. No change needed here. If there's a specific place you're seeing 20, happy to align, but I don't see it in this repo.
There was a problem hiding this comment.
Guess it was @types/node, but if it works it works :)
Add example-83 app for React Native 0.83 / Vega SDK 0.24 support
Summary
Plugin changes (v1.0.0 → v2.0.0)
example-83 app
Mirrors the existing example/ app with the following RN 0.83 toolchain changes:
Notes
The existing example/ app and v1.0.0 of the plugin are untouched — RN 0.72 apps continue to work as before
The -rn-83 version suffixes on Amazon packages are early-access build identifiers; confirm final published versions before a GA release
Requires Vega SDK 0.24 device image (keplerscript_4) on the virtual device; older OS images will reject the install