Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ public class ReactEditText extends AppCompatEditText {
private int mFontWeight = ReactConstants.UNSET;
private int mFontStyle = ReactConstants.UNSET;
private boolean mAutoFocus = false;
private boolean mContextMenuHidden = false;
private boolean mDidAttachToWindow = false;
private @Nullable String mPlaceholder = null;

Expand Down Expand Up @@ -191,6 +192,9 @@ public boolean performAccessibilityAction(View host, int action, Bundle args) {
*/
@Override
public boolean onCreateActionMode(ActionMode mode, Menu menu) {
if (mContextMenuHidden) {
return false;
}
menu.removeItem(android.R.id.pasteAsPlainText);
return true;
}
Expand Down Expand Up @@ -1121,6 +1125,10 @@ public void setAutoFocus(boolean autoFocus) {
mAutoFocus = autoFocus;
}

public void setContextMenuHidden(boolean contextMenuHidden) {
mContextMenuHidden = contextMenuHidden;
}

protected void applyTextAttributes() {
// In general, the `getEffective*` functions return `Float.NaN` if the
// property hasn't been set.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -651,14 +651,7 @@ && shouldHideCursorForEmailTextInput()) {

@ReactProp(name = "contextMenuHidden", defaultBoolean = false)
public void setContextMenuHidden(ReactEditText view, boolean contextMenuHidden) {
final boolean _contextMenuHidden = contextMenuHidden;
view.setOnLongClickListener(
new View.OnLongClickListener() {
public boolean onLongClick(View v) {
return _contextMenuHidden;
}
;
});
view.setContextMenuHidden(contextMenuHidden);
}

@ReactProp(name = "selectTextOnFocus", defaultBoolean = false)
Expand Down