# General Translation React SDKs (gt-react, gt-next): React Native URL: https://generaltranslation.com/zh/docs/react/react-native.mdx --- title: React Native description: 了解 General Translation 在 React Native 中的专属设置,包括模块级初始化、provider 和 polyfill 插件。 --- `gt-react-native` 将 General Translation 带到了 React Native 应用中,包括 Expo 和 bare React Native CLI。它与 React 生态中的其他部分共用同一个 [``](/docs/react/reference/components/t) 组件、钩子和 variable components,但在设置上有一些 React Native 特有的区别:你需要在模块级进行初始化,provider 会自行加载翻译,而 Babel 插件则会补上 React Native 缺失的 `Intl` polyfills。 如果你刚开始使用,请先阅读 [React Native Quickstart](/docs/react/react-native-quickstart)。通用的[指南](/docs/react/guides/configuring)和[Reference](/docs/react/reference/config)涵盖了各框架中相同的用法;此处的页面则专门介绍 React Native 独有的设置。 *警告:`gt-react-native` 仍处于实验阶段,可能并不适用于所有项目。它包含原生模块,因此不支持 Expo Go——你需要使用 development build。* ## React Native 特有的内容 [#overview] * **模块级设置。** 你只需在应用的入口文件中调用一次 [`initializeGT`](/docs/node/reference/functions/initialize-gt),而 [``](/docs/react/reference/components/gt-provider) 会在内部加载翻译,无需传入 `locale` 和 `translations` 属性。参见 [设置](/docs/react/react-native/setup)。 * **polyfill 插件。** `gt-react-native/plugin` 会注入 React Native 运行时默认不包含的 `@formatjs` `Intl` polyfill。参见 [插件](/docs/react/react-native/plugin)。 此外,React Native 也没有预置的 [``](/docs/react/reference/components/locale-selector) 组件——请改用 [`useLocaleSelector`](/docs/react/reference/hooks/use-locale-selector) 钩子来构建语言切换器。 ## 页面 [#pages] | 页面 | 描述 | | ------------------------------------- | ------------------------------------------------------------------- | | [设置](/docs/react/react-native/setup) | 在 Expo 和原生 React Native 应用中初始化 General Translation,并添加 Provider 组件。 | | [插件](/docs/react/react-native/plugin) | `gt-react-native/plugin` Babel 插件,用于提供 `Intl` polyfill。 |