-
Notifications
You must be signed in to change notification settings - Fork 0
fix(styling): replace CSS file with inline iframe styling #11
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
- Remove CSS file dependency causing webpack parse errors - Apply width/height styles directly via JavaScript after iframe loads - Improves package compatibility without requiring CSS loaders
🦋 Changeset detectedLatest commit: 01c2624 The changes in this PR will be included in the next version bump. 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 |
|
Caution Review failedThe pull request is closed. WalkthroughThis update removes external CSS styling for Vimeo iframes and instead applies width and height directly via JavaScript after the iframe loads. Imports are reorganized, and the Vimeo player options interface is updated by commenting out several dimension-related properties. A callback is also memoized in the example app for stability. Changes
Sequence Diagram(s)sequenceDiagram
participant App
participant VimeoPlayer
participant DOM
App->>VimeoPlayer: Mounts VimeoPlayer
VimeoPlayer->>DOM: Renders iframe
VimeoPlayer->>VimeoPlayer: On 'loaded' event
VimeoPlayer->>DOM: Query iframe element
VimeoPlayer->>DOM: Set iframe width/height to 100%
Poem
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (1)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 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-vimeo-bridge-example with
|
| Latest commit: |
75050c3
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://fbc7fca3.react-native-vimeo-bridge-example.pages.dev |
| Branch Preview URL: | https://fix-remove-css-dependency.react-native-vimeo-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: 1
🧹 Nitpick comments (1)
src/VimeoPlayer.tsx (1)
149-157: Consider adding error handling for iframe styling.The enhanced loaded event handler correctly applies inline styling to replace CSS dependencies. However, consider adding error handling for edge cases:
player.on('loaded', (data) => { sendMessage('loaded')(data); - const iframe = document.querySelector('iframe'); - if (iframe) { - iframe.style.width = '100%'; - iframe.style.height = '100%'; - } + try { + const iframe = document.querySelector('iframe'); + if (iframe) { + iframe.style.width = '100%'; + iframe.style.height = '100%'; + } + } catch (error) { + console.warn('Failed to set iframe styles:', error); + } });
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (7)
.changeset/poor-baths-shave.md(1 hunks)example/src/App.tsx(2 hunks)src/VimeoPlayer.tsx(1 hunks)src/VimeoPlayer.web.tsx(1 hunks)src/module/WebVimeoPlayerController.ts(1 hunks)src/styles.css(0 hunks)src/types/vimeo.ts(1 hunks)
💤 Files with no reviewable changes (1)
- src/styles.css
⏰ Context from checks skipped due to timeout of 90000ms (1)
- GitHub Check: Cloudflare Pages
🔇 Additional comments (4)
.changeset/poor-baths-shave.md (1)
1-10: LGTM! Clear and accurate changeset documentation.The changeset properly documents the patch-level change and clearly explains the technical solution for removing CSS dependencies.
src/VimeoPlayer.web.tsx (1)
4-4: Good import organization.Moving the symbol import to group with other imports improves code readability and organization.
src/module/WebVimeoPlayerController.ts (1)
80-89: Excellent implementation of inline iframe styling.This approach is well-designed:
- Uses container-scoped querySelector which is more specific than document-level queries
- Consistent with the overall strategy of replacing CSS with JavaScript styling
- Applied at the right time (after player creation and on loaded event)
The implementation correctly replaces the CSS dependency while maintaining the same visual behavior.
example/src/App.tsx (1)
69-96: LGTM! Good performance optimization with proper dependency management.The conversion of
getPlayerInfoto a memoized callback usinguseCallbackis a solid React performance optimization. The dependency array correctly includes onlyplayer, which is the sole external dependency used within the function. This prevents unnecessary function recreations on every render while preserving the original functionality and error handling.
Summary by CodeRabbit
Bug Fixes
Refactor
Style
Chores