Skip to content

Use a global list of clipboard listeners #76

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

Merged
merged 1 commit into from
Mar 16, 2020
Merged

Conversation

LinusU
Copy link
Member

@LinusU LinusU commented Mar 11, 2020

Summary

Before this change, if two components on the same page used the clipboard hook, one of them wouldn't properly re-render if the other one updated the clipboard content.

Test Plan

I'm working on a small example app that shows two components that uses the clipboard at the same time, and demonstrates that it now works.

Here is a snack that demonstrates the working behaviour:
https://snack.expo.io/@linusu/hooks-pr-76

What's required for testing (prerequisites)?

What are the steps to reproduce (after prerequisites)?

Compatibility

OS Implemented
iOS
Android
Web

Checklist

  • I have tested this on a device and a simulator
  • [n/a] I added the documentation in README.md
  • [n/a] I mentioned this change in CHANGELOG.md
  • [n/a] I updated the typed files (TS and Flow)
  • [n/a] I added a sample use of the API in the example project (example/App.js)
📦 Published PR as canary version: 2.4.4-canary.76.172.0

✨ Test out this PR locally via:

npm install @react-native-community/[email protected]
# or 
yarn add @react-native-community/[email protected]

@LinusU
Copy link
Member Author

LinusU commented Mar 11, 2020

@pvinis hmm, is the checklist up to date? I went to add my changes to the changelog but it seems like it's generated automatically?

@pvinis
Copy link
Member

pvinis commented Mar 11, 2020

Indeed. we need to revisit that.

@LinusU
Copy link
Member Author

LinusU commented Mar 11, 2020

Ahh, it comes from here:

https://github.com/react-native-community/.github/blob/master/.github/PULL_REQUEST_TEMPLATE.md

Hmm, maybe we can just override it by adding our own version 🤔

@LinusU
Copy link
Member Author

LinusU commented Mar 11, 2020

I've added a snack to test this out here:
https://snack.expo.io/@linusu/hooks-pr-76

🎉

@pvinis
Copy link
Member

pvinis commented Mar 11, 2020

for sure. today and tomorrow I'm not easily next to my laptop, I could check later, or if you do something we check it.

@LinusU
Copy link
Member Author

LinusU commented Mar 11, 2020

Did it here: #77

This PR should be ready for review now, I've tested it on my iPhone and on the Web. Should be super easy for anyone to test out the snack ☺️

@pvinis
Copy link
Member

pvinis commented Mar 11, 2020

having the snack is awesome! maybe we can add this in the template as a suggestion? 🤔

@pvinis
Copy link
Member

pvinis commented Mar 11, 2020

I also plan to add some tests so people can copy paste and use them too.

@LinusU
Copy link
Member Author

LinusU commented Mar 11, 2020

having the snack is awesome! maybe we can add this in the template as a suggestion?

Hehe, already did it in #77 😉

I also plan to add some tests so people can copy paste and use them too.

Maybe we could have an official snack which uses all the hooks. Then people can just fork that one and add whatever is specific to their PR? 🤔

Since each PR gets deployed with a canary version it's super easy to use them in the snacks 🙌

@pvinis
Copy link
Member

pvinis commented Mar 11, 2020

yuuuuuuuuuusssssss!!! awesome idea.

@LinusU LinusU added the patch Increment the patch version when merged label Mar 11, 2020
@LinusU
Copy link
Member Author

LinusU commented Mar 16, 2020

ping @pvinis, can we merge this? ☺️

@pvinis
Copy link
Member

pvinis commented Mar 16, 2020

uup, forgot that. No one reviewed, lemme give it a look.

@pvinis
Copy link
Member

pvinis commented Mar 16, 2020

For reference, here is the broken version https://snack.expo.io/ByOfrk6r8

Copy link
Member

@pvinis pvinis left a comment

Choose a reason for hiding this comment

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

@pvinis pvinis added the release Create a release when this pr is merged label Mar 16, 2020
@pvinis pvinis merged commit 068481f into master Mar 16, 2020
@pvinis pvinis deleted the global-clipboard-listener branch March 16, 2020 11:41
@pvinis
Copy link
Member

pvinis commented Mar 16, 2020

🚀 PR was released in v2.4.5 🚀

@pvinis pvinis added the released This issue/pull request has been released. label Mar 16, 2020
@github-actions github-actions bot mentioned this pull request Feb 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
patch Increment the patch version when merged release Create a release when this pr is merged released This issue/pull request has been released.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants