Permalink
Browse files

Add TextInput's prop caretHidden implementation for Android and add t…

…he prop to docs

Summary:
This PR will:
- add missing documentation for `caretHidden` prop to the docs
- add `caretHidden` prop implementation for Android

I noticed this by accident when looking at `RCTTextFieldManager.m` and there is `RCT_EXPORT_VIEW_PROPERTY(caretHidden, BOOL)` which hides caret on iOS. Then I realised that the docs were missing for this prop and implementation on Android side :)

Render `TextInput` with prop `caretHidden`. After this caret is not visible anymore.
`<TextInput style={styles.input} caretHidden />`

If you omit the prop then caret is visible again
`<TextInput style={styles.input} />`
Closes #11863

Differential Revision: D4448402

fbshipit-source-id: 456e1df3e2cbb8af32540d2c7a8f4e7da219f5c3
  • Loading branch information...
Henrik Raitasola authored and facebook-github-bot committed Feb 24, 2017
1 parent fab0992 commit bb1f85183b94f3c8343dc3614f1de62a660e9fe5
@@ -527,6 +527,10 @@ const TextInput = React.createClass({
PropTypes.oneOf(DataDetectorTypes),
PropTypes.arrayOf(PropTypes.oneOf(DataDetectorTypes)),
]),
/**
* If `true`, caret is hidden. The default value is `false`.
*/
caretHidden: PropTypes.bool,
},
/**
@@ -346,6 +346,11 @@ private void setCursorColor(ReactEditText view, @Nullable Integer color) {
} catch (IllegalAccessException ex) {}
}
@ReactProp(name = "caretHidden", defaultBoolean = false)
public void setCaretHidden(ReactEditText view, boolean caretHidden) {
view.setCursorVisible(!caretHidden);
}
@ReactProp(name = "selectTextOnFocus", defaultBoolean = false)
public void setSelectTextOnFocus(ReactEditText view, boolean selectTextOnFocus) {
view.setSelectAllOnFocus(selectTextOnFocus);

2 comments on commit bb1f851

@henrikra

This comment has been minimized.

Show comment
Hide comment
@henrikra

henrikra Apr 4, 2017

Can you guys add my name to release notes since I implemented this :D?

henrikra replied Apr 4, 2017

Can you guys add my name to release notes since I implemented this :D?

@satya164

This comment has been minimized.

Show comment
Hide comment
@satya164

satya164 May 8, 2017

Collaborator

@henrikra sorry, just did that. it's a bit manual work since the commit doesn't have you as the user, probably because different email address.

Collaborator

satya164 replied May 8, 2017

@henrikra sorry, just did that. it's a bit manual work since the commit doesn't have you as the user, probably because different email address.

Please sign in to comment.