We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
let _refWebview = React.useRef() let invoke = createInvoke(() => _refWebview.current) React.useEffect(() => { // 暴露方法给 H5 invoke.define('route', setRoute) return () => {} }, []) return ( <WebView useWebKit ref={_refWebview} style={{ flex: 1 }} source={{ uri: config.h5 + route.params.uri, headers: { 'Cache-Control': 'no-cache' } }} automaticallyAdjustContentInsets={true} decelerationRate="normal" scrollEnabled={true} javaScriptEnabled={true} domStorageEnabled={true} onMessage={invoke.listener} nativeConfig={{ props: { flex: 1 } }} onLoad={syntheticEvent => { const { nativeEvent } = syntheticEvent console.log(`nativeEvent.url: ${nativeEvent.url}`) }} onLoadProgress={({ nativeEvent }) => { console.log(`nativeEvent.progress: ${nativeEvent.progress}`) }} onLoadStart={syntheticEvent => { // update component to be aware of loading status const { nativeEvent } = syntheticEvent console.log(`onLoadStart nativeEvent.loading: ${nativeEvent.loading}`) }} onLoadEnd={syntheticEvent => { // update component to be aware of loading status const { nativeEvent } = syntheticEvent console.log(`onLoadEnd nativeEvent.loading: ${nativeEvent.loading}`) }} onError={syntheticEvent => { const { nativeEvent } = syntheticEvent console.warn('WebView error: ', nativeEvent) }} onHttpError={syntheticEvent => { const { nativeEvent } = syntheticEvent console.warn( 'onHttpError WebView received error status code: ', nativeEvent.statusCode ) }} originWhitelist={['*']} allowFileAccessFromFileURLs={true} allowFileAccess={true} allowUniversalAccessFromFileURLs={true} allowingReadAccessToURL={'file://'} /> )
H5 那边 会报 invoke.fn.route is not function
The text was updated successfully, but these errors were encountered:
你的这个问题解决了吗?
Sorry, something went wrong.
invoke.define
暂时没有找到解决办法,目前还是用 class 写,在这里不用 hooks
No branches or pull requests
H5 那边 会报 invoke.fn.route is not function
The text was updated successfully, but these errors were encountered: