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

textAlignVertical is not working in Input #149

Closed
mamkkl opened this issue Dec 8, 2019 · 7 comments
Closed

textAlignVertical is not working in Input #149

mamkkl opened this issue Dec 8, 2019 · 7 comments
Labels
Type: Bug Something isn't working

Comments

@mamkkl
Copy link

mamkkl commented Dec 8, 2019

Describe the bug
I want to make a multiple-line text input with placeholder at the top of the input area. However, textAlignVertical is not able to use since styles of the TextInput can't be override

To Reproduce
<Input multiline style={{textAlignVertical:'top', height: 200}} />

Expected behavior
The placeholder displays at the top of the input area
image

Current behavior
image

Additional context
I can fix the issue by adding a new overrideInputStyles property of Input, however, it seems the framework is not expecting to override the style of the TextInput.

@palingheorghe
Copy link
Collaborator

Hi @mamkkl ! Yes you're right, this should pe fixed. There is a prop for overriding the container's style called inputViewStyle so the new prop name should be something similar.

@mamkkl
Copy link
Author

mamkkl commented Dec 11, 2019

Hi @mamkkl ! Yes you're right, this should pe fixed. There is a prop for overriding the container's style called inputViewStyle so the new prop name should be something similar.

I can help on this, need a hand :)?

@mamkkl
Copy link
Author

mamkkl commented Dec 11, 2019

Hi @mamkkl ! Yes you're right, this should pe fixed. There is a prop for overriding the container's style called inputViewStyle so the new prop name should be something similar.

I found that we can use styles.* for the style overriding but in withGalio the styles in props were not actually being used. Merging the styles in props into styles which will be passed to the component can fix the issue.

styles={{...(styles ? styles({ ...GalioTheme, ...theme }) : {}), ...props.styles}}

@mamkkl
Copy link
Author

mamkkl commented Dec 11, 2019

Hi @mamkkl ! Yes you're right, this should pe fixed. There is a prop for overriding the container's style called inputViewStyle so the new prop name should be something similar.

I found that we can use styles.* for the style overriding but in withGalio the styles in props were not actually being used. Merging the styles in props into styles which will be passed to the component can fix the issue.

styles={{...(styles ? styles({ ...GalioTheme, ...theme }) : {}), ...props.styles}}

add array check can make the styles input even nicer
styles={{...(styles ? styles({ ...GalioTheme, ...theme }) : {}), ...(Array.isArray(props.styles) ? props.styles.reduce((a,c) => ({...a, ...c})) : props.styles)}}

@palingheorghe
Copy link
Collaborator

You could always give us a hand! Write a PR for this issue with detailed explanation because I think this could really level up our library.

Thanks!

@palingheorghe palingheorghe added the Type: Bug Something isn't working label Jan 6, 2020
@AndyOsei
Copy link
Collaborator

AndyOsei commented Mar 7, 2020

@palingheorghe I looked into this issue and realized that what is causing the placeholder to be centered is styles.inputContainer inputContainer: { flexDirection: 'row', alignItems: 'center', justifyContent: 'center', }been applied to inputViewStyle. Hence overriding them by passing { justifyContent: "flex-start", alignItems: "flex-start" } should fix the issue.

Also I would open a PR to introduce a prop named textInputStyle on Input which allows TextInput styles to be overridden...

@palingheorghe
Copy link
Collaborator

Closed because we've merged the PR into the dev branch. Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants