0

I am using ToolbarAndroid in React Native. Using it I am able to display the below

enter image description here

What I want to show is number of items added to cart like below, where number of items added to cart is shown.

I tried to look more into one property, i.e showWithText, but there is not much documentation on it here

enter image description here

Below is my code

<ToolbarAndroid style={{ width: Dimensions.get('window').width, height: 60, backgroundColor: '#42b549' }}
            navIcon={require('./img/icon-burgermenu.png')}
            onIconClicked={this.onIconClick}
            actions={[
              {
                title: 'Credit Card',
                icon: require('./img/icon-CreditCards-Info.png'),
                show: 'always',

              },
              { title: 'Add To Cart',
                icon: require('./img/icon-Cart.png'),
                show: 'always',
                showWithText: true
              },
              ]}
            onActionSelected={this.onActionSelected}>
            <TextInput
              style={{
                borderWidth: 1,
                backgroundColor: 'white',
                borderRadius: 3,
                width: 350,
                borderColor: 'white'
              }}
              tintColor='red'
              caretHidden={false}
              placeholder='Search                                                                    '
              underlineColorAndroid='transparent'
            />
          </ToolbarAndroid>

How can I add the text there, does it have to be another action? If yes, then how?

Mozak
  • 2,738
  • 4
  • 30
  • 49
  • Why can't you try custom header instead of ToolbarAndroid? You can fully customize it. And it has the advantage of using it in Ios also. – Ajith Pandian Aug 11 '17 at 11:06
  • The text will not show when it's in `portrait` mode, it's enforce by the Android framework, see this [answer](https://stackoverflow.com/a/16125131/7987108) for more detail.so you need to build a custom toolbar. – ufxmeng Aug 13 '17 at 02:28

0 Answers0