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

[Android] Fix TextInput Cursor jumping to the right when the placeholder null #28995

Closed
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
2 changes: 2 additions & 0 deletions Libraries/Components/TextInput/TextInput.js
Original file line number Diff line number Diff line change
Expand Up @@ -1107,6 +1107,7 @@ function InternalTextInput(props: Props): React.Node {
} else if (Platform.OS === 'android') {
const style = [props.style];
const autoCapitalize = props.autoCapitalize || 'sentences';
const placeholder = props.placeholder || '';
let children = props.children;
const childCount = React.Children.count(children);
invariant(
Expand Down Expand Up @@ -1135,6 +1136,7 @@ function InternalTextInput(props: Props): React.Node {
* with the props for TextInput. This will need to get fixed */
onScroll={_onScroll}
onSelectionChange={_onSelectionChange}
placeholder={placeholder}
selection={selection}
style={style}
text={text}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,7 @@ public void setAllowFontScaling(ReactEditText view, boolean allowFontScaling) {
}

@ReactProp(name = "placeholder")
public void setPlaceholder(ReactEditText view, @Nullable String placeholder) {
public void setPlaceholder(ReactEditText view, String placeholder) {
view.setHint(placeholder);
}

Expand Down