You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fix non-compiling Java snippet in Android Fabric guide
The ReactWebView.java snippet fails to compile as written: LayoutParams
resolves to AbsoluteLayout.LayoutParams which has no (int, int)
constructor, there is no context variable in scope, and EventDispatcher
is never imported.
Also enable JavaScript, which the Android WebView disables by default
while the WKWebView used on iOS enables it, so that the component
behaves the same on both platforms.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@@ -187,6 +191,8 @@ The `ReactWebView` extends the Android `WebView` so you can reuse all the proper
187
191
188
192
The class defines the three Android constructors but defers their actual implementation to the private `configureComponent` function. This function takes care of initializing all the components specific properties: in this case you are setting the layout of the `WebView` and you are defining the `WebClient` that you use to customize the behavior of the `WebView`. In this code, the `ReactWebView` emits an event when the page finishes loading, by implementing the `WebClient`'s `onPageFinished` method.
189
193
194
+
`configureComponent` also enables JavaScript. The Android `WebView`[disables it by default](<https://developer.android.com/reference/android/webkit/WebSettings#setJavaScriptEnabled(boolean)>), while the `WKWebView` used on iOS enables it. Without this line, the same component would run web content differently on the two platforms. Only enable JavaScript for content you trust.
195
+
190
196
The code then defines a helper function to actually emit an event. To emit an event, you have to:
0 commit comments