Skip to content
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

[LogBox] Add NSWindow based version #645

Merged
merged 9 commits into from
Nov 4, 2020
Merged

[LogBox] Add NSWindow based version #645

merged 9 commits into from
Nov 4, 2020

Conversation

alloy
Copy link
Member

@alloy alloy commented Nov 3, 2020

Related to #621

Please select one of the following

  • I am removing an existing difference between facebook/react-native and microsoft/react-native-macos 👍
  • I am cherry-picking a change from Facebook's react-native into microsoft/react-native-macos 👍
  • I am making a fix / change for the macOS implementation of react-native
  • I am making a change required for Microsoft usage of react-native

Summary

LogBox is the preferred way to view warnings/errors in v0.63.0.

Changelog

[macOS] [Added] - NSWindow based version of LogBox

TODO

Still minor things to do, but the meat of the patch can be reviewed.

  • Navigation buttons in header don't work yet
  • Source-maps seem wrong, but that may just be a RNTester thing that doesn’t need to block this PR

Test Plan

Screenshot 2020-11-03 at 14 53 31

Microsoft Reviewers: Open in CodeFlow

CGPoint touchLocation = [self.view convertPoint:touch.locationInWindow fromView:nil];
// -[NSView hitTest:] takes coordinates in a view's superview coordinate system.
// The assumption here is that a RCTUIView/RCTSurfaceView will always have a superview.
CGPoint touchLocation = [self.view.superview convertPoint:touch.locationInWindow fromView:nil];
Copy link
Member Author

Choose a reason for hiding this comment

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

I suspect this issue never arose before because previously the only superview (RCTRootView) would have the same coordinate system.

@alloy
Copy link
Member Author

alloy commented Nov 3, 2020

The navigation buttons in the header not responding appears to be due to Image swallowing the event

<Image source={props.image} style={headerStyles.buttonImage} />

Or perhaps that the touchable view that wraps it is too small.

Copy link
Collaborator

@tom-un tom-un left a comment

Choose a reason for hiding this comment

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

Looks good. Just a couple questions/comments inline

React/CoreModules/RCTLogBox.mm Outdated Show resolved Hide resolved
React/CoreModules/RCTLogBox.mm Outdated Show resolved Hide resolved
React/CoreModules/RCTLogBox.mm Show resolved Hide resolved
@alloy
Copy link
Member Author

alloy commented Nov 4, 2020

The issue with the navigation buttons was an actual issue with coordinate translation, which is fixed now 👍

@alloy
Copy link
Member Author

alloy commented Nov 4, 2020

Unsure why I was seeing a source-map issue before, seems to work fine:

Screenshot 2020-11-04 at 14 45 29

@alloy alloy marked this pull request as ready for review November 4, 2020 13:46
@alloy
Copy link
Member Author

alloy commented Nov 4, 2020

@tom-un This should be good to go.

@alloy alloy merged commit 5992bca into master Nov 4, 2020
@alloy alloy deleted the add-macos-log-box branch November 4, 2020 16:14
@alloy alloy mentioned this pull request Nov 4, 2020
25 tasks
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