Ant Design Mobile RN

repository·master·Indexed 25 days ago

https://github.com/ant-design/ant-design-mobile-rn

A configurable Mobile UI specification and React-based implementation for React Native based on Ant Design Mobile UI standards. The library supports both web and native usages and provides a comprehensive set of components including Form, Input, Collapse, and Toast, as well as hooks like useToast and useModal. Version 5.4.0 and later requires a minimum react-native version of 0.67.5.

Tokens
81.6K
Snippets
161
Records
560
Agent score
85%

What's inside @ant-design/react-native

  1. Use InputItem for single-line text input

    master

    The InputItem component is used for single-line text entry. It supports keyboard and clipboard input, cursor movement, and specialized formatting like password masking.

    Important: InputItem must be wrapped in a List component to function correctly.

    Note: This component is marked as ARCHIVE (version 5.2.1 and later). It is recommended to use the Input component instead.

  2. Understand the Headless UI pattern in Ant Design Mobile RN

    master

    Ant Design Mobile RN utilizes a 'Headless UI' pattern for certain components (like Slider) to provide greater flexibility than traditional prop-based styling.

    Key Advantages:

    • Granular Styling: Instead of passing a single styles object to a parent component, each sub-element (Track, Range, Thumb) can be styled independently using style or className. This makes it compatible with tools like Tailwind CSS or animation libraries.
    • Composition over Props: Features like 'range mode' (dual thumbs) are implemented by adding or removing React elements (e.g., adding a second <Slider.Thumb />) rather than toggling a boolean prop.
    • Extensibility: You can inject custom elements (like a <View> containing text) directly into the component tree (e.g., inside the <Slider.Track>), which is not possible with the standard prop-based API.
    • Transparency: The component structure is exposed, allowing for easier customization and extension.