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

fix: pass flattened styles to adjustPadding #1132

Merged
merged 3 commits into from
Jun 26, 2019

Conversation

jaulz
Copy link
Collaborator

@jaulz jaulz commented Jun 14, 2019

Motivation

If plain styles are passed, they cannot be used to read properties of it.

Test plan

n/a

@callstack-bot
Copy link

callstack-bot commented Jun 14, 2019

Hey @jaulz, thank you for your pull request 🤗. The documentation from this branch can be viewed here. Please remember to update Typescript types if you changed API.

@ferrannp ferrannp requested a review from jbinda June 14, 2019 09:17
@jbinda jbinda self-assigned this Jun 24, 2019
@jbinda jbinda added the wip label Jun 24, 2019
@Trancever
Copy link
Contributor

@jaulz What is this PR fixing?

@jaulz
Copy link
Collaborator Author

jaulz commented Jun 25, 2019

The issue is that if you pass a style to StyleSheet.create it will generate an id. Hence, you cannot simply pass styles to adjustPaddingFlat:
https://github.com/callstack/react-native-paper/blob/master/src/components/TextInput/TextInputFlat.js#L147-L166

and read them afterwards like this:

const { paddingTop, paddingBottom } = styles;

On web, this caused an issue which positioned the text input content incorrectly (to close to the label):
image

@jbinda
Copy link
Contributor

jbinda commented Jun 26, 2019

Thanks @jaulz ! I missed broken padding in web.

@jbinda jbinda removed the wip label Jun 26, 2019
@Trancever Trancever merged commit fcf3ec9 into master Jun 26, 2019
@jaulz jaulz deleted the jaulz/fix-pass-flattened-styles branch July 17, 2019 08:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants