Nativebase: Subtitle fontSize in Header not working

Created on 5 May 2017  路  7Comments  路  Source: GeekyAnts/NativeBase

Seems like the fontSize set in native-base-theme/components/Header.js isn't being passed down to the Subtitle component in Headers. I also tried ejecting the Theme files again.

React-Native v0.44
Native-Base v2.1.3

screen shot 2017-05-05 at 2 34 48 pm

bug

All 7 comments

Seems like the whole subtitle style is not working in my case,
same issue as #675

    "native-base": "2.1.3",
    "react": "16.0.0-alpha.6",
    "react-native": "0.43.4",

@fhad-getmaple

<Header hasSubtitle>
   <Left>
        <Button transparent>
           <Icon name='arrow-back' />
         </Button>
   </Left>
   <Body>
        <Title>Title</Title>
        <Subtitle style={{fontSize: 20, color: 'red'}}>Subtitle</Subtitle>
   </Body>
    <Right />
</Header>

try the above code will work for you.

Hi @GeekRishabh,

Thanks for the work around. Do you have any word if the bug itself will be fixed in an update?

Thanks.

package.json

    "native-base": "^2.1.4",
    "react": "16.0.0-alpha.6",
    "react-native": "^0.44.0",

This works fine, with default components, without inline style

screen shot 2017-06-01 at 4 52 04 pm

Subtitle doesn't seem to work. Here is my package.json

"react": "16.2.0",
"react-native": "0.52.2",
"native-base": "^2.3.7"

It doesn't seemed to be displaying anything.

I see a definition for Title, but not for Subtitle (t with a lower case). But I see SubTitle, but if I use that I get the following error.

Invariant Violation: Element type is invalid: expected a string (for built-in components) or a 
class/function (for composite components) but got: undefined. You likely forgot to export your 
component from the file it's defined in, or you might have mixed up default and named imports.

Here is what I see in the definition -

screen shot 2018-03-18 at 5 42 02 pm

screen shot 2018-03-18 at 5 43 17 pm

I'm using it exactly the way it says in the example in the docs. Something like this -

<Container>
  <Header>
    <Left>
      <Button transparent>
        <Icon name='arrow-back' />
      </Button>
    </Left>
    <Body>
      <Title>Title</Title>
      <Subtitle>Subtitle</Subtitle>
    </Body>
    <Right />
  </Header>
</Container>

EDIT: I tried adding hasTabs and hasSubtitle. It didn't work. Here is what I see in the definition for Header

screen shot 2018-03-18 at 5 49 54 pm

Updated to 2.3.10 (latest). Now I see definitions for Subtitle (instead of SubTitle in 2.3.7). But the subtitles still aren't showing.

@aswinramakrish are you still facing this issue. Checked this. It is working fine (with 2.3.10). Attaching a gif

Gif

subtitle

Ok. Found the issue. The default color of Subtitle is #ffffff and guess what my header background was? 馃槀

Was this page helpful?
0 / 5 - 0 ratings

Related issues

nschurmann picture nschurmann  路  3Comments

muthuraman007 picture muthuraman007  路  3Comments

natashache picture natashache  路  3Comments

omerdn1 picture omerdn1  路  3Comments

sihemhssine picture sihemhssine  路  3Comments