-
Notifications
You must be signed in to change notification settings - Fork 428
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
WebView's injectJavaScript() method causes immediate crash #195
Comments
Potential root of problemI see there's a module bundled into /**
* Copies the ViewManager constants and commands into UIManager. This is
* only needed for iOS, which puts the constants in the ViewManager
* namespace instead of UIManager, unlike Android.
*/
if (Platform.OS === 'ios') {
// ...
defineLazyObjectProperty(viewConfig, 'Commands', {
// ...
}
} else if (Platform.OS === 'android' && UIManager.AndroidLazyViewManagersEnabled) {
// ...
} Just a guess, but perhaps the Extending
|
Thanks for reporting this. Hopefully, this will be fixed in latest version, which is in alpha now. I'll keep you posted. |
@ptmt Thank you! Do you have any estimate of when the latest version's release might be? I found that JS injection is now mysteriously working on my end. As far as I am aware, the only thing I changed, beyond the Whether it would work now even without the amendment for macos, I don't know; I shall have to investigate next time I'm touching that part of the code. @ptmt On a similar note: Not sure how much you've experimented with the Edit: looks like |
I have ported the react-native-wkwebview project to macOS, including the pull request that adds |
That is amazing news! Thanks a lot. I think it's the right choice, having this as 3rd party mode. It also might be updated later to other react-native implementations, if any.
Not yet, unfortunately. It works in my case, but a few parts such text inputs are broken. |
A note to myself (and anyone else heading down my rather individual path here) in future: console.log(`Keys of WKWebView`, Object.keys(this.webView)); There was no need for me to alter Note that there is still a prop named |
Description
Using the very same code from the master-branch UIExplorer's
WebView
examples, I found thatWebView.prototype.injectJavaScript()
causes an immediate crash, with the error:WebView.macos.js
So although
WebView.prototype.injectJavaScript()
is present,UIManager.RCTWebView.Commands.injectJavaScript()
is not.Here's
react-native-macos/Libraries/Components/WebView/WebView.macos.js
.Unfortunately, I can't figure out where it's requiring
UIManager
from; the closest I can get isreact-native-macos/lib/UIManager.js
.Reproduction Steps and Sample Code
The
UIExplorer
repository can be used to reproduce this, or the following minimal example can be copied:Additional Information
react-native-macos v0.16.1
Comments
I notice that the "Inject JavaScript" demo is not displayed in UIExplorer (nor the "Messaging Test"); are these examples not yet fully implemented, and therefore is this behaviour to be expected?
The text was updated successfully, but these errors were encountered: