0

i just used some buttons from native base in my react native application and i need to modify their style. In fact a button have a different style than a clicked button. I have two buttons: the first one renders the default page and have a first style . When clicking the second button, i have the second page rendered and change the style. Here is the code i'm using :

<View style={{flexDirection: 'row'}}>
    <Button onPress={() => this.setState({selectedTab: 'Tab1'})}>
            <Text>tab 1 </Text>
    </Button>

    <Button onPress={() => this.setState({selectedTab: 'Tab2'})}>
            <Text>tab 2</Text>
    </Button>
</View>

I need to implement a similar styling: enter image description here

user3521011
  • 1,481
  • 5
  • 20
  • 35

1 Answers1

0

Native base 3 has a _pressed prop to pass props when button is pressed.

<Button
          size="lg"
          height={16}
          marginTop={6}
          marginBottom={2.5}
          _text={{ fontSize: 16 }}
          _pressed={{ opacity: 0.6 }}
        >
          OK
        </Button>

See more https://docs.nativebase.io/button

Adam Beleko
  • 676
  • 7
  • 15