Describe a situation where a developer would benefit from creating a Native Module for a React Native app.
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: "A developer needs to integrate fingerprint authentication, which requires access to native device APIs for both iOS and Android. By implementing this as a Native Module, they can efficiently leverage platform-specific APIs to provide secure authentication without compromising performance.". Native Module đáng làm khi ứng dụng cần một khả năng của nền tảng mà JavaScript không tự truy cập được; xác thực vân tay phải gọi API sinh trắc học riêng của từng hệ điều hành (BiometricPrompt trên Android, LocalAuthentication trên iOS), nên viết module gốc rồi đưa ra một hàm chung cho JavaScript là lựa chọn hợp lý. Tình huống "center-align text in their app" sai vì căn giữa chữ chỉ cần textAlign: 'center' trong style. Tình huống "add a button with a color change on press" sai vì Pressable hay TouchableOpacity cùng state đã làm được, không cần mã gốc. Tình huống "to handle static images, even though no platform-specific functionality is needed" sai vì component Image với require đã hiển thị ảnh tĩnh, và chính mô tả cho biết không cần tính năng riêng của nền tảng.
Cùng chương 1
Ordering steps in the process of how React Native works in Bridge architecture:
1.The main cable starts working and starts loading JavaScript loads
2.Produces a new DOM (structure) and sends changes to Shadow cable
3.If the JavaScript code is successfully uploaded, the main thread sends it to another JavaScript thread
4.Main thread is able to render something on the screen
5.The shadow string calculates the structure and sends the parameters/properties of the structure to the main sequenceCó lời giảiCâu hỏiReact Native uses the following tech stack to build cross-platform native apps:Có lời giảiCâu hỏiHow does React Native differ from React.js in terms of rendering components?Có lời giảiCâu hỏiCả 54 câu của chủ đề54 câu