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

Windows: First instance of action sheet display gets cut off #184

Closed
MaxPMagee opened this issue Oct 7, 2020 · 4 comments · Fixed by #202
Closed

Windows: First instance of action sheet display gets cut off #184

MaxPMagee opened this issue Oct 7, 2020 · 4 comments · Fixed by #202
Labels

Comments

@MaxPMagee
Copy link

MaxPMagee commented Oct 7, 2020

We're trying to use react-native to drive a Windows app as well as our Android and iOS apps. This bug only appears on Windows.

The first time we open an action sheet (again, on Windows only), we only see about the first 1/5 of the content of the sheet. The next (and subsequent) clicks open the full content as expected.

We've debugged the content, what we call lookups, it's there and available before the first click. We've played with the height styling to see if we can hardcode it—setting height via actionSheetOptions' containerStyle, and although we can hardcode the size however we want (setting it to 100%, for example), the first click is always different/missing content, as if the offset or vertical anchor point is calculated incorrectly to begin with, and the location is the problem, but somehow this gets corrected after the initial display of the actionSheet.

  const showEditApiUrlModal = useCallback(() => {
    if (config.config.debugMode) {
      const lookups: Array<string> = [
        "Prod",
        "Stack 2",
        "Stack 3",
        "Stack 8",
        "Stack 22",
        "Custom",
      ];
      showActionSheetWithOptions(
        {
          title: common_t(['chooseStack']),
          options: [...lookups, "Cancel"],
          cancelButtonIndex: 6,
        },
        (buttonIndex: number) => {
          if (buttonIndex < 5) {
            setApiUrl(lookups[buttonIndex][1]!, config);
          } else if (buttonIndex === 5) {
            showApiUrlOverlay();
          }
        }
      );
    }
  }, [showActionSheetWithOptions, setApiUrl, showApiUrlOverlay, config]);

This is the final display result (after the pop-up animation is complete) of the initial showActionSheetWithOptions call (only 1.5 of the 8 options are visible/clickable):
IncorrectDisplay

This is what all subsequent displays look like (and what we would expect for all of them):
CorrectDisplay

If I set the containerStyle height to 100%, the first window shows more but it still only fills about 50% of the screen on the first display. For all subsequent clicks, the sheet takes up the full screen.

...
        showActionSheetWithOptions(
        {
          title: common_t(['chooseStack']),
          options: [...lookups, "Cancel"],
          cancelButtonIndex: 6,
          containerStyle: {height: "100%"},
        },
...

This is the first instance of ActionSheet with height: 100%
Screen Shot 2020-10-07 at 11 44 02 AM

And this is how all subsequent clicks look:
Screen Shot 2020-10-07 at 11 44 13 AM

@emmanuj
Copy link
Contributor

emmanuj commented Nov 16, 2020

Looked into this a little bit. Looks like useNativeDriver does not have full support on Windows.

Would you be open to a PR that exposes a useNativeDriver props on the ActionSheetProvider so as to allow setting this prop to false?

@bradbyte
Copy link
Collaborator

@emmanuj Yes, as long as it defaults to the current behavior. Thank you!

emmanuj pushed a commit to emmanuj/react-native-action-sheet that referenced this issue Nov 17, 2020
@emmanuj
Copy link
Contributor

emmanuj commented Nov 17, 2020

Created a PR for this that will allow Windows users to set useNativeDriver=false on ActionSheetProvider. I'll log a ticket to react-native-windows to take care of the animation issue.

bradbyte pushed a commit that referenced this issue Feb 12, 2021
Fixes #184 

Co-authored-by: emmanuel.john <emmanuel.john@singlewire.com>
@bradbyte
Copy link
Collaborator

🎉 This issue has been resolved in version 3.9.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
3 participants