Skip to content

Commit

Permalink
fix(TextInput): define placeholder color explicitly (#1794)
Browse files Browse the repository at this point in the history
* fix: define placeholder color

* fix: eslint error

* fix: snapshots

* Create tender-pants-fail.md

* empty
  • Loading branch information
saurabhdaware authored Nov 7, 2023
1 parent 6e8089f commit 97b9b4c
Show file tree
Hide file tree
Showing 8 changed files with 21 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changeset/tender-pants-fail.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@razorpay/blade": patch
---

fix(TextInput): white placeholder on autoFocus in android
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import { assignWithoutSideEffects } from '~utils/assignWithoutSideEffects';
import { size } from '~tokens/global';
import { makeSize } from '~utils/makeSize';
import type { Platform } from '~utils';
import { useTheme } from '~utils';

type StyledComponentAutoCompleteAndroid =
| 'off'
Expand Down Expand Up @@ -244,6 +245,7 @@ const _StyledBaseInput: React.ForwardRefRenderFunction<
ref,
) => {
const buttonValue = props.value ? props.value : props.placeholder;
const { theme } = useTheme();
const commonProps = {
onBlur: (): void => {
// In certain cases like SelectInput, we want to ignore the blur animation when option item is clicked.
Expand Down Expand Up @@ -289,6 +291,7 @@ const _StyledBaseInput: React.ForwardRefRenderFunction<
numberOfLines={numberOfLines}
editable={!isDisabled}
maxLength={maxCharacters}
placeholderTextColor={theme.colors.surface.text.placeholder.lowContrast}
onFocus={(event): void => {
handleOnFocus?.({ name, value: event?.nativeEvent.text });
setCurrentInteraction('active');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,7 @@ exports[`<BaseInput /> should render 1`] = `
onFocus={[Function]}
onKeyPress={[Function]}
onSubmitEditing={[Function]}
placeholderTextColor="hsla(214, 18%, 69%, 1)"
secureTextEntry={false}
style={
[
Expand Down Expand Up @@ -633,6 +634,7 @@ exports[`<BaseInput /> should render with icons 1`] = `
onKeyPress={[Function]}
onSubmitEditing={[Function]}
placeholder="First Last"
placeholderTextColor="hsla(214, 18%, 69%, 1)"
secureTextEntry={false}
style={
[
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -362,6 +362,7 @@ exports[`<Dropdown /> with <AutoComplete /> should render AutoComplete 1`] = `
onKeyPress={[Function]}
onSubmitEditing={[Function]}
placeholder="Select Option"
placeholderTextColor="hsla(214, 18%, 69%, 1)"
secureTextEntry={false}
style={
[
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,7 @@ exports[`<OTPInput /> should render 1`] = `
onKeyPress={[Function]}
onSubmitEditing={[Function]}
placeholder=""
placeholderTextColor="hsla(214, 18%, 69%, 1)"
secureTextEntry={false}
style={
[
Expand Down Expand Up @@ -403,6 +404,7 @@ exports[`<OTPInput /> should render 1`] = `
onKeyPress={[Function]}
onSubmitEditing={[Function]}
placeholder=""
placeholderTextColor="hsla(214, 18%, 69%, 1)"
secureTextEntry={false}
style={
[
Expand Down Expand Up @@ -546,6 +548,7 @@ exports[`<OTPInput /> should render 1`] = `
onKeyPress={[Function]}
onSubmitEditing={[Function]}
placeholder=""
placeholderTextColor="hsla(214, 18%, 69%, 1)"
secureTextEntry={false}
style={
[
Expand Down Expand Up @@ -689,6 +692,7 @@ exports[`<OTPInput /> should render 1`] = `
onKeyPress={[Function]}
onSubmitEditing={[Function]}
placeholder=""
placeholderTextColor="hsla(214, 18%, 69%, 1)"
secureTextEntry={false}
style={
[
Expand Down Expand Up @@ -832,6 +836,7 @@ exports[`<OTPInput /> should render 1`] = `
onKeyPress={[Function]}
onSubmitEditing={[Function]}
placeholder=""
placeholderTextColor="hsla(214, 18%, 69%, 1)"
secureTextEntry={false}
style={
[
Expand Down Expand Up @@ -975,6 +980,7 @@ exports[`<OTPInput /> should render 1`] = `
onKeyPress={[Function]}
onSubmitEditing={[Function]}
placeholder=""
placeholderTextColor="hsla(214, 18%, 69%, 1)"
secureTextEntry={false}
style={
[
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,7 @@ exports[`<PasswordInput /> should render 1`] = `
onFocus={[Function]}
onKeyPress={[Function]}
onSubmitEditing={[Function]}
placeholderTextColor="hsla(214, 18%, 69%, 1)"
returnKeyType="done"
secureTextEntry={true}
style={
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,7 @@ exports[`<TextArea /> should render 1`] = `
onFocus={[Function]}
onKeyPress={[Function]}
onSubmitEditing={[Function]}
placeholderTextColor="hsla(214, 18%, 69%, 1)"
secureTextEntry={false}
style={
[
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,7 @@ exports[`<TextInput /> should render 1`] = `
onFocus={[Function]}
onKeyPress={[Function]}
onSubmitEditing={[Function]}
placeholderTextColor="hsla(214, 18%, 69%, 1)"
returnKeyType="default"
secureTextEntry={false}
style={
Expand Down Expand Up @@ -690,6 +691,7 @@ exports[`<TextInput /> should render with icon, prefix, suffix 1`] = `
onKeyPress={[Function]}
onSubmitEditing={[Function]}
placeholder="something"
placeholderTextColor="hsla(214, 18%, 69%, 1)"
prefix="https://"
returnKeyType="go"
secureTextEntry={false}
Expand Down

0 comments on commit 97b9b4c

Please sign in to comment.