-
Notifications
You must be signed in to change notification settings - Fork 24.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[WebView] Add props for overriding native component #10946
Closed
Closed
Changes from 1 commit
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
c61df66
Add props for overriding native component
cbrevik cfdc375
Fix trailing white space
cbrevik fd561f9
Merge branch 'master' into webview-component-override
cbrevik 50e87b0
Merge branch 'master' into webview-component-override
cbrevik 72d385a
Merge branch 'master' into webview-component-override
cbrevik f421a8c
Merge branch 'master' into webview-component-override
cbrevik 978af83
Merge branch 'master' into webview-component-override
cbrevik 6231b5c
Loop through RCTViewManager inheritance tree
cbrevik 402560f
Export extra native component config for WebView
cbrevik 2f8e56e
Fix trailing spaces
cbrevik d7b360e
Set methods/fields as protected instead of private
cbrevik ad98f85
Add docs for custom web views
jacobp100 dcd7fff
Merge pull request #1 from jacobp100/webview-component-override
cbrevik File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -334,6 +334,18 @@ class WebView extends React.Component { | |
* to tap them before they start playing. The default value is `true`. | ||
*/ | ||
mediaPlaybackRequiresUserAction: PropTypes.bool, | ||
|
||
/** | ||
* Override the native component used to render the WebView. Enables a custom native | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. no-trailing-spaces: Trailing spaces not allowed. |
||
* WebView which uses the same JavaScript as the original WebView. | ||
*/ | ||
nativeComponent: PropTypes.any, | ||
|
||
/** | ||
* Set props directly on the native component WebView. Enables custom props which the | ||
* original WebView doesn't pass through. | ||
*/ | ||
nativeComponentProps: PropTypes.object | ||
}; | ||
|
||
state = { | ||
|
@@ -394,8 +406,11 @@ class WebView extends React.Component { | |
|
||
const messagingEnabled = typeof this.props.onMessage === 'function'; | ||
|
||
let NativeWebView = this.props.nativeComponent || RCTWebView; | ||
|
||
var webView = | ||
<RCTWebView | ||
<NativeWebView | ||
{...this.props.nativeComponentProps} | ||
ref={RCT_WEBVIEW_REF} | ||
key="webViewKey" | ||
style={webViewStyles} | ||
|
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no-trailing-spaces: Trailing spaces not allowed.