Import from Design System Folder
Import from Design System Folder
Section titled “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):
import { View as RNView } from 'react-native'
// ideal: pick the props you will actually use to control implementationexport function View( props: Pick<React.ComponentProps<typeof RNView>, 'style' | 'children'>) { return <RNView {...props} />}export { Text } from 'react-native'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.