feat(iOS): new prop injectedJavaScriptBeforeContentLoaded (#1038)

* Run the injectedJavaScript on DocumentStart for iOS

* Add new prop injectedJavaScriptBeforeContentLoaded
Update types
Update docs

* Self review
This commit is contained in:
Salvatore Randazzo
2019-12-06 11:15:02 +01:00
committed by Thibault Malbranche
parent 5ddd6c6fc2
commit 604495e399
6 changed files with 90 additions and 12 deletions
+9 -2
View File
@@ -20,7 +20,7 @@ type AndroidWebViewCommands = 'clearHistory' | 'clearCache' | 'clearFormData';
interface RNCWebViewUIManager<Commands extends string> extends UIManagerStatic {
getViewManagerConfig: (
name: string,
name: string,
) => {
Commands: {[key in Commands]: number};
};
@@ -216,6 +216,7 @@ export interface CommonNativeWebViewProps extends ViewProps {
cacheEnabled?: boolean;
incognito?: boolean;
injectedJavaScript?: string;
injectedJavaScriptBeforeContentLoaded?: string;
mediaPlaybackRequiresUserAction?: boolean;
messagingEnabled: boolean;
onScroll?: (event: NativeScrollEvent) => void;
@@ -501,7 +502,7 @@ export interface AndroidWebViewProps extends WebViewSharedProps {
*/
geolocationEnabled?: boolean;
/**
* Boolean that sets whether JavaScript running in the context of a file
* scheme URL should be allowed to access content from other file scheme URLs.
@@ -685,6 +686,12 @@ export interface WebViewSharedProps extends ViewProps {
*/
injectedJavaScript?: string;
/**
* Set this to provide JavaScript that will be injected into the web page
* once the webview is initialized but before the view loads any content.
*/
injectedJavaScriptBeforeContentLoaded?: string;
/**
* Boolean value that determines whether a horizontal scroll indicator is
* shown in the `WebView`. The default value is `true`.