In the current recommended setup, which package should be installed to implement a Stack Navigator?
4 phương ánCó giải thích
Các phương án trả lời
Chọn một phương ánLời giảiChọn phương án để mở
Đáp án đúng: "@react-navigation/native-stack". Tài liệu React Navigation hiện nay khuyến nghị createNativeStackNavigator từ gói @react-navigation/native-stack, vì nó dùng chính thành phần điều hướng gốc của nền tảng (UINavigationController trên iOS, Fragment trên Android) nên chuyển màn mượt và hiệu năng tốt; cài kèm @react-navigation/native và react-native-screens. "@react-navigation/stack" là stack dựng bằng JavaScript: vẫn dùng được và cho tuỳ biến hoạt ảnh linh hoạt hơn, nhưng chạy hoạt ảnh phía JS nên không phải lựa chọn mặc định được đề xuất. "@react-navigation/drawer" tạo ngăn kéo trượt ra từ cạnh màn hình (Drawer Navigator), không phải ngăn xếp màn hình. "@react-navigation/bottom-tabs" tạo thanh tab dưới đáy để chuyển giữa các màn hình ngang hàng, cũng không phải Stack Navigator.
Cùng chương 5
Consider the following component using useIsFocused and useEffect. What will be the behavior if the component is initially unfocused and then gets focused?
import React, { useEffect } from 'react';
import { Text } from 'react-native';
import { useIsFocused } from '@react-navigation/native';
function ProfileScreen() {
const isFocused = useIsFocused();
useEffect(() => {
if (isFocused) {
console.log('ProfileScreen is now focused');
}
}, [isFocused]);
return <Text>Profile Screen</Text>;
}Có lời giảiCâu hỏiWith hook in React Navigation, what will happen if you call useFocusEffect inside a functional component but provide an empty dependency array?Có lời giảiCâu hỏiIn React Navigation, which hook should you use to get access to route parameters inside a functional component?Có lời giảiCâu hỏiCả 24 câu của chủ đề24 câu