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

Disable clickable on normal text else the active clickables like hashtags and mentions #21

Open
mykhailo2800 opened this issue May 22, 2021 · 3 comments

Comments

@mykhailo2800
Copy link

No description provided.

@mykhailo2800
Copy link
Author

When I click on normal texts, I want to trigger the press event of the TouchableOpacity that warps this twitterTextView

@dan-fein
Copy link

dan-fein commented Jan 4, 2022

Yeah I'm not sure why the non-tags are clickable here.

@ElicaInc
Copy link

index.js

 return (
    <Text {...extraProps}>
      {splitStringByMatches(str, matches).map(([str, pattern], i) => {
        return (
          <Text
            key={i}
            style={style[pattern]}
            onPress={(e) => {
              const handle = onPress[pattern];
              if (handle) {
                return handle(e, str);
              }
              return undefined;
            }}
            children={str}
          />
        );
      })}
    </Text>
  );

please try below. this works for me.

return (
    <Text {...extraProps}>
      {splitStringByMatches(str, matches).map(([str, pattern], i) => {
        if (pattern){
          return (
            <Text
              key={i}
              disabled={!extractHashtags}
              style={style[pattern]}
              onPress={(e) => {
                const handle = onPress[pattern];
                if (handle) {
                  return handle(e, str);
                }
                return undefined;
              }}
              children={str}
            />
          );
        } else {
          return (
            <Text
              key={i}
              children={str}
            />
          );
        }
      })}
    </Text>
  );

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

No branches or pull requests

3 participants