feat: add allowFileDownloads and suppressJavaScriptDialogs props #76
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Add two new props:
allowFileDownloads- block all downloads that could be triggered by WebView (could be toggled during runtime)suppressJavaScriptDialogs- block all JS dialogs (alert/prompt/confirm) (could be toggled during runtime)I also added code to test these props to example app and fixed some TS errors by creating proper
tsconfig.jsonfor example app.Note
Adds new runtime-configurable props and wires them through native code and types.
suppressJavaScriptDialogs(Android, iOS) to blockalert/confirm/prompt;allowFileDownloads(Android) to disable all downloadsRNCWebView,RNCWebViewManagerImplDownloadListener, andBlobFileDownloader; add JS dialog suppression viaRNCWebChromeClient(onJsAlert/Confirm/Prompt) withshouldSuppressDialogs(); expose props via old/new arch managersRNCWebViewImplby short-circuiting alert/confirm/prompt handlers; export prop inRNCWebViewManager.mmand map inRNCWebView.mmRNCWebViewNativeComponent.tsandWebViewTypes.tsdocs/Reference.md; add toggles and demos inexample/examples/Alerts.tsxandDownloads.tsx; add exampletsconfig.jsonand updatemetro.config.jsWritten by Cursor Bugbot for commit 9e9ec5e. This will update automatically on new commits. Configure here.