Files
stack/packages/mosaic/framework/skills/vercel-react-native-skills/rules/imports-design-system-folder.md
T
fargo 1a822493ba format: apply repo prettier (3.8.1) to the folded skills tree
963 markdown files reformatted with the repository's pinned prettier so
pnpm format:check covers the folded tree like every other repo file.

The formatter's embedded-language pass also normalized code fences
(TS semicolons, closed HTML tags in examples, lowercased CSS hex colors,
one renumbered list that skipped an index). Alphanumeric token deltas vs
the fold commit were audited file-by-file; all are formatter-equivalent
markup normalizations plus the four sanitized skills.
2026-08-19 14:37:17 -05:00

1.4 KiB

title, impact, impactDescription, tags
title impact impactDescription tags
Import from Design System Folder LOW enables global changes and easy refactoring imports, architecture, design-system

Import from Design System Folder

Re-export dependencies from a design system folder. App code imports from there, not directly from packages. This enables global changes and easy refactoring.

Incorrect (imports directly from package):

import { View, Text } from 'react-native';
import { Button } from '@ui/button';

function Profile() {
  return (
    <View>
      <Text>Hello</Text>
      <Button>Save</Button>
    </View>
  );
}

Correct (imports from design system):

// components/view.tsx
import { View as RNView } from 'react-native';

// ideal: pick the props you will actually use to control implementation
export function View(props: Pick<React.ComponentProps<typeof RNView>, 'style' | 'children'>) {
  return <RNView {...props} />;
}
// components/text.tsx
export { Text } from 'react-native';
// components/button.tsx
export { Button } from '@ui/button';
import { View } from '@/components/view';
import { Text } from '@/components/text';
import { Button } from '@/components/button';

function Profile() {
  return (
    <View>
      <Text>Hello</Text>
      <Button>Save</Button>
    </View>
  );
}

Start by simply re-exporting. Customize later without changing app code.