TypeError: Cannot use 'in' operator to search for 'method' in 9
See original GitHub issueI had this code working in version 5.0.1:
<WebView
source={require('page.html')}
/>
and in 5.7.0, it crashes on Android (still works on iOS):
I’m assuming that it happens because of this line, introduced by the js to ts rewrite (this commit).
It seems the author of this rewrite forgot to handle using require
in the source
prop.
I’m currently bypassing the problem this way:
<WebView
source={{uri: Image.resolveAssetSource(require('page.html')).uri}}
/>
This should be fixed though and a test should be added to ensure it doesn’t happen again.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:1
- Comments:11
Top Results From Across the Web
TypeError: cannot use 'in' operator to search for 'x' in 'y'
The JavaScript exception "right-hand side of 'in' should be an object" occurs when the in operator was used to search in strings, ...
Read more >Uncaught TypeError: Cannot use 'in' operator to search for ...
The in operator only works on objects. You are using it on a string. Make sure your value is an object before you...
Read more >JavaScript TypeError - Cannot use 'in' operator to search for 'X ...
This JavaScript exception Cannot use 'in' operator to search for 'X' in 'Y' occurs if in operator is used to search in strings,...
Read more >TypeError: cannot use 'in' operator to search for 'x' in 'y'
The in operator can only be used to check if a property is in an object. You can't search in strings, or in...
Read more >Uncaught TypeError Cannot use in operator to search for 324 in
This is my code that sends a Get request to php file by ajax. When I use $.each method, it get the error...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@Titozzz Because the documentation cannot change?
Do you really expect people to read the entire documentation and notice the api changes at every update? No, that’s why you should not drop features silently, that’s why properly managed projects have a changelog file, but there is none in this repository.
@vmarquet Docs never specified you syntax should have worked which is why you encountered that issue. See (docs)[https://github.com/react-native-community/react-native-webview/blob/master/docs/Reference.md#source].
Regarding
If you think changes need to be done in a repository, please submit a pull request, since you already spent time to track the bug, it’s even more enjoyable.