showing results for - "react native different status bar configuration based on route"
Cristina
01 Mar 2018
1import * as React from 'react';
2import { Text, StatusBar, Button, StyleSheet } from 'react-native';
3import { NavigationContainer } from '@react-navigation/native';
4import { createStackNavigator } from '@react-navigation/stack';
5import { SafeAreaProvider } from 'react-native-safe-area-context';
6import SafeAreaView from 'react-native-safe-area-view';
7
8function Screen1({ navigation }) {
9  return (
10    <SafeAreaView style={[styles.container, { backgroundColor: '#6a51ae' }]}>
11      <StatusBar barStyle="light-content" backgroundColor="#6a51ae" />
12      <Text style={{ color: '#fff' }}>Light Screen</Text>
13      <Button
14        title="Next screen"
15        onPress={() => navigation.navigate('Screen2')}
16        color="#fff"
17      />
18    </SafeAreaView>
19  );
20}
21
22function Screen2({ navigation }) {
23  return (
24    <SafeAreaView style={[styles.container, { backgroundColor: '#ecf0f1' }]}>
25      <StatusBar barStyle="dark-content" backgroundColor="#ecf0f1" />
26      <Text>Dark Screen</Text>
27      <Button
28        title="Next screen"
29        onPress={() => navigation.navigate('Screen1')}
30      />
31    </SafeAreaView>
32  );
33}
34
35const Stack = createStackNavigator();
36
37export default function App() {
38  return (
39    <SafeAreaProvider>
40      <NavigationContainer>
41        <Stack.Navigator headerMode="none">
42          <Stack.Screen name="Screen1" component={Screen1} />
43          <Stack.Screen name="Screen2" component={Screen2} />
44        </Stack.Navigator>
45      </NavigationContainer>
46    </SafeAreaProvider>
47  );
48}
49
50const styles = StyleSheet.create({
51  container: { flex: 1, justifyContent: 'center', alignItems: 'center' },
52});
queries leading to this page
status bar react navigation react navigation hide status barreact native different status bar configuration based on routeapp navigation option status barstatus bar react navigation v5react native react navigation custom status barstatus bar color set to last tab react nativern tab navigator barstyle text colorhow to change status bar dynamically react nativereact navigation statusreact native custom header is under status barreact native header status bar colorplace content under status bar react naviheader and status bar custom in react nativecontrolling toolbar color according to route in reactreact navigation status barreact native statusbar inside react navigationreact native react navigation status barstack navigation version 5 hiding the status bar in iosstack navigator change status bar colorreact native hidden status bar stacknavigatorreact navigation hiding phone batteryreact navigation status bar colorstatusbar color navigation reactreact navigation barstyle optionsreact navigation status bar not showingcreatestacknavigator covers status barreact navigation full screen modal status bar colorrn navigation barstyle text colorreact apply statusbar with navigator colorreact navigation top tab bar status barput status bar under drawer react nativereact native stack navigator changing status barreact navigation status bar color for all screensstatusbar react native page spefichow to display status bar in react native while doing routing 3fstatus bar color change base on routertoggle status bar react navigationstack screen status bar nonrwhere to put status bar settings react nativereact navigation drawer hide status barreact native statusbar changes on navigationreact navigation change color statusbar on screenreact navigation header statusbardifferent pages on a website react nativehide status bar react navigationset status bar switch reactstatus bar from react websitetab navigator on status barreact native navigation status bar colorreact bottom tab navigation statusbar colorreact navigation status barstatus bar react navigationstack screen option status barreact native component with navigation and statusbarhow to locate where a status bar componet was defined react nativedifferent status bar configuration based on route 7c react navigationhow to change default browser for react nativechange status bar react navigationreact navigation black top barreact navigation set status bar colorreact navigation 5 drawer and top barreact native different status bar configuration based on route