6636
Web Development

Understanding React Native 0.80: A Shift Toward a Stable JavaScript API

Posted by u/Codeh3 Stack · 2026-05-03 15:39:02

React Native 0.80 introduces two crucial improvements to its JavaScript API: the deprecation of deep imports and the introduction of an opt-in Strict TypeScript API. These changes aim to stabilize the public interface, reduce unexpected breakages, and provide reliable type safety. Below, we answer common questions about these updates and how they affect your codebase.

1. What are the major API changes in React Native 0.80?

React Native 0.80 marks a significant step toward a more predictable and stable JavaScript API. The first change is the deprecation of deep imports—importing directly from subpaths like react-native/Libraries/Alert/Alert. These imports have been a source of fragility because internal module paths can change without notice. The second change is the introduction of an opt-in Strict TypeScript API. Instead of relying on community-maintained type definitions that often lag behind the actual code, React Native now generates TypeScript types directly from its source. This reduces correctness gaps and ensures that your TypeScript experience matches the runtime behavior more accurately. Both changes are part of a broader effort to define a clear, stable public surface for react-native exports.

Understanding React Native 0.80: A Shift Toward a Stable JavaScript API

2. Why is the team deprecating deep imports?

Deep imports—like import { Alert } from 'react-native/Libraries/Alert/Alert'—bypass the official public API and reach into internal implementation details. Historically, these paths were accessible but not guaranteed to remain stable. As React Native’s internals evolved, deep imports frequently broke, causing frustration for developers. By deprecating them in 0.80 and planning for removal in 0.82, the team is reducing the total surface area of the JavaScript API. This means only a fixed set of top-level exports will be officially supported, making it easier to maintain backward compatibility and document the API. Developers are encouraged to switch to root-level imports like import { Alert } from 'react-native'. The deprecation warnings appear both in ESLint and the JavaScript console, giving ample time to adapt.

3. What is the Strict TypeScript API and how does it work?

The Strict TypeScript API is a new, opt-in system that generates TypeScript type definitions directly from React Native’s internal source code (written in Flow). Previously, the community manually maintained type definitions, which often introduced inconsistencies and missing types. With this new approach, types are automatically derived, resulting in stronger accuracy and better alignment with the actual runtime. Developers enable the Strict TypeScript API by adding a compilerOptions entry in their tsconfig.json. This is a one-time breaking change, but once activated, your project benefits from more reliable autocompletion, error checking, and future-proof type definitions. The team plans to make this the default in a future release after gathering community feedback.

4. How should I update my imports to comply with 0.80?

If you currently use deep imports like import { Alert } from 'react-native/Libraries/Alert/Alert', replace them with root imports: import { Alert } from 'react-native'. The same applies to types. For example, change import type { ViewStyle } from 'react-native/Libraries/StyleSheet/StyleSheetTypes' to import { ViewStyle } from 'react-native' (or the appropriate root-exported type). The team provides ESLint warnings to help identify such patterns. Start by running your linting tools and fixing the flagged imports. Some APIs that were previously only accessible via deep imports may not yet be included in the root exports. For those, check the feedback thread to report missing exports. The goal is to consolidate all public members under the react-native package root, making your imports cleaner and more resilient.

5. What happens if an API is not exported at the root level?

Some APIs that were only reachable through deep imports will become unavailable once deep imports are removed. The React Native team recognizes this as a potential pain point and has opened a community feedback thread to identify which APIs should be added to the public surface. If you rely on an internal API that isn't exported at the root, please share your use case in that thread. The team will evaluate each request and, where appropriate, add those APIs to the stable exports. Until then, you may need to temporarily keep the deep import or work around it, but the long-term direction is clear: only root-level imports will be supported. This ensures that the public API is deliberate and maintainable.

6. When will deep imports be fully removed?

Deep imports are deprecated starting in React Native 0.80, with deprecation warnings already active. The team plans to completely remove these import paths in version 0.82. That gives developers two major releases (approximately four to six months) to migrate their code. During this period, the deprecation warnings will help you catch problematic imports. It is strongly recommended to fix all warnings as soon as possible, especially if your project relies on many internal modules. Waiting until 0.82 could mean breaking changes that require urgent updates. The early migration also ensures that your codebase aligns with the new, stable API surface, which will be easier to maintain and upgrade in the future.

7. How do I opt in to the Strict TypeScript API?

To enable the Strict TypeScript API, you need to modify your tsconfig.json file. Add a compilerOptions entry that explicitly opts into the new type system. The exact configuration setting is described in the React Native 0.80 release notes under the “Strict TypeScript API” section. Once enabled, your project will start using the generated TypeScript types from the React Native source, rather than the legacy community-maintained types. Note that this is a one-time breaking change because the new types may differ slightly from the old ones. After activation, you might see new type errors that were previously hidden—fixing these will improve the type safety of your app. The team recommends opting in after reviewing the migration guide and testing your project thoroughly.

8. What is the long-term goal of these changes?

The ultimate objective is to provide a stable, well-defined JavaScript API for React Native. By deprecating deep imports, the team reduces the surface area to a manageable set of exports that can be documented and guaranteed. The Strict TypeScript API ensures that type definitions are accurate and automatically synchronized with the actual code, eliminating the maintenance burden on the community. Together, these changes lay the groundwork for future releases where the public API will remain backward-compatible for longer periods. Developers can expect fewer unexpected breakages and a more predictable upgrade path. The team also hopes to enable the Strict TypeScript API by default in a future release, making TypeScript support first-class out of the box. This stability will benefit not only individual apps but also frameworks (like Expo) and libraries that depend on React Native.