Leonardo Russo пре 3 година
родитељ
комит
db529e265f
No account linked to committer's email address
1 измењених фајлова са 2 додато и 1 уклоњено
  1. 2
    1
      docs/Guide.md

+ 2
- 1
docs/Guide.md Прегледај датотеку

@@ -305,6 +305,7 @@ export default class App extends Component {
305 305
             uri:
306 306
               'https://github.com/react-native-community/react-native-webview',
307 307
           }}
308
+          onMessage={(event) => {}}
308 309
           injectedJavaScript={runFirst}
309 310
         />
310 311
       </View>
@@ -313,7 +314,7 @@ export default class App extends Component {
313 314
 }
314 315
 ```
315 316
 
316
-This runs the JavaScript in the `runFirst` string once the page is loaded. In this case, you can see that both the body style was changed to red and the alert showed up after 2 seconds.
317
+This runs the JavaScript in the `runFirst` string once the page is loaded. In this case, you can see that both the body style was changed to red and the alert showed up after 2 seconds. An `onMessage` event is required as well to inject the JavaScript code into the WebView.
317 318
 
318 319
 By setting `injectedJavaScriptForMainFrameOnly: false`, the JavaScript injection will occur on all frames (not just the main frame) if supported for the given platform. For example, if a page contains an iframe, the javascript will be injected into that iframe as well with this set to `false`. (Note this is not supported on Android.) There is also `injectedJavaScriptBeforeContentLoadedForMainFrameOnly` for injecting prior to content loading. Read more about this in the [Reference](./Reference.md#injectedjavascriptformainframeonly).
319 320