Home > Back-end >  Create a backdrop in react native
Create a backdrop in react native

Time:12-14

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,
},
});

CodePudding user response:

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 ^^

CodePudding user response:

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


    tabBarOptions={{
       activeTintColor: '#fff',
       inactiveTintColor: '#fff',
       activeBackgroundColor: 'transparent',
       inactiveBackgroundColor: '#fff',
           style: {
                 backgroundColor: '#white',
               
           }
    }}
>
  • Related