Native Modules & Bridge
Native modules, Turbo Modules, JSI, bridging iOS/Android, third-party modules
1What is a native module in React Native?
What is a native module in React Native?
Câu trả lời
A native module is a piece of code written in native language (Objective-C/Swift for iOS, Java/Kotlin for Android) that exposes functionalities to JavaScript code. This allows accessing native APIs not directly available in React Native, such as biometric sensors or Bluetooth.
2What is the role of the bridge in React Native's traditional architecture?
What is the role of the bridge in React Native's traditional architecture?
Câu trả lời
The bridge is the communication mechanism between the JavaScript thread and native threads in the traditional architecture. It serializes data to JSON to transfer it asynchronously between both environments. This asynchronous communication can create latency for frequent operations.
3How to expose a native method to JavaScript on iOS with the old architecture?
How to expose a native method to JavaScript on iOS with the old architecture?
Câu trả lời
On iOS with the old architecture, you need to create a class that inherits from NSObject and implements the RCTBridgeModule protocol. The RCT_EXPORT_MODULE() macro registers the module, and RCT_EXPORT_METHOD() exposes each method to JavaScript. These macros generate the necessary bridging code.
Which annotation to use to expose a native method on Android with the old architecture?
What is JSI (JavaScript Interface) in React Native's new architecture?
+17 câu hỏi phỏng vấn
Các chủ đề phỏng vấn React Native khác
JavaScript Essentials
React Fundamentals
React Native Basics
React Hooks
TypeScript for React & React Native
React Native Components & API
React Native Styling & Layout
React Native Navigation
React Native State Management
React Native Networking & API
Data Persistence
Forms & Validation
React Native Animations
Platform-Specific Code
Permissions & Device APIs
Push Notifications
React Native Testing
React Native Debugging
Build & Deployment
Expo vs React Native Bare
Performance Optimization
Memory Management
Architecture Patterns
React Native New Architecture
Security Best Practices
Offline-First Architecture
React Native CI/CD
Monorepo & Code Sharing
Advanced Topics
App Lifecycle & Background Execution
Authentication & Session Management
Monitoring & Crash Reporting
Nắm vững React Native cho lần phỏng vấn tiếp theo
Truy cập tất cả câu hỏi, flashcards, bài kiểm tra kỹ thuật, bài tập code review và mô phỏng phỏng vấn.
Bắt đầu miễn phí