0

I'm trying to use NavigationBar from the Shoutem UI toolkit.

My code:

<Screen>
    <NavigationBar centerComponent={<Title>TITLE</Title>}/>

    <ListView
        data={groupedData}
        renderRow={this.renderRow}
        loading ={this.state.loading}
        onRefresh={this.getAllNewsfeed.bind(this)}
        onLoadMore ={this.loadMoreData.bind(this)}
        loadMoreSpinner={<Spinner/>} />

    <Button onPress={this.onLogout.bind(this)}>
        <Text>
            LOGOUT
        </Text>
    </Button>
</Screen>

But NavigationBar always hidden, listview above NavigationBar. But when I try replace it to Title. It still work. But I don't want use Title because I want add button back or something else same that.

Manfred Radlwimmer
  • 13,257
  • 13
  • 53
  • 62
Chu Việt Hưng
  • 141
  • 1
  • 1
  • 8

1 Answers1

0

This PR solves it https://github.com/shoutem/ui/pull/104/files but somehow we have removed it from the theme. We are going to fix that in next release but until then you can help yourself by this:

<Screen>
  <NavigationBar
    style={{
      container: {
        position: 'relative',
        width: Dimensions.get('window').width,
      }
    }}
    centerComponent={<Title>TITLE</Title>}
  />
  <ListView
    data={groupedData}
    renderRow={this.renderRow}
    loading ={this.state.loading}
    onRefresh={this.getAllNewsfeed.bind(this)}
    onLoadMore ={this.loadMoreData.bind(this)}
    loadMoreSpinner={<Spinner/>}
  />

  <Button onPress={this.onLogout.bind(this)}>
    <Text>
        LOGOUT
    </Text>
  </Button>
</Screen>

After release you will just have to change style prop to:

<NavigationBar
  styleName="inline"
  centerComponent={<Title>TITLE</Title>}
/>
Ivan Vukovic
  • 101
  • 4