Skip to content

Fix/ Hint renders on wrong screen #1818

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

Merged
merged 6 commits into from
Feb 14, 2022
Merged

Fix/ Hint renders on wrong screen #1818

merged 6 commits into from
Feb 14, 2022

Conversation

lidord-wix
Copy link
Contributor

@lidord-wix lidord-wix commented Feb 3, 2022

Description

Use TouchableWithoutFeedback instead of Modal to handle the Hint background press.
Checked on Android and on iOS, in the HintsScreen and in the ButtonsScreen.
WOAUILIB-2236

Changelog

Fix hint renders on the wrong screen

Copy link
Collaborator

@ethanshar ethanshar left a comment

Choose a reason for hiding this comment

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

@lidord-wix I wrote a few comments..
Anyway this a big change, so we have to make sure the usages in One App are not affected in a bad way.

I would create a one app version with this fix and get a list of modules who use Hint (I hope they are not many) and then we probably want them to verify the functionality of the Hint is still intact

// }
// }
renderOverlay() {
const {targetLayoutInWindow = {y: 0, x: 0}} = this.state;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why are you setting a default value here?
Also, it makes the check in line 400 redundant.. maybe it was intentional?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Just because of the TS error, added a ts-expect-error for now

Copy link
Collaborator

@ethanshar ethanshar Feb 8, 2022

Choose a reason for hiding this comment

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

In that case it's better to fix the actual issue.
In this case ts-expect-error would never be solved, cause it's our code. If anything you can use ts-ignore

But I think that in this case we can just fix it.

You can declare the type of the targetLayoutInWindow in the state.
You can use casting to keep it simple, something like that

  state = {
    targetLayoutInWindow: undefined as {x: number, y: number, width: number, height: number} | undefined,
    targetLayout: this.props.targetFrame,
    hintUnmounted: !this.props.visible
  };

@lidord-wix lidord-wix requested a review from ethanshar February 7, 2022 16:46
// this.renderOverlay(),
this.renderHintContainer()
<>
{onBackgroundPress && this.renderOverlay()}
Copy link
Collaborator

Choose a reason for hiding this comment

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

No need to condition this use case with onBackgroundPress
We take care of it in renderOverlay function, where we render the actual overlay.
Technically, the user can still have a hint with a background overlay

// }
// }
renderOverlay() {
const {targetLayoutInWindow = {y: 0, x: 0}} = this.state;
Copy link
Collaborator

@ethanshar ethanshar Feb 8, 2022

Choose a reason for hiding this comment

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

In that case it's better to fix the actual issue.
In this case ts-expect-error would never be solved, cause it's our code. If anything you can use ts-ignore

But I think that in this case we can just fix it.

You can declare the type of the targetLayoutInWindow in the state.
You can use casting to keep it simple, something like that

  state = {
    targetLayoutInWindow: undefined as {x: number, y: number, width: number, height: number} | undefined,
    targetLayout: this.props.targetFrame,
    hintUnmounted: !this.props.visible
  };

Copy link
Collaborator

@ethanshar ethanshar left a comment

Choose a reason for hiding this comment

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

Added few more comments..

@lidord-wix lidord-wix requested a review from ethanshar February 9, 2022 10:14
@lidord-wix lidord-wix added Important for Next Release PR that must be included in the release version and removed WIP labels Feb 10, 2022
@ethanshar ethanshar merged commit c607958 into master Feb 14, 2022
@lidord-wix lidord-wix deleted the fix/remove_hint_modal branch February 22, 2022 13:05
@lidord-wix lidord-wix restored the fix/remove_hint_modal branch March 15, 2022 12:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Important for Next Release PR that must be included in the release version
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants