App Lifecycle & Background Execution
AppState, foreground/background transitions, headless JS, background fetch, deep links, universal links
1What are the three possible states returned by AppState.currentState in React Native?
What are the three possible states returned by AppState.currentState in React Native?
Antwort
AppState.currentState returns one of three states: 'active' (app is in the foreground and interactive), 'background' (app is in the background but potentially running) and 'inactive' (transitional state on iOS, for example when displaying the multitasking view). On Android, 'inactive' state is rare as the transition goes directly between 'active' and 'background'.
2Which method should be used to listen for application state changes with AppState?
Which method should be used to listen for application state changes with AppState?
Antwort
The AppState.addEventListener('change', callback) method allows listening for application state changes. The callback receives the new state ('active', 'background' or 'inactive') as a parameter. It is important to remove the listener using the remove() method returned by addEventListener during cleanup to avoid memory leaks.
3When does the 'inactive' state typically occur on iOS?
When does the 'inactive' state typically occur on iOS?
Antwort
The 'inactive' state on iOS occurs during brief transitions: displaying the control center, notification center, multitasking screen (double tap Home), or during an incoming call. It is an intermediate state where the app is visible but not interactive. On Android, this state is rarely observed as the transition between 'active' and 'background' is direct.
How to correctly implement an AppState listener in a useEffect?
What is a Headless JS Task in React Native?
+17 Interview-Fragen
Weitere React Native-Interviewthemen
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
Native Modules & Bridge
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
Authentication & Session Management
Monitoring & Crash Reporting
Meistere React Native für dein nächstes Interview
Zugang zu allen Fragen, Flashcards, technischen Tests, Code-Review-Übungen und Interview-Simulatoren.
Kostenlos starten