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

Text not selectable on Android #32

Open
AtanvarnoJack opened this issue Mar 23, 2020 · 1 comment
Open

Text not selectable on Android #32

AtanvarnoJack opened this issue Mar 23, 2020 · 1 comment

Comments

@AtanvarnoJack
Copy link

RN = "^0.61.5"
react-native-read-more-text = "^1.1.2",

When ReadMore have Text in children who have selectable props.
Text can't be selectable.
Only tested on Android 28 and 29

<ReadMore
  numberOfLines={numOfLine}
  renderTruncatedFooter={this._renderTruncatedFooter}
  renderRevealedFooter={this._renderRevealedFooter}
  onReady={this._handleTextReady}>
  <Text
    selectable={true}
    style={styles.container}>
    {this.renderMessages()}
  </Text>
</ReadMore>
@AtanvarnoJack
Copy link
Author

Exemple of resolution for me with a fork:

Index.js of react-native-read-more-text

  render() {
    let { measured, showAllText } = this.state;

+    let { numberOfLines, selectable } = this.props;

    return (
      <View>
        <Text
+         selectable={selectable}
          numberOfLines={measured && !showAllText ? numberOfLines : 0}
          style={this.props.textStyle}
          ref={text => {
            this._text = text;
          }}
        >
          {this.props.children}
        </Text>

        {this._maybeRenderReadMore()}
      </View>
    );
  }

Usage:

<ReadMore
  selectable={true}
  numberOfLines={numOfLine}
  renderTruncatedFooter={this._renderTruncatedFooter}
  renderRevealedFooter={this._renderRevealedFooter}
  onReady={this._handleTextReady}>
  <Text
    style={styles.container}>
    {this.renderMessages()}
  </Text>
</ReadMore>

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

1 participant