-
Notifications
You must be signed in to change notification settings - Fork 1
fix: android newArch & app to webview send message #5
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
WalkthroughThe updates include changes to project configuration and source files. The Changes
Sequence Diagram(s)sequenceDiagram
participant ReactNativeApp
participant YoutubePlayer
participant WebView
participant JSPlayerCommands
ReactNativeApp->>YoutubePlayer: sendCommand(command, args)
YoutubePlayer->>WebView: injectJavaScript (calls window.__execCommand with commandData)
WebView->>JSPlayerCommands: Execute command
alt Success with id
JSPlayerCommands->>WebView: Result
WebView->>YoutubePlayer: postMessage({ type: "commandResult", result, id })
else Command not found or error
JSPlayerCommands->>WebView: Error
WebView->>YoutubePlayer: postMessage({ type: "commandResult", error, id })
end
Possibly related PRs
Poem
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
⏰ Context from checks skipped due to timeout of 90000ms (2)
✨ 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 with
|
| Latest commit: |
f5adb30
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://d7a6703c.react-native-youtube-bridge.pages.dev |
| Branch Preview URL: | https://fix-android-webview.react-native-youtube-bridge.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: 1
🧹 Nitpick comments (3)
example/package.json (1)
20-20: Version divergence forreact-native-webviewThe example app pins
13.13.5while the root devDependency is^13.15.0.
Two versions in the mono-repo can bloat bundle size or mask bugs. Consider aligning both to the same minor.src/YoutubePlayer.tsx (2)
46-47:useMemohere is unnecessary overhead
['none']is a literal; creating it each render is negligible. DroppinguseMemosimplifies the code.-const dataDetectorTypes = useMemo(() => ['none'] as DataDetectorTypes[], []); +const dataDetectorTypes: DataDetectorTypes[] = ['none'];
137-138: Guard verbose logs for production
console.warninside the timeout will surface in release builds.
Wrap withif (__DEV__)to avoid leaking internal diagnostics to end-users.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (2)
bun.lockis excluded by!**/*.lockexample/bun.lockis excluded by!**/*.lock
📒 Files selected for processing (5)
.gitignore(1 hunks)example/package.json(2 hunks)package.json(1 hunks)src/YoutubePlayer.tsx(5 hunks)src/YoutubePlayerWrapper.tsx(1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (1)
- GitHub Check: Cloudflare Pages
🔇 Additional comments (5)
package.json (1)
79-79: Dev-tool bump looks fine
react-native-builder-bobmoves to^0.40.12; no red flags..gitignore (1)
82-85: Good call adding native build dirsIgnoring
example/ios/andexample/android/avoids huge generated blobs in Git. 👍example/package.json (2)
7-8:expo run:*scripts LGTMSwitching to
expo run:android / iosaligns with the new native flow.
24-24: Bob dev-tool bump matches rootConsistent version across workspaces – good.
src/YoutubePlayerWrapper.tsx (1)
12-15: Style flattening improves reliabilityUsing
StyleSheet.flattenavoids nested arrays and guarantees a single object – nice touch.
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: 1
🧹 Nitpick comments (2)
src/hooks/youtubeIframeScripts.ts (1)
210-214: Nit: keep export list alphabetically sorted
receiveMessagewas appended at an arbitrary spot. Sorting this object (or at least grouping the tracking helpers together) improves scan-ability and reduces merge conflicts.src/hooks/useCreateLocalPlayerHtml.ts (1)
75-76: Duplicate command bridges – pick one to avoid confusion
receiveMessageintroduces the newwindow.__execCommandAPI, but the old
window.addEventListener('message', …)bridge (lines 178-198) is still present.
Maintaining two parallel channels:
- Increases bundle size.
- Creates ambiguity about the “official” path.
- Risks diverging behaviour.
If mobile code has migrated to
__execCommand, consider removing the legacy
messagelistener (or guarding it behind a feature flag) to keep the surface
area minimal.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
src/YoutubePlayer.tsx(5 hunks)src/hooks/useCreateLocalPlayerHtml.ts(1 hunks)src/hooks/youtubeIframeScripts.ts(1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
- src/YoutubePlayer.tsx
🧰 Additional context used
🧬 Code Graph Analysis (1)
src/hooks/useCreateLocalPlayerHtml.ts (1)
src/hooks/youtubeIframeScripts.ts (1)
youtubeIframeScripts(210-220)
⏰ Context from checks skipped due to timeout of 90000ms (2)
- GitHub Check: build-web
- GitHub Check: Cloudflare Pages
Summary by CodeRabbit
Bug Fixes
Chores
New Features