“bereaksi judul header perubahan navigasi asli” Kode Jawaban

bereaksi header navigasi asli benar

screenOptions={({route, navigation}) => ({ // transform screenOptions to a function
   headerRight: () => (
      <Button
        onPress={() => navigation.navigate('Home'); 
      />
    )
  })}
Alexandre Dao

bereaksi judul header perubahan navigasi asli

 componentDidMount() {
   this.props.navigation.setOptions({
     title: `Your Updated Title`,
   })
 }
Sleepy Sardine

ReactNaviataion perubahan judul

import * as React from 'react';
import { View, Text, Button } from 'react-native';
import { NavigationContainer } from '@react-navigation/native';
import { createStackNavigator } from '@react-navigation/stack';

function HomeScreen({ navigation }) {
  return (
    <View style={{ flex: 1, alignItems: 'center', justifyContent: 'center' }}>
      <Text>Home Screen</Text>
      <Button
        title="Go to Profile"
        onPress={() =>
          navigation.navigate('Profile', { name: 'Custom profile header' })
        }
      />
    </View>
  );
}

function ProfileScreen({ navigation }) {
  return (
    <View style={{ flex: 1, alignItems: 'center', justifyContent: 'center' }}>
      <Text>Profile screen</Text>
      <Button title="Go back" onPress={() => navigation.goBack()} />
    </View>
  );
}

const Stack = createStackNavigator();

function App() {
  return (
    <NavigationContainer>
      <Stack.Navigator>
        <Stack.Screen
          name="Home"
          component={HomeScreen}
          options={{ title: 'My home' }}
        />
        <Stack.Screen
          name="Profile"
          component={ProfileScreen}
          options={({ route }) => ({ title: route.params.name })}
        />
      </Stack.Navigator>
    </NavigationContainer>
  );
}

export default App;
Dull Dugong

Jawaban yang mirip dengan “bereaksi judul header perubahan navigasi asli”

Pertanyaan yang mirip dengan “bereaksi judul header perubahan navigasi asli”

Lebih banyak jawaban terkait untuk “bereaksi judul header perubahan navigasi asli” di JavaScript

Jelajahi jawaban kode populer menurut bahasa

Jelajahi bahasa kode lainnya