useLocaleContext

Respond to locale and writing direction changes from ancestors.

The return value matches the current locale and writing direction of the ancestral tree. The value will be updated for descendants when setting the dir or lang prop on an element.

import { useLocaleContext } from 'react-native';
const { direction, locale } = useLocaleContext();

API

Return value

useLocaleContext returns the locale context.

direction "ltr" | "rtl"

A string representing the writing direction context.

locale ?string

The locale context. Locale is null if a new direction context is set without an associated locale.

Updated
Edit
React Native for WebCopyright © Nicolas Gallagher and Meta Platforms, Inc.