useEnvironment function provides access to the current environment context, including configuration values, system information, and runtime-specific data.
Parameters
NoneReturns
Returns the current environment object (EnvironmentValues) with the following properties:
The current color scheme setting.
The display scale factor for high-resolution displays.
The user’s preferred text size setting for accessibility.
The current locale/language setting (e.g., “en-US”, “fr-FR”).
Text and UI layout direction.
The screen dimensions object containing width and height properties.
The current platform identifier (e.g., “ios”, “android”, “web”).
Function to open URLs with an optional success callback.
Additional custom environment values that may be set by the host application.
Usage
Accessing environment data
Notes
- The environment is set by the runtime and can be customized by the host application
- Default environment includes an
openURLfunction for external link handling - Environment values are shared across all components in the same runtime instance
- Changes to environment typically require runtime reinitialization
- Use environment for feature flags, platform detection, and runtime configuration
