React Native Website Documentation

repository·main·Indexed 24 days ago

https://github.com/react/react-native-website

Configuration and source documentation for the official React Native website (reactnative.dev). Built with Docusaurus, it includes tools for managing versioned documentation, blog posts, and custom Remark plugins such as remark-snackplayer for embedding interactive Expo Snacks and @react-native-website/lint-examples for linting Snack player examples.

Tokens
276.2K
Snippets
569
Records
1.4K
Agent score
79%

What's inside react-native-website

  1. What is Hermes and how to use it

    main

    Hermes is an open-source JavaScript engine optimized for React Native. It is designed to improve app start-up time, decrease memory usage, and reduce app size compared to JavaScriptCore.

    By default, React Native uses a bundled version of Hermes that is specifically built to be compatible with your version of React Native. No additional configuration is required to enable it.

  2. Overview of React Native Accessibility APIs

    main

    React Native provides a suite of APIs designed to make mobile applications accessible to assistive technologies, specifically targeting the bundled screen readers: VoiceOver on iOS and TalkBack on Android.

    Because Android and iOS have different underlying approaches to accessibility, React Native implementations may vary depending on the platform. Developers should use these APIs to ensure their apps accommodate all users by providing semantic information to these screen readers.

  3. Use Android-specific Components and APIs

    main

    React Native provides wrappers for common Android classes to handle platform-specific functionality:

    • BackHandler: Detect hardware button presses for back navigation.
    • DrawerLayoutAndroid: Renders a DrawerLayout on Android.
    • PermissionsAndroid: Provides access to the Android M permissions model.
    • ToastAndroid: Creates an Android Toast alert.
  4. Understand the React Native Architecture Glossary

    main
    This glossary defines the core architectural concepts used in React Native, distinguishing between the JavaScript-side abstractions (like React Elements and Components) and the native-side implementations (like Host Views and the Fabric Renderer). Understanding these terms is essential for debugging performance, layout issues, and bridge/JSI communication.
  5. Highlights and Platform updates in React Native 0.69

    main

    Notable updates in this release include:

    • iOS/tvOS: Support for SDK 11.0 is deprecated; version 12.4+ is now required.
    • iOS Debugging: Added a new hotkeysEnabled option in the iOS debug menu.
    • iOS Configuration: Added a new .xcode.env configuration file for more deterministic sourcing of the node executable.
    • Android: Better support for M1 users developing for Android.
    • C++: Added support for C++17.
  6. Lint Snack player examples with @react-native-website/lint-examples

    main
    The @react-native-website/lint-examples script is used to lint Snack player examples. It simulates a linting environment as if the examples were part of a newly built React Native project. When linting is performed, any changes made by the linter are automatically patched back into the original source document.
  7. Use codeblockLanguageAsTitleRemarkPlugin to automate code block titles

    main

    The codeblockLanguageAsTitleRemarkPlugin is a custom remark plugin designed for Markdown processing. It automatically populates the title metadata of a code block using the language identifier specified in the code block's fence.

    Key behaviors:

    • Automatic Title Assignment: If a code block has a language (e.g., js, python), the plugin sets the title metadata to that language name.
    • Metadata Preservation: If a code block already has metadata (meta) but is missing a title, the plugin appends the title while keeping the existing metadata intact.
    • No Overwriting: If the meta field already contains a title property, the plugin skips that block to prevent overwriting user-defined titles.
  8. Explore React Native on Desktop platforms

    main

    React Native support for desktop is primarily driven by react-native-windows and react-native-macos (maintained by Microsoft).

    Key developments for desktop include:

    • Code Sharing: The move toward C++ modules within the New Architecture aims to increase code sharing between macOS and Windows, reducing the need for bespoke implementations for each platform.
    • Community Module Support: Software Mansion is actively working on adding desktop support for high-demand modules, specifically:
      • react-native-screens
      • react-native-gesture-handler
      • react-native-reanimated
    • Adoption Goals: Efforts are being made to improve workflows (e.g., Visual Studio integration) and support Expo on desktop platforms.
  9. Use the Text component for displaying text

    main

    The Text component is used to display text in React Native. It supports nesting, styling, and touch handling. Unlike web development where text can exist directly inside a View, in React Native, all text nodes must be wrapped in a <Text> component. Placing a raw text node directly under a <View> will raise an exception.

    To maintain consistent typography across an app, it is recommended to create a custom wrapper component (e.g., MyAppText) that applies default styles, rather than relying on global CSS-like inheritance which is not supported.

    <View>
      <Text>
        Some text
      </Text>
    </View>
  10. Understand the React Native website directory structure

    main

    The website is a static site generated using Docusaurus. The content and configuration are organized as follows:

    • docs/: Contains the source markdown files for the versioned documentation (Guides, Components, and APIs).
    • website/architecture/: Contains unversioned/static documentation for the Architecture tab.
    • website/blog/: Contains blog posts.
    • website/contributing/: Contains documentation for the Contribution tab.
    • website/core/: Contains custom JavaScript and React components used by the site.
    • website/src/css/: Contains custom styles.
    • website/src/pages/: Contains React components for non-documentation pages (e.g., the homepage).
    • website/src/theme/: Contains swizzled Docusaurus theme components.
    • website/static/: Contains static assets (images, blog assets, etc.).
    • website/versioned_docs/: Auto-generated files for older versions of the documentation.
    • website/versioned_sidebars/: Auto-generated sidebar configurations for older versions.
    • website/docusaurus.config.ts: The main Docusaurus configuration file.
    • website/sidebars.ts, website/sidebarsArchitecture.ts, website/sidebarsContributing.ts: Files used to define the order of documents in the sidebars.
  11. Understand the experimental status of New Architecture documentation

    main

    The documentation regarding the React Native New Architecture is currently experimental. Details are subject to change as the architecture iterates.

    Users should be aware that the current documentation involves several manual steps that may not be representative of the final developer experience. The React Native team is actively working on tools, templates, and libraries to automate and simplify the setup process once the New Architecture reaches stability.