This documentation site showcases the components we are building for React Native, providing examples, usage guidelines, and API references.
NativeCN is a collection of React Native components designed to help developers build beautiful mobile applications more efficiently, inspired by shadcn/ui. This documentation provides detailed information about each component, including:
- Component examples
- Usage guidelines
- API references
- Implementation details
First, run pnpm i to install the dependencies.
Then, run pnpm dev to start the development server and visit localhost:3000.
When developing components for NativeCN, keep these important guidelines in mind:
-
Handle undefined props safely: Always include null checks when accessing nested properties based on props like
modeorvariant. This prevents errors when components are loaded directly or when context values aren't immediately available. -
Provide fallback values: For components that rely on context values, always provide sensible defaults when the context might be undefined.
-
Defensive styling access: When accessing style objects with dynamic keys (like
buttonClassNames[${mode}variant${variant}]), use conditional checks to ensure the key exists before accessing. -
Handle server-side rendering: Components should work properly during SSR when certain browser-specific APIs or context values might not be available.
These practices help ensure components remain robust across different navigation patterns and loading scenarios.
This documentation site is built using Nextra, a Next.js-based documentation framework. The original template was created by Shu Ding.
This project is licensed under the MIT License.