React-native-paper: Changing fontSize of TextInput

Created on 2 May 2018  路  7Comments  路  Source: callstack/react-native-paper

TextInput Module fontSize doesn't get affected

Current behaviour

fontSize remains 12 unaffected.

Expected behaviour

fontSize should change right?? or am i missing something?

Code sample

label='Email'
value={this.state.text}
onChangeText={text => this.setState({ text })}
style={{flex:1, fontSize:16}}
/>

Your Environment

Environment:
OS: macOS Sierra 10.12.6
Node: 8.8.1
Yarn: 1.2.1
npm: 5.4.2
Watchman: 4.9.0
Xcode: Xcode 9.1 Build version 9B46
Android Studio: 3.1 AI-173.4697961

Packages: (wanted => installed)
react: ^16.3.0-alpha.1 => 16.3.0-alpha.2
react-native: ^0.54.2 => 0.54.2

Refactor enhancement help wanted

Most helpful comment

Awesome, I'll try to make a PR tonight.

All 7 comments

Yeah, if we change fontSize some things will break now. We need to think of a way to support it to do things like:

image

Looking through the code in TextInput.js, MINIMIZED_LABEL_FONT_SIZE and MAXIMIZED_LABEL_FONT_SIZE are literals. They should be passed in as props with defaults. I can take a look at it and make some spacing adjustments that @ferrannp may have alluded to.

Perhaps the best thing would be to add props for font size and spacing, so that the user of the library takes on the responsibility for resizing if they wish. Would you accept a PR for this?

@ferrannp Would you accept a PR for this?

Hey @ferrannp and @satya164, sorry to bother you.
Have you consider @peacechen 's solution?
I can try to make a PR too.

@vieiralucas hey, we don't want to add separate props for this. But I'd accept a PR which gets the fontSize from the style prop using StyleSheet.flatten and adjusts the values automatically.

Awesome, I'll try to make a PR tonight.

fixes in #1020

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ButuzGOL picture ButuzGOL  路  3Comments

tonyxiao picture tonyxiao  路  3Comments

yaronlevi picture yaronlevi  路  3Comments

ButuzGOL picture ButuzGOL  路  4Comments

sm2017 picture sm2017  路  4Comments