/
githubmr
/
facebook-react-native
Обзор
Документация
Войти
/
githubmr
/
facebook-react-native
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
main
packages/react-native/Libraries/Core/ReactNativeVersion.js
49 строк
1 KB
Alex Hunt
Expose ReactNativeVersion API (#52784)
23 июл 2025, 18:28
23 июл 2025, 18:28
ec5638a
Код
Авторство
О чём код?
/** * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * * @flow strict * @noformat * @generated by scripts/releases/set-version.js */ /** * Object containing the current React Native version. * * Specifically, this is the source of truth for the resolved `react-native` * package in the JavaScript bundle. Apps and libraries can use this to * determine compatibility or enable version-specific features. * * @example * ```js * // Get the full version string * const version = ReactNativeVersion.getVersionString(); * * // Access individual version components * const major = ReactNativeVersion.major; * ``` */ export default class ReactNativeVersion { static major: number = 1000; static minor: number = 0; static patch: number = 0; static prerelease: string | null = null; static getVersionString(): string { return `${this.major}.${this.minor}.${this.patch}${this.prerelease != null ? `-${this.prerelease}` : ''}`; } } /** * @deprecated Compatibility export — please import `ReactNativeVersion` from * `react-native`. * See https://github.com/react-native-community/discussions-and-proposals/pull/894. */ export const version = { major: ReactNativeVersion.major, minor: ReactNativeVersion.minor, patch: ReactNativeVersion.patch, prerelease: ReactNativeVersion.prerelease, };