Skip to content

Keyboard - #3541

Merged
Di Da (ddalp) merged 6 commits into
microsoft:masterfrom
ddalp:keyboard
Oct 29, 2019
Merged

Di Da (ddalp) merged 6 commits into
microsoft:masterfrom
ddalp:keyboard

Conversation

@ddalp

@ddalp Di Da (ddalp) commented Oct 28, 2019 •

Copy link
Copy Markdown
Contributor

#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

#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>

@ddalp Di Da (ddalp) Oct 28, 2019 •

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.

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);

@asklar Alexander Sklar (asklar) Oct 28, 2019 •

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.

when passing Rect pass instead const Rect& #Resolved

Comment thread vnext/ReactUWP/Utils/RectUtils.cpp Outdated
float GetBottom(_In_ winrt::Rect rect) {
return (IsEmptyRect(rect) ? NegativeInfinity : rect.Y + rect.Height);
}

@asklar Alexander Sklar (asklar) Oct 28, 2019 •

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.

not used, remove? #Resolved

Comment thread vnext/ReactUWP/Utils/RectUtils.cpp Outdated
}

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

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.

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

<= ?

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.

In fact consider reusing user32's IsRectEmpty instead


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

Comment thread vnext/ReactUWP/Utils/RectUtils.cpp Outdated
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();

@asklar Alexander Sklar (asklar) Oct 28, 2019 •

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.

should set these to 0? #Resolved

Comment thread vnext/ReactUWP/Utils/RectUtils.cpp Outdated
// 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)) {

@asklar Alexander Sklar (asklar) Oct 28, 2019 •

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 you just call the user32 UnionRect?
UnionRect(ToRECT(rect1), ToRECT(rect2)) #Resolved

Comment thread vnext/ReactUWP/Views/SIPEventHandler.h Outdated
private:
void SendEvent(std::string &&eventName, folly::dynamic &&parameters);
std::weak_ptr<IReactInstance> m_wkReactInstance;
winrt::CoreInputView::OcclusionsChanged_revoker m_occlusionsChnaged_revoker;

@asklar Alexander Sklar (asklar) Oct 28, 2019 •

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.

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

fix typo: Ch n aged #Resolved

@asklar Alexander Sklar (asklar) 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.

🕐

@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);

@ddalp Di Da (ddalp) Oct 28, 2019 •

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.

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

@asklar Alexander Sklar (asklar) 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.

:shipit:

@ddalp
Di Da (ddalp) merged commit af904af into microsoft:master Oct 29, 2019
@ddalp
Di Da (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