Closed hemandev closed 6 months ago
@dkzlv Would you mind taking a look at this? Its a blocker for us on using it in React Native. Thanks!
@hemandev Thanks for the PR.
I'm not particularly against this implementation, but can you please confirm if this solution works as well? I feel like it's more specific. TLDR: navigator.product !== 'ReactNative'
. If it works (or any combination of platform
and product
in navigator
), I'd prefer this solution over yours.
Also, I'll merge it, but also I'll make some changes to overall architecture in a separate PR. I feel like this needs a bit more documentation and predictability: we already have 3 environments, and each one may have its own "interface". So, while RN doesn't have blur
/focus
events on document
, they definitely have their own events for the same thing. It feels like if we want to support RN, we need to write code for these events as well, otherwise RN implementation doesn't support the same features as Web version.
UPD: those events are supported, as I suspected, just need to use other object to subscribe.
@hemandev Thanks for the PR.
I'm not particularly against this implementation, but can you please confirm if this solution works as well? I feel like it's more specific. TLDR:
navigator.product !== 'ReactNative'
. If it works (or any combination ofplatform
andproduct
innavigator
), I'd prefer this solution over yours.Also, I'll merge it, but also I'll make some changes to overall architecture in a separate PR. I feel like this needs a bit more documentation and predictability: we already have 3 environments, and each one may have its own "interface". So, while RN doesn't have
blur
/focus
events ondocument
, they definitely have their own events for the same thing. It feels like if we want to support RN, we need to write code for these events as well, otherwise RN implementation doesn't support the same features as Web version.UPD: those events are supported, as I suspected, just need to use other object to subscribe.
Just tried it out and its working. I was also thinking of doing the same thing, but I thought of reducing the surface area for the context. Also navigator.product
is deprecated in web. But yeah, it makes sense for ReactNative
.
Also, I'll merge it, but also I'll make some changes to overall architecture in a separate PR. I feel like this needs a bit more documentation and predictability
That would be great. We are going all in with this library and its been great so far.
I'll release it today, probably, along with some unrelated changes. Thanks!
I'll release it today, probably, along with some unrelated changes. Thanks!
Awesome 🎉 . Thanks as always
query
is failing when it is used insidereact-native
. The reason is because it is trying to executeaddEventListener
, which doesn't exist in React Native. We are already checkingtypeof window === 'undefined
for Server, we just need to add one more extra check to see ifaddEventListener
exist inwindow