Skip to content

Conversation

@DongGukMon
Copy link
Contributor

@DongGukMon DongGukMon commented May 17, 2025

Description

This library has no hard dependency on Browser. However, runtime detection relied solely on typeof document === 'undefined'. Because document is also undefined in React Native, the guard was triggered and the code bailed out, preventing overlay-kit from working on RN.

Changes

This patch adds an explicit React Native check (typeof navigator !== 'undefined' && navigator.product === 'ReactNative'') to useClientLayoutEffect in create-use-external-events.ts.
With the new guard, the library now operates correctly in React Native

navigator.product is officially deprecated(link), but I haven’t found a more reliable way to detect React Native yet, so this PR keeps that check for now.
If there’s a better approach, I’d appreciate your feedback and am happy to revise accordingly.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update

Checklist

  • I have performed a self-review of my own code.
  • My code is commented, particularly in hard-to-understand areas.
  • I have made corresponding changes to the documentation.
  • My changes generate no new warnings.
  • I have added tests that prove my fix is effective or that my feature works.
  • New and existing unit tests pass locally with my changes.
  • Any dependent changes have been merged and published in downstream modules.

Further Comments

@DongGukMon DongGukMon requested a review from jungpaeng as a code owner May 17, 2025 09:01
@changeset-bot
Copy link

changeset-bot bot commented May 17, 2025

🦋 Changeset detected

Latest commit: c0a0d49

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
overlay-kit Patch

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

@vercel
Copy link

vercel bot commented May 17, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
overlay-kit ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 11, 2025 2:53am

Copy link
Member

@jungpaeng jungpaeng left a comment

Choose a reason for hiding this comment

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

Thank you for your contribution.
Currently, I’m not working in a React Native environment, so I will set it up and run tests later.

By the way, are you using overlay-kit in a React Native environment?
I’m curious to know if it works properly in React Native.

@DongGukMon
Copy link
Contributor Author

I confirmed the library has only a React dependency, so I integrated it into an Expo side-project I’m currently building. With the changes in this PR applied, everything works perfectly.

For now I’m running on a locally patched version, but I’m hoping this can be merged soon. It would be even better if React Native support could be declared officially in the future. Thanks!

@jungpaeng jungpaeng merged commit 4f70bdb into toss:main Jun 11, 2025
1 check passed
@github-actions github-actions bot mentioned this pull request Jun 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants