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

Keyboard #3541

Merged
merged 6 commits into from
Oct 29, 2019
Merged

Keyboard #3541

merged 6 commits into from
Oct 29, 2019

Conversation

ddalp
Copy link
Contributor

@ddalp ddalp commented Oct 28, 2019

#2852

  • Add support to listen and fire "keyboardDidShow" and "keyboardDidHide" events when SIP is shown or hidden. Basically hooking up CoreInputView's OcclusionsChanged event.
  • Manually tested these two RN events firing and verified with keyboardAvoidingView RN object working fine.
Microsoft Reviewers: Open in CodeFlow

@ddalp ddalp requested a review from a team as a code owner October 28, 2019 17:48
@ghost ghost added the vnext label Oct 28, 2019
#include <winrt/Windows.UI.Input.h>
#include <winrt/Windows.UI.Xaml.Controls.h>
#include <winrt/Windows.UI.Xaml.Input.h>
#include <winrt/Windows.UI.Xaml.Media.h>
Copy link
Contributor Author

@ddalp ddalp Oct 28, 2019

Choose a reason for hiding this comment

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

Remove. #Resolved

REACTWINDOWS_API_(bool) IsEmptyRect(winrt::Windows::Foundation::Rect rect);
REACTWINDOWS_API_(winrt::Windows::Foundation::Rect) CreateEmptyRect();
REACTWINDOWS_API_(winrt::Windows::Foundation::Rect)
UnionRect(winrt::Windows::Foundation::Rect rect1, _In_ winrt::Windows::Foundation::Rect rect2);
Copy link
Member

@asklar asklar Oct 28, 2019

Choose a reason for hiding this comment

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

when passing Rect pass instead const Rect& #Resolved

float GetBottom(_In_ winrt::Rect rect) {
return (IsEmptyRect(rect) ? NegativeInfinity : rect.Y + rect.Height);
}

Copy link
Member

@asklar asklar Oct 28, 2019

Choose a reason for hiding this comment

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

not used, remove? #Resolved

}

REACTWINDOWS_API_(bool) IsEmptyRect(winrt::Rect rect) {
return rect.Width < 0;
Copy link
Member

Choose a reason for hiding this comment

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

< [](start = 20, length = 1)

<= ?

Copy link
Member

Choose a reason for hiding this comment

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

In fact consider reusing user32's IsRectEmpty instead


In reply to: 339777475 [](ancestors = 339777475)

result.X = std::numeric_limits<float>::infinity();
result.Y = std::numeric_limits<float>::infinity();
result.Width = -std::numeric_limits<float>::infinity();
result.Height = -std::numeric_limits<float>::infinity();
Copy link
Member

@asklar asklar Oct 28, 2019

Choose a reason for hiding this comment

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

should set these to 0? #Resolved

// Update this rectangle to be the union of this and rect.
REACTWINDOWS_API_(winrt::Rect) UnionRect(winrt::Rect rect1, _In_ winrt::Rect rect2) {
winrt::Rect result = rect1;
if (IsEmptyRect(rect1)) {
Copy link
Member

@asklar asklar Oct 28, 2019

Choose a reason for hiding this comment

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

can you just call the user32 UnionRect?
UnionRect(ToRECT(rect1), ToRECT(rect2)) #Resolved

private:
void SendEvent(std::string &&eventName, folly::dynamic &&parameters);
std::weak_ptr<IReactInstance> m_wkReactInstance;
winrt::CoreInputView::OcclusionsChanged_revoker m_occlusionsChnaged_revoker;
Copy link
Member

@asklar asklar Oct 28, 2019

Choose a reason for hiding this comment

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

m_occlusionsChnaged_revoker [](start = 50, length = 27)

fix typo: Ch n aged #Resolved

Copy link
Member

@asklar asklar left a comment

Choose a reason for hiding this comment

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

🕐

@ghost ghost added the Needs: Author Feedback The issue/PR needs activity from its author (label drives bot activity) label Oct 28, 2019
REACTWINDOWS_API_(bool) IsEmptyRect(winrt::Windows::Foundation::Rect rect);
REACTWINDOWS_API_(winrt::Windows::Foundation::Rect) CreateEmptyRect();
REACTWINDOWS_API_(winrt::Windows::Foundation::Rect)
UnionRect(winrt::Windows::Foundation::Rect rect1, _In_ winrt::Windows::Foundation::Rect rect2);
Copy link
Contributor Author

@ddalp ddalp Oct 28, 2019

Choose a reason for hiding this comment

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

There is already RectHelper class I can use, will remove . #Resolved

@ghost ghost removed the Needs: Author Feedback The issue/PR needs activity from its author (label drives bot activity) label Oct 28, 2019
Copy link
Member

@asklar asklar left a comment

Choose a reason for hiding this comment

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

:shipit:

@ddalp ddalp merged commit af904af into microsoft:master Oct 29, 2019
@ddalp ddalp deleted the keyboard branch October 29, 2019 19:32
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