Skip to content

Add upper case keys to the debug key handler#45559

Closed
wh201906 wants to merge 2 commits into
facebook:mainfrom
wh201906:wh201906/metro_shortcut
Closed

Add upper case keys to the debug key handler#45559
wh201906 wants to merge 2 commits into
facebook:mainfrom
wh201906:wh201906/metro_shortcut

Conversation

@wh201906
Copy link
Copy Markdown
Contributor

@wh201906 wh201906 commented Jul 20, 2024

Summary:

The CLI of Metro bundler only accepts key presses when the Caps Lock is off. This is somehow inconvenient because the developers might think the Metro bundler doesn't response when the Caps Lock is on.

Changelog:

[GENERAL] [ADDED] - Add upper case keys to the debug key handler

Test Plan:

n/a

@facebook-github-bot
Copy link
Copy Markdown
Contributor

Hi @wh201906!

Thank you for your pull request and welcome to our community.

Action Required

In order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you.

Process

In order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA.

Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with CLA signed. The tagging process may take up to 1 hour after signing. Please give it that time before contacting us about it.

If you have received this in error or have any questions, please contact us at cla@meta.com. Thanks!

@react-native-bot
Copy link
Copy Markdown
Collaborator

Warnings
⚠️ 📋 Missing Test Plan - Can you add a Test Plan? To do so, add a "## Test Plan" section to your PR description. A Test Plan lets us know how these changes were tested.

Generated by 🚫 dangerJS against 44281b3

@facebook-github-bot
Copy link
Copy Markdown
Contributor

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks!

@facebook-github-bot facebook-github-bot added CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team. labels Jul 20, 2024
@facebook-github-bot
Copy link
Copy Markdown
Contributor

@dmytrorykun has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

Copy link
Copy Markdown
Member

@huntie huntie left a comment

Choose a reason for hiding this comment

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

Hey @wh201906, thanks for opening this! I've suggested a change — think we're happy accepting this if the implementation is simplified.

Generally, we want to be precise about key bindings in CLI apps (with precedents like Vim being case sensitive), as it would allow us more space (although unlikely) to bind future commands. I think it's reasonable to expect developers to be aware of Caps Lock state (at least enough to debug in the moment before opening a GitHub issue 😅). However, I'm happy to break this precedent for the sake of convenience — so long as the codebase doesn't incur extra complexity.

Note that this will deviate us from Expo CLI and existing key handling within the iOS/Android simulators.

@@ -46,14 +46,17 @@ export default function attachKeyHandlers({
const onPress = async (key: string) => {
switch (key) {
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.

Can we do this instead?

Suggested change
switch (key) {
switch (key.toLowerCase()) {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Thanks! I have change the code based on your suggestions.

Note that this will deviate us from Expo CLI

Would you suggest me to make a new PR for the same change in the Expo CLI repo?

@facebook-github-bot
Copy link
Copy Markdown
Contributor

@dmytrorykun has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

@facebook-github-bot facebook-github-bot added the Merged This PR has been merged. label Jul 23, 2024
@facebook-github-bot
Copy link
Copy Markdown
Contributor

@dmytrorykun merged this pull request in 6390cf6.

@react-native-bot
Copy link
Copy Markdown
Collaborator

This pull request was successfully merged by @wh201906 in 6390cf6

When will my fix make it into a release? | How to file a pick request?

@wh201906 wh201906 deleted the wh201906/metro_shortcut branch July 23, 2024 12:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. Merged This PR has been merged. Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants