Skip to content

Use a global list of clipboard listeners#76

Merged
pvinis merged 1 commit into
masterfrom
global-clipboard-listener
Mar 16, 2020
Merged

Use a global list of clipboard listeners#76
pvinis merged 1 commit into
masterfrom
global-clipboard-listener

Conversation

@LinusU

@LinusU LinusU commented Mar 11, 2020

Copy link
Copy Markdown
Member

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/hooks@2.4.4-canary.76.172.0
# or 
yarn add @react-native-community/hooks@2.4.4-canary.76.172.0

@LinusU

LinusU commented Mar 11, 2020

Copy link
Copy Markdown
Member Author

@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

pvinis commented Mar 11, 2020

Copy link
Copy Markdown
Member

Indeed. we need to revisit that.

@LinusU

LinusU commented Mar 11, 2020

Copy link
Copy Markdown
Member Author

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

LinusU commented Mar 11, 2020

Copy link
Copy Markdown
Member Author

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

🎉

@pvinis

pvinis commented Mar 11, 2020

Copy link
Copy Markdown
Member

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

LinusU commented Mar 11, 2020

Copy link
Copy Markdown
Member Author

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

pvinis commented Mar 11, 2020

Copy link
Copy Markdown
Member

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

@pvinis

pvinis commented Mar 11, 2020

Copy link
Copy Markdown
Member

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

@LinusU

LinusU commented Mar 11, 2020

Copy link
Copy Markdown
Member Author

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

pvinis commented Mar 11, 2020

Copy link
Copy Markdown
Member

yuuuuuuuuuusssssss!!! awesome idea.

@LinusU LinusU added the patch Increment the patch version when merged label Mar 11, 2020
@LinusU

LinusU commented Mar 16, 2020

Copy link
Copy Markdown
Member Author

ping @pvinis, can we merge this? ☺️

@pvinis

pvinis commented Mar 16, 2020

Copy link
Copy Markdown
Member

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

@pvinis

pvinis commented Mar 16, 2020

Copy link
Copy Markdown
Member

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

@pvinis pvinis left a comment

Copy link
Copy Markdown
Member

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

pvinis commented Mar 16, 2020

Copy link
Copy Markdown
Member

🚀 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