Native Integration
After codegen, implement the generated delegate interface in your host app and register it before JavaScript uses the module.
Pre-Requisite:
Ensure that the BrownfieldNavigation.xcframework is linked to the native host app. If you ran npx brownfield package:ios the generated frameworks should be under ios/.brownfield folder.
Android
1) Implement BrownfieldNavigationDelegate
Implement the generated delegate methods in your host Activity (or another class with access to navigation context):
2) Register the delegate during startup
Register before any React Native screen can call BrownfieldNavigation.*:
iOS
1) Implement BrownfieldNavigationDelegate
2) Register the delegate at app startup
Lifecycle Requirements
- Register delegate before rendering JS that might call the module.
- Keep navigation on main/UI thread.
- Re-register delegate if your host object is recreated.
- Treat missing delegate as a startup bug: runtime calls require a registered delegate.
Troubleshooting
- Method added in TS but not visible natively: rerun codegen and rebuild.
- Calls crash on app launch: verify delegate registration happens before RN route rendering.
- Wrong screen opens: check native delegate method wiring and params mapping.
