Platform Detection
Detect Meta Quest devices to conditionally run platform-specific code.
Using expo-horizon-core
The expo-horizon-core package provides device detection:
React Hook Example
Create a custom hook for platform detection:
Conditional Rendering
Use platform detection to conditionally render components:
Conditional Styling
Adjust styles for Quest:
Feature Availability Checks
Some libraries provide feature checks:
SMS
Sensors
Platform Utilities
Create utility functions for common platform checks:
Best Practices
- Check at runtime: Don't assume platform at build time
- Graceful degradation: Provide fallbacks for unsupported features
- Clear error messages: Inform users when features aren't available
- Test on device: Always test platform detection on actual Quest hardware
