skip to Main Content

I have a bottom bar to which i want to add this kind of background in react native currently it looks like this.

How do i achieve this

This is my current code

<View style={{justifyContent: 'center', alignItems: 'center'}}>
                <Image
                  style={tabStyle.iconSize}
                  source={require('../assets/List-icon-1.png')}
                />
                <Image
                  style={tabStyle.arrowSize}
                  source={require('../assets/Arrow-1-1.png')}
                />
              </View>

const tabStyle = StyleSheet.create({
iconSize: {
height: 35,
width: 35,
marginBottom: 5,
},
arrowSize: {
height: 17,
width: 15,
marginBottom: 5,
},
});

2

Answers


  1. You can customize this in tabBar options prop in your tabBar component

    
        tabBarOptions={{
           activeTintColor: '#fff',
           inactiveTintColor: '#fff',
           activeBackgroundColor: 'transparent',
           inactiveBackgroundColor: '#fff',
               style: {
                     backgroundColor: '#white',
                   
               }
        }}
    >
    
    Login or Signup to reply.
  2. You need a component for this.

    Using Yarn

    yarn add react-native-linear-gradient
    

    Using Npm

    npm install react-native-linear-gradient --save
    

    after that

    import LinearGradient from 'react-native-linear-gradient';
    
    // Within your render function
    <LinearGradient colors={['#4c669f', '#3b5998', '#192f6a']} style={styles.linearGradient}>
      <Text style={styles.buttonText}>
        Sign in with Facebook
      </Text>
    </LinearGradient>
    
    // Later on in your styles..
    var styles = StyleSheet.create({
      linearGradient: {
        flex: 1,
        paddingLeft: 15,
        paddingRight: 15,
        borderRadius: 5
      },
      buttonText: {
        fontSize: 18,
        fontFamily: 'Gill Sans',
        textAlign: 'center',
        margin: 10,
        color: '#ffffff',
        backgroundColor: 'transparent',
      },
    });
    

    if doesnt work u can commet for help ^^

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search