Skip to content

Improve iOS UX - align for consistency with Android #12

@fobos531

Description

@fobos531

Hello,

I've noticed that when I tap on the Trigger of the tooltip on iOS, the tooltip dismisses, but immediately presents again (since I tapped on the Trigger) - to illustrate what I'm talking about:

CleanShot.2023-10-14.at.13.20.45.mp4

For comparison, on Android, when I do the same on Android, the tooltip is only dismissed, instead of being presented again. See video:

CleanShot.2023-10-14.at.13.25.10.mp4

I find Android's behavior to be much more in-line with what the average user would expect. I compared this behavior with the upstream library used for iOS which is Popovers. The author has a reference app called "Find" (getfind.app) where they're utilizing Popovers in various places. The behavior there is exactly like on Android, i.e. tapping on the Trigger only dismisses the tooltip, instead of re-presenting them.

I suspect the "culprit" of this behavior lies somewhere in this method:

  override func didUpdateReactSubviews() {
    let firstView = self.reactSubviews()[0] as! RCTView
    contentView = firstView
    for index in 1..<self.reactSubviews().count {
      let subView = self.reactSubviews()[index]
      self.addSubview(subView)
    }
  }

Can this be aligned so that the iOS behavior is the same as Android?

For reference, this is the code from my videos

<Tooltip.Root
            {...Platform.select({
              default: {
                open,
                onDismiss: () => {
                  setOpen(false);
                },
              },
            })}>
            <Tooltip.Trigger>
              <Pressable
                {...Platform.select({
                  default: {
                    onPress: () => {
                      if (!open) {
                        setOpen(!open);
                      }
                    },
                  },
                })}>
                <Text weight="medium">Test tooltip text</Text>
              </Pressable>
            </Tooltip.Trigger>
            <Tooltip.Content
              containerStyle={{
                paddingLeft: 10,
                paddingRight: 10,
                paddingTop: 8,
                paddingBottom: 8,
              }}
              onTap={() => {
                setOpen(false);
              }}
              dismissDuration={300}
              disableTapToDismiss
              side="top"
              presetAnimation="fadeIn"
              backgroundColor={theme.colors.text}
              borderRadius={12}>
              <Tooltip.Text text="Test" style={{ color: theme.colors.mainBackground, fontSize: 16 }} />
            </Tooltip.Content>
          </Tooltip.Root>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions