Skip to content

Conversation

@saseungmin
Copy link
Owner

@saseungmin saseungmin commented Aug 5, 2025

Summary by CodeRabbit

  • New Features

    • Added an interactive Expo Snack embed to the documentation, allowing users to try out examples directly within the docs.
  • Documentation

    • Reorganized the quick start guides to display interactive demos in place of static images for both English and Korean documentation.
    • Improved visual presentation by centering demo images and updating example sections.
  • Chores

    • Updated TypeScript configurations to exclude documentation files from compilation.
    • Adjusted pre-commit hooks to skip type checks on documentation files.

@changeset-bot
Copy link

changeset-bot bot commented Aug 5, 2025

⚠️ No Changeset found

Latest commit: 9a13b20

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@coderabbitai
Copy link

coderabbitai bot commented Aug 5, 2025

Walkthrough

A new ExpoSnackEmbed React component was introduced to embed interactive Expo Snack previews in documentation. Documentation files in both English and Korean were updated to replace static demo images with this new component. TypeScript typings and configuration files were adjusted to support the new component, and build and linting configurations were updated to exclude the docs directory where appropriate.

Changes

Cohort / File(s) Change Summary
Expo Snack Embed Component
docs/components/ExpoSnackEmbed.tsx
Introduced a new React functional component to embed Expo Snack previews via iframe, with dynamic script loading and reinitialization logic.
Documentation Updates (English & Korean)
docs/docs/en/guide/getting-started/quick-start.mdx, docs/docs/ko/guide/getting-started/quick-start.mdx
Updated documentation to import and use the new ExpoSnackEmbed component, replacing static demo images with interactive Snack embeds and reorganizing demo presentation.
TypeScript Typings
docs/expo-snack.d.ts
Added TypeScript declaration for the global window.ExpoSnack object and its optional methods.
TypeScript Configurations
docs/tsconfig.json, tsconfig.build.json, tsconfig.json
Updated TypeScript configuration to include new typings and component files, and to exclude the docs directory from the build process.
Pre-commit Hook Configuration
lefthook.yml
Modified pre-commit hook to exclude the docs directory from TypeScript type checks.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant DocsPage
    participant ExpoSnackEmbed
    participant ExpoSnackScript
    participant window.ExpoSnack

    User->>DocsPage: Loads documentation page
    DocsPage->>ExpoSnackEmbed: Renders <ExpoSnackEmbed> with props
    ExpoSnackEmbed->>ExpoSnackScript: Checks if embed.js is loaded
    alt Script not loaded
        ExpoSnackEmbed->>ExpoSnackScript: Dynamically loads embed.js
    end
    ExpoSnackScript-->>ExpoSnackEmbed: Script ready
    ExpoSnackEmbed->>window.ExpoSnack: Calls initialize() (if available)
    window.ExpoSnack-->>ExpoSnackEmbed: Embeds Snack iframe
    ExpoSnackEmbed-->>User: Displays interactive Snack preview
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Suggested labels

documentation, size/M

Poem

A bunny hops through docs anew,
Swapping images for snacks to view!
With code that runs and demos live,
Interactive guides now thrive.
TypeScript’s checked, the hooks are neat—
This change makes learning quite a treat!
🐇✨

Note

⚡️ Unit Test Generation is now available in beta!

Learn more here, or try it out under "Finishing Touches" below.


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 472096f and 9a13b20.

📒 Files selected for processing (2)
  • docs/components/ExpoSnackEmbed.tsx (1 hunks)
  • docs/tsconfig.json (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
  • docs/tsconfig.json
  • docs/components/ExpoSnackEmbed.tsx
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Cloudflare Pages
✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch docs/add-expo-snack-embed

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.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@cloudflare-workers-and-pages
Copy link

cloudflare-workers-and-pages bot commented Aug 5, 2025

Deploying react-native-gesture-image-viewer with  Cloudflare Pages  Cloudflare Pages

Latest commit: 9a13b20
Status: ✅  Deploy successful!
Preview URL: https://5522397c.react-native-gesture-image-viewer.pages.dev
Branch Preview URL: https://docs-add-expo-snack-embed.react-native-gesture-image-viewer.pages.dev

View logs

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 4

🧹 Nitpick comments (6)
lefthook.yml (1)

9-9: Remove trailing space to satisfy YAML lint

yamllint flags the single trailing space after "docs/".
Failing to fix this will break CI hooks that enforce clean formatting.

-      exclude: "docs/" 
+      exclude: "docs/"
docs/docs/en/guide/getting-started/quick-start.mdx (2)

2-2: Relative import is fragile

../../../../components/ExpoSnackEmbed will break if the doc hierarchy moves. Consider using an alias (@components) configured via tsconfig/Rspress to decouple MDX files from folder depth.


6-9: Inline style: use justifyContent only on flex containers

You already set display: 'flex'; good. alignItems works, but it’s redundant to also set width: '100%' when the image itself is constrained. Minor, but trimming unused props keeps markup lean.

docs/expo-snack.d.ts (1)

3-8: Tighten typings for ExpoSnack.embed

The real embed signature accepts an options object or element ID (per Expo docs). Typing it as (element: HTMLElement) => void is safe but loses IntelliSense for options. Consider:

-      embed?: (element: HTMLElement) => void;
+      embed?: (
+        element: HTMLElement | string,
+        options?: { autoplay?: boolean; platform?: 'ios' | 'android' | 'web' }
+      ) => void;

This captures common parameters without being overly strict.

docs/docs/ko/guide/getting-started/quick-start.mdx (1)

5-7: Consider extracting inline styles for better maintainability.

The centering logic is correct, but inline styles in MDX can become hard to maintain.

Consider creating a reusable CSS class or styled component:

-<div style={{ width: '100%', alignItems: 'center', display: 'flex', justifyContent: 'center' }}>
+<div className="demo-image-container">
   <img src="https://raw.githubusercontent.com/saseungmin/react-native-gesture-image-viewer/main/assets/example.gif" width="600" alt="Demo of react-native-gesture-image-viewer gestures" />
 </div>
docs/components/ExpoSnackEmbed.tsx (1)

34-36: Simplify optional chaining usage.

The nested optional chaining is redundant since you've already checked window.ExpoSnack exists.

-          if (window.ExpoSnack?.initialize) {
-            window.ExpoSnack?.initialize?.();
-          }
+          window.ExpoSnack.initialize();
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 67dc056 and d4ba03a.

📒 Files selected for processing (7)
  • docs/components/ExpoSnackEmbed.tsx (1 hunks)
  • docs/docs/en/guide/getting-started/quick-start.mdx (1 hunks)
  • docs/docs/ko/guide/getting-started/quick-start.mdx (1 hunks)
  • docs/expo-snack.d.ts (1 hunks)
  • docs/tsconfig.json (1 hunks)
  • lefthook.yml (1 hunks)
  • tsconfig.build.json (1 hunks)
🧰 Additional context used
🪛 YAMLlint (1.37.1)
lefthook.yml

[error] 9-9: trailing spaces

(trailing-spaces)

🪛 GitHub Check: lint
docs/components/ExpoSnackEmbed.tsx

[failure] 35-35:
Cannot find name 'window'.


[failure] 34-34:
Cannot find name 'window'.


[failure] 28-28:
Property 'querySelector' does not exist on type 'HTMLDivElement'. Try changing the 'lib' compiler option to include 'dom'.


[failure] 27-27:
Cannot find name 'window'.


[failure] 19-19:
Cannot find name 'document'. Do you need to change your target library? Try changing the 'lib' compiler option to include 'dom'.


[failure] 16-16:
Cannot find name 'document'. Do you need to change your target library? Try changing the 'lib' compiler option to include 'dom'.


[failure] 15-15:
Cannot find name 'document'. Do you need to change your target library? Try changing the 'lib' compiler option to include 'dom'.

🪛 GitHub Actions: CI
docs/components/ExpoSnackEmbed.tsx

[error] 15-15: TypeScript error TS2584: Cannot find name 'document'. Consider changing the 'lib' compiler option to include 'dom'.

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Cloudflare Pages
🔇 Additional comments (5)
tsconfig.build.json (1)

3-3: Docs exclusion looks correct

Adding "docs" to the exclude list cleanly separates production builds from documentation code. No concerns here.

docs/docs/ko/guide/getting-started/quick-start.mdx (2)

1-1: LGTM! Import path is correct.

The import statement correctly references the ExpoSnackEmbed component with the proper relative path.


13-13: LGTM! ExpoSnackEmbed usage is appropriate.

The component usage with snackId and height props looks correct and matches the Expo Go link reference above.

docs/components/ExpoSnackEmbed.tsx (2)

3-8: LGTM! Well-defined TypeScript interface.

The Props interface is well-structured with appropriate types and optional properties.


44-60: LGTM! Well-structured JSX with proper data attributes.

The component return is well-implemented with appropriate data attributes for Expo Snack configuration and good styling.

@pull-request-size pull-request-size bot added size/L and removed size/M labels Aug 5, 2025
@saseungmin saseungmin merged commit 81c06b8 into main Aug 5, 2025
6 checks passed
@saseungmin saseungmin deleted the docs/add-expo-snack-embed branch August 5, 2025 03:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants