-
Notifications
You must be signed in to change notification settings - Fork 0
Fix Native-to-Web State Sync & Refactor Expo App with React Native Package #6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
📦 Dev version published for Install via GitHub Packages (ensure .npmrc is configured): pnpm add @open-game-system/app-bridge-types@0.20250410.1-pr6 |
📦 Dev version published for Install via GitHub Packages (ensure .npmrc is configured): pnpm add @open-game-system/app-bridge-native@0.20250410.1-pr6 |
📦 Dev version published for Install via GitHub Packages (ensure .npmrc is configured): pnpm add @open-game-system/app-bridge-web@0.20250410.1-pr6 |
📦 Dev version published for Install via GitHub Packages (ensure .npmrc is configured): pnpm add @open-game-system/app-bridge-testing@0.20250410.1-pr6 |
📦 Dev version published for Install via GitHub Packages (ensure .npmrc is configured): pnpm add @open-game-system/app-bridge-react@0.20250410.1-pr6 |
📦 Dev version published for Install via GitHub Packages (ensure .npmrc is configured): pnpm add @open-game-system/app-bridge-react-native@0.20250410.0-pr6 |
This PR addresses several issues identified during testing and debugging, primarily focusing on fixing the state synchronization from the native environment to the WebView. A major part of this effort involved refactoring the
expo-app
example to correctly utilize and showcase the dedicated@open-game-system/app-bridge-react-native
package.Key Changes:
Fixed Native-to-Web State Synchronization:
packages/app-bridge-native
where state updates were not correctly generating patches for the WebView.store.subscribe
callback was comparing the new state with itself. This was fixed by capturing theprevState
before the update occurs within thesetStore
scope, allowingfast-json-patch/compare
to generate the correct operations.Leveraged
@open-game-system/app-bridge-react-native
inexamples/expo-app
:App.tsx
) was significantly refactored to adopt the@open-game-system/app-bridge-react-native
package, demonstrating its intended usage.BridgedWebView
componentcreateNativeBridgeContext
for context managementuseSelector
,useStore
) for simplified state access and dispatching.NativeBridge
re-exported from the react-native package).Improved Testing in
examples/expo-app
:App-test.tsx
) for the refactoredApp
component.@open-game-system/app-bridge-react-native
functions and components used.jest.config.js
), Babel (babel.config.js
), and TypeScript (tsconfig.json
) configurations to properly handle testing, transformations (including necessarynode_modules
), and JSX for React Native.package.json
.examples/expo-app
are now passing.Updated Type Definitions:
NativeBridge
interface inpackages/app-bridge-types
to align with the methods provided by the native implementation and re-exported by the react-native package.Outcome:
expo-app
example now effectively demonstrates the use of the dedicatedapp-bridge-react-native
package, providing a clearer integration pattern.expo-app
example is functional and passing, validating the refactored approach.