Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

363
Views
How to make React Native Component background transparent?

I am using Tab Navigation which contains two screen, I need to make the background of each screen transparent so the app background is visible.

This is how it looks right now, I want the background you can see on Tabs navigator be visible on the entire screen.

enter image description here

This is Tabs component:

const Tabs = props => {

return(
    <Background source={require('../../assets/bg_image.png')}>
        <Tab.Navigator screenOptions={({ route }) => ({
            tabBarIcon: ({ focused, color, size }) => {
                 if (route.name === 'Notifications') {
                    return <Image style={styles.tabIcon} source={require('../../assets/notifications_icon.png')}/>
                }else if(route.name === 'Profile'){
                    return <Image style={styles.tabIcon} source={require('../../assets/profile_icon.png')}/>
                }
            },
            tabBarInactiveTintColor: '#ffffff',
            tabBarActiveTintColor: 'red',
            tabBarStyle: {
                backgroundColor: '#D3D3D338',
            },
            tabBarShowLabel: false,
            headerShown: false,
            
            })}
        >
            <Tab.Screen name="Notifications" component={Notifications}></Tab.Screen>
            <Tab.Screen name="Profile" component={Profile}></Tab.Screen>
        </Tab.Navigator>
    </Background>
);
}

And this is Notifications component:

import {View, Text, StyleSheet} from 'react-native';

const Notifications = props => {
    return(
        <View style={styles.content}>
            
        </View>
    );
}

const styles = StyleSheet.create({
content:{
    flex: 1,
    justifyContent: 'center',
    alignItems: 'center',
    backgroundColor: '#00000000'
}
});
export default Notifications;

This is Background component:

import {ImageBackground, StyleSheet} from 'react-native';

const Background = props => {
    return(
        <ImageBackground source={props.source} resizeMode="cover" style={{...styles.bgImage, width: '100%', height: '100%'}}>
            {props.children}
        </ImageBackground>
    );
};

const styles = StyleSheet.create({
    bgImage: {
        flex: 1
    },
    safeArea: {
        flex: 1, 
        width: '100%',
        justifyContent: 'center',
    }
});

export default Background;
about 4 years ago · Juan Pablo Isaza
3 answers
Answer question

0

if you're using hex for color you can follow the color code for transparency here https://gist.github.com/lopspower/03fb1cc0ac9f32ef38f4

about 4 years ago · Juan Pablo Isaza Report

0

On the Tab.Navigator use a prop called "sceneContainerStyle" and set backgroundColor to transparent

An example below.

<ImageBackground style={{flex: 1}} source={{ uri: "https://reactjs.org/logo-og.png" }} resizeMode="cover">
        <Tab.Navigator
        sceneContainerStyle={{backgroundColor: 'transparent',}}
        screenOptions={({ route }) => ({
            tabBarStyle: {
                backgroundColor: 'transparent',
            },
        })}>
        <Tab.Screen name="Home" component={Test} options={{ 
            headerStyle: { backgroundColor: 'transparent' } , 
        }} />
        </Tab.Navigator>
    </ImageBackground>

What you need to do

sceneContainerStyle={{backgroundColor: 'transparent',}}

Attaching an image of the end result

enter image description here

about 4 years ago · Juan Pablo Isaza Report

0

Use rgba value for your background color: for example: rgba(255, 255, 255, 0.2) where 0.2 is the opacity range from 0 to 1

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!