-
Notifications
You must be signed in to change notification settings - Fork 1
fix: override webview source props (header, method, body) #36
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
Conversation
🦋 Changeset detectedLatest commit: 217f431 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
WalkthroughThis update enhances the handling of the Changes
Sequence Diagram(s)sequenceDiagram
participant App
participant YoutubePlayer
participant WebView
App->>YoutubePlayer: Passes webViewProps (may include source)
YoutubePlayer->>WebView: Merges webViewProps.source (excluding uri) with { uri: webViewUrl }
WebView-->>YoutubePlayer: Renders with combined source props
Possibly related PRs
Poem
✨ Finishing Touches
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
Deploying react-native-youtube-bridge-example with
|
| Latest commit: |
217f431
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://396cd3ab.react-native-youtube-bridge-example.pages.dev |
| Branch Preview URL: | https://fix-override-webview-source.react-native-youtube-bridge-example.pages.dev |
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.
Actionable comments posted: 0
🧹 Nitpick comments (1)
example/src/App.tsx (1)
185-187: Consider demonstrating the actual fix in the example.While adding
renderToHardwareTextureAndroidis valid, it doesn't showcase the source override functionality this PR fixes. Consider adding an example that demonstrates the HTTP method, body, or headers override:webViewProps={{ renderToHardwareTextureAndroid: true, + source: { + method: 'POST', + headers: { + 'Custom-Header': 'value' + } + } }}
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (4)
.changeset/clear-pigs-stop.md(1 hunks)example/src/App.tsx(1 hunks)src/YoutubePlayer.tsx(1 hunks)src/types/youtube.ts(2 hunks)
🔇 Additional comments (4)
.changeset/clear-pigs-stop.md (1)
1-6: LGTM! Clear and accurate changeset documentation.The changeset properly documents the patch fix for webview source property overrides.
src/YoutubePlayer.tsx (1)
271-275: Excellent implementation of source property merging.The spread operator order
{ ...(webViewProps?.source ?? {}), uri: webViewUrl }correctly:
- Allows additional source properties (method, headers, body) from webViewProps
- Prevents uri override by placing it after the spread
- Safely handles undefined webViewProps.source with optional chaining and fallback
This properly implements the fix for webview source property overrides.
src/types/youtube.ts (2)
4-4: Good addition of WebViewSourceUri import.This import enables proper typing for the enhanced webViewProps.source functionality.
88-90: Excellent type design for source property override.The type definition correctly:
- Omits 'uri' from WebViewSourceUri to prevent conflicts
- Makes source optional for backward compatibility
- Enables type-safe passing of HTTP method, headers, and body properties
This provides the necessary type safety for the webview source override feature.
Summary by CodeRabbit
New Features
Bug Fixes