79224475

Date: 2024-11-25 20:14:43
Score: 0.5
Natty:
Report link

Find it!

Inside each child Tabs.Screen we can add a sceneStyle, and it seems that the scene is the content.

import '../../global.css';
import HeaderDefault from '@/components/header/default';
import { Tabs } from 'expo-router';
import React from 'react';
import { SafeAreaProvider } from 'react-native-safe-area-context';
import { UINotificationToast } from '@/components/ui/notification/Toast';
import { View } from 'react-native';

export default function ContextLayout() {

  return (
    <SafeAreaProvider>
      <View
        style={{ flex: 1, backgroundColor: '#FF0000' /* Red background */ }}
      >
        <Tabs
          screenOptions={{
            header: ({ route }) => <HeaderDefault alignLeft={true} />,
            tabBarStyle: {
              backgroundColor: '#FBFFFE',
            },
          }}
        >
          <Tabs.Screen 
            name='dashboard' 
            options={{
              sceneStyle: {
                backgroundColor: 'red', // This what you want
              },
            }}
          />
        </Tabs>
      </View>
      <UINotificationToast />
    </SafeAreaProvider>
  );
}

Only the content is red

Reasons:
  • Probably link only (1):
  • Long answer (-1):
  • Has code block (-0.5):
  • Self-answer (0.5):
  • Low reputation (0.5):
Posted by: Raphael Rlt