Closed codecomeon closed 7 months ago
Or app should show loading before bridge ready, and hide loading when bridge ready.
Thank you!
Something similar exists here, but it's not reactive. It sounds like what you want is to observe the ready state either event-driven or state-driven so that it can work reactively.
I'll try to prepare that suggestion as well.
Releaesd in v1.2.0.
const nativeMethod = linkNativeMethod<AppBridge>({
onReady: async (method) => {
console.log("nativeMethod is ready");
const version = await method.getBridgeVersion();
console.log("currentBridgerVersion", version);
},
});
However, integration with the state of each framework is not yet ready. Since it will be further integrated into the shared state, the issue will not be closed.
Shared state was released in v1.3.1. So you can use states like isReady to hide or show the UI. 🥰
https://gronxb.github.io/webview-bridge/shared-state/react-native.html
A common scene is that:
When web page ready, app inject some data into web. Otherwise, app should prepare some async environment when web already done. For example lazy load modules in app, loading process will cost times.
Suggestion API Design: