Skip to content

Commit

Permalink
Support selectable={true} property on Text fields on Android.
Browse files Browse the repository at this point in the history
  • Loading branch information
mikelambert committed Jun 10, 2016
1 parent b03a725 commit cbfc6f7
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
6 changes: 6 additions & 0 deletions Libraries/Text/Text.js
Expand Up @@ -30,6 +30,7 @@ const viewConfig = {
isHighlighted: true,
numberOfLines: true,
allowFontScaling: true,
selectable: true,
}),
uiViewClassName: 'RCTText',
};
Expand Down Expand Up @@ -89,6 +90,11 @@ const Text = React.createClass({
* This function is called on long press.
*/
onLongPress: React.PropTypes.func,
/**
* Lets the user select text, to use the native copy and paste functionality.
* @platform android
*/
selectable: React.PropTypes.bool,
/**
* When true, no visual change is made when text is pressed down. By
* default, a gray oval highlights the text on press down.
Expand Down
Expand Up @@ -97,6 +97,11 @@ public void setLineHeight(ReactTextView view, float lineHeight) {
}
}

@ReactProp(name = "selectable")
public void setSelectable(ReactTextView view, boolean placeholder) {
view.setTextIsSelectable(placeholder);
}

@Override
public void updateExtraData(ReactTextView view, Object extraData) {
ReactTextUpdate update = (ReactTextUpdate) extraData;
Expand Down

0 comments on commit cbfc6f7

Please sign in to comment.