@evlop/native-components

中文文档
1.0.302发布于 2026/10/30ISCTypeScriptCommonJS零依赖近 30 天下载 2835

A collection of React Native components with styled-system integration for building beautiful, consistent UI. These components are designed for use with AI-powered code generation tools.

原始使用文档
文档目录16 节
  1. Installation
  2. Quick Start
  3. Components & Use Cases
  4. 📦 Box
  5. 🧩 Flexbox
  6. ✏️ Text
  7. 🎨 Icon
  8. 🔘 Button
  9. 👆 Actionable
  10. 🖼️ Image
  11. 🖼️ ImageBackground
  12. 🎠 Swiper
  13. 📳 triggerHapticFeedback
  14. Styled System Props Reference
  15. Theme Integration
  16. License

Native Components

A collection of React Native components with styled-system integration for building beautiful, consistent UI. These components are designed for use with AI-powered code generation tools.

Installation

npm install @evlop/native-components

Quick Start

import { Box, Flexbox, Text, Icon, Button, Actionable, Image, ImageBackground, Swiper, triggerHapticFeedback } from 'types-for-ai';

Components & Use Cases

📦 Box

A styled View component with support for layout, spacing, borders, colors, and positioning.

// Basic container
<Box padding={16} backgroundColor="white" borderRadius={8}>
  <Text>Content</Text>
</Box>

// Card with shadow effect
<Box 
  margin={16}
  padding={20}
  backgroundColor="white"
  borderRadius={12}
  borderWidth={1}
  borderColor="gray-200"
>
  <Text>Card Content</Text>
</Box>

// Absolute positioned overlay
<Box position="absolute" top={0} left={0} right={0} bottom={0} opacity={0.5} backgroundColor="black" />

Props: All React Native ViewProps + flexbox, border, layout, color, background, space, opacity, position


🧩 Flexbox

A flexbox container with default flexDirection: 'row' and gap support.

// Horizontal row with items
<Flexbox flexDirection="row" justifyContent="space-between" alignItems="center" gap={12}>
  <Icon icon="home" />
  <Text>Home</Text>
</Flexbox>

// Vertical stack
<Flexbox flexDirection="column" gap={8} padding={16}>
  <Text>Item 1</Text>
  <Text>Item 2</Text>
  <Text>Item 3</Text>
</Flexbox>

// Grid-like layout
<Flexbox flexWrap="wrap" gap={16} rowGap={8} columnGap={12}>
  {items.map(item => <Box key={item.id} width="48%">{item.name}</Box>)}
</Flexbox>

Props: All Box props + gap, rowGap, columnGap


✏️ Text

A styled text component with typography support, theme variants, and template rendering.

// Basic text
<Text color="gray-900" fontSize={16}>Hello World</Text>

// Styled heading
<Text fontWeight="Bold" fontSize={24} color="primary">
  Welcome Back!
</Text>

// Using theme variants
<Text variant="heading">Heading Text</Text>
<Text variant="body">Body text content</Text>

// Font scaling (relative to base font size)
<Text fontScale={1.5}>Larger Text</Text>

// Dynamic template content (supports handlebars)
<Text content="Hello, {{user.name}}!" />

Props: color, fontSize, fontWeight, fontScale, textAlign, variant, content + standard TextProps


🎨 Icon

Display icons from various icon libraries with RTL support.

// Basic icon
<Icon icon="home" size={24} color="primary" />

// Different sizes
<Icon icon="settings" size={32} color="gray-600" />

// With press handler
<Icon icon="close" onPress={() => navigation.goBack()} />

// RTL flip support (for directional icons like arrows)
<Icon icon="arrow-right" flipOnRTL />

// Supported icon libraries:
// - material-icons
// - material-community-icons
// - font-awesome-6
// - ionicons
// - simple-line-icons
// - evilicons
// - octicons
// - svg (custom SVG URLs)

Props: icon, size, color, flipOnRTL, onPress


🔘 Button

A styled button with multiple variants, sizes, loading states, and icon support.

// Filled button (default)
<Button label="Get Started" color="primary" action={myAction} />

// Outlined button
<Button label="Learn More" variant="outlined" color="secondary" />

// Ghost button (no background)
<Button label="Cancel" variant="ghost" color="gray-600" />

// Dim outlined (subtle border)
<Button label="Optional" variant="dim-outlined" color="primary" />

// Dim filled outlined (subtle background + border)
<Button label="Soft CTA" variant="dim-filled-outlined" color="primary" />

// With icon
<Button label="Add Item" icon="plus" iconPosition="left" color="primary" />
<Button label="Next" icon="arrow-right" iconPosition="right" />

// Different sizes
<Button label="Small" size="sm" />
<Button label="Medium" size="md" />
<Button label="Large" size="lg" />
<Button label="Extra Large" size="xl" />
<Button label="2X Large" size="2xl" />

// Loading state
<Button label="Submitting..." loading={true} />

// Disabled state
<Button label="Unavailable" disabled={true} />

Variants: filled, outlined, dim-outlined, dim-filled-outlined, ghost
Sizes: sm, md, lg, xl, 2xl
Props: label, variant, size, color, textColor, icon, iconPosition, loading, disabled, action


👆 Actionable

A pressable wrapper with press effects and haptic feedback support.

// Basic actionable area
<Actionable action={navigateAction}>
  <Text>Tap me</Text>
</Actionable>

// With scale press effect
<Actionable action={myAction} pressEffect="scale">
  <Box padding={16}><Text>Press to scale</Text></Box>
</Actionable>

// With opacity press effect
<Actionable pressEffect="opacity" action={myAction}>
  <Image src="card-image.jpg" />
</Actionable>

// With haptic feedback
<Actionable action={myAction} hapticFeedback="impactMedium">
  <Text>Haptic button</Text>
</Actionable>

// Combined effects
<Actionable 
  action={addToCartAction}
  pressEffect="bounce"
  hapticFeedback="impactLight"
>
  <Box backgroundColor="primary" padding={12} borderRadius={8}>
    <Text color="white">Add to Cart</Text>
  </Box>
</Actionable>

Press Effects:

  • none - No visual effect
  • opacity - Fades on press
  • scale - Shrinks slightly on press
  • scale-opacity - Combines scale and opacity
  • bounce - Bouncy spring effect
  • tilt-left / tilt-right - Tilts on press
  • pulse - Pulsing animation
  • jelly - Elastic jelly effect
  • rubberBand - Rubber band stretch effect
  • glow - Glowing highlight effect
  • press-in - 3D press-in effect
  • swing - Swinging rotation

Haptic Types: impactLight, impactMedium, impactHeavy, rigid, soft, notificationSuccess, notificationWarning, notificationError


🖼️ Image

A styled image component with preset sizes and template URL support.

// Basic image
<Image src="https://example.com/image.jpg" />

// Using preset sizes
<Image src="product.jpg" size="md" />
<Image src="avatar.jpg" size="xs" />
<Image src="banner.jpg" size="fluid" />

// Custom dimensions
<Image src="photo.jpg" width={200} height={150} />

// With aspect ratio
<Image src="video-thumb.jpg" aspectRatio={16/9} />

// Resize modes
<Image src="cover.jpg" resizeMode="cover" />
<Image src="contain.jpg" resizeMode="contain" />

// With placeholder fallback
<Image src="{{product.image}}" placeholder="default-product.jpg" />

// Dynamic URL with template
<Image src="{{baseUrl}}/images/{{product.id}}.jpg" />

Preset Sizes: 3xs (15px), 2xs (35px), xs (50px), sm (75px), md (150px), lg (275px), xl (300px), 2xl (400px), 3xl (480px), fluid (100%)

Props: src, placeholder, size, width, height, aspectRatio, resizeMode


🖼️ ImageBackground

An image that can contain child elements, perfect for hero sections and cards.

// Hero section
<ImageBackground 
  src="hero-bg.jpg" 
  height={300}
  justifyContent="center"
  alignItems="center"
>
  <Text color="white" fontSize={32} fontWeight="Bold">
    Welcome
  </Text>
</ImageBackground>

// Card with background
<ImageBackground 
  src="{{product.coverImage}}"
  aspectRatio={16/9}
  borderRadius={12}
  overflow="hidden"
>
  <Box position="absolute" bottom={0} left={0} right={0} padding={16} backgroundColor="rgba(0,0,0,0.5)">
    <Text color="white">Product Name</Text>
  </Box>
</ImageBackground>

// With template URL and placeholder
<ImageBackground 
  src="{{user.coverPhoto}}"
  placeholder="default-cover.jpg"
  height={200}
>
  {children}
</ImageBackground>

Props: src, placeholder, all Box layout/styling props


🎠 Swiper

A horizontal carousel/slider with multiple pagination styles and autoplay support.

// Basic swiper
<Swiper
  data={slides}
  renderItem={({ item }) => (
    <Image src={item.image} width="100%" aspectRatio={16/9} />
  )}
/>

// With autoplay
<Swiper
  data={banners}
  autoplay
  autoplayInterval={3000}
  renderItem={({ item }) => <BannerCard banner={item} />}
/>

// Different pagination styles
<Swiper data={items} paginationType="dot" />
<Swiper data={items} paginationType="dash" />
<Swiper data={items} paginationType="line" />
<Swiper data={items} paginationType="number" />

// Custom item width
<Swiper
  data={cards}
  itemWidth={280}
  renderItem={({ item }) => <ProductCard product={item} />}
/>

// With index change callback
<Swiper
  data={onboardingScreens}
  onIndexChange={(index) => setCurrentStep(index)}
  renderItem={({ item }) => <OnboardingSlide {...item} />}
/>

// Using ref for programmatic control
const swiperRef = useRef();
<Swiper ref={swiperRef} data={items} />
<Button label="Next" action={() => swiperRef.current.scrollToIndex(2)} />

Pagination Types: dash, dot, line, number
Props: data, renderItem, autoplay, autoplayInterval, paginationType, paginationStyle, itemWidth, onIndexChange


📳 triggerHapticFeedback

A utility function to trigger haptic feedback on supported devices.

import { triggerHapticFeedback } from 'types-for-ai';

// On button press
const handlePress = () => {
  triggerHapticFeedback('impactMedium');
  // ... do something
};

// Success notification
const onSuccess = () => {
  triggerHapticFeedback('notificationSuccess');
};

// Error feedback
const onError = () => {
  triggerHapticFeedback('notificationError');
};

// Light tap feedback
triggerHapticFeedback('impactLight');

// Heavy impact
triggerHapticFeedback('impactHeavy');

Haptic Types:

  • impactLight - Light tap
  • impactMedium - Medium tap
  • impactHeavy - Heavy tap
  • rigid - Rigid impact
  • soft - Soft impact
  • notificationSuccess - Success notification pattern
  • notificationWarning - Warning notification pattern
  • notificationError - Error notification pattern

Styled System Props Reference

All components support styled-system props:

CategoryProps
Spacemargin, marginTop, marginRight, marginBottom, marginLeft, padding, paddingTop, paddingRight, paddingBottom, paddingLeft, m, mt, mr, mb, ml, p, pt, pr, pb, pl
Layoutwidth, height, minWidth, maxWidth, minHeight, maxHeight, overflow
Flexboxflex, flexDirection, flexWrap, justifyContent, alignItems, alignSelf
Borderborder, borderWidth, borderColor, borderRadius, borderTop, borderRight, borderBottom, borderLeft
Colorcolor, backgroundColor, bg, opacity
Positionposition, top, right, bottom, left, zIndex
TypographyfontSize, fontWeight, textAlign, lineHeight, fontFamily

Theme Integration

Components automatically use theme values from your styled-components ThemeProvider:

const theme = {
  colors: {
    primary: '#6366f1',
    secondary: '#8b5cf6',
    'gray-100': '#f3f4f6',
    'gray-900': '#111827',
  },
  space: [0, 4, 8, 16, 24, 32, 48, 64],
  fontWeights: {
    Regular: '400',
    Medium: '500',
    Bold: '700',
  },
};

<ThemeProvider theme={theme}>
  <App />
</ThemeProvider>

License

MIT

版本与发布记录

@evlop/native-components 共发布 299 个版本,首次发布于 2019/12/13;过去 12 个月发布了 63 个版本。

版本发布日期距今
1.0.302latest2026/10/3015 天前
1.0.3012026/10/2916 天前
1.0.3002026/10/2916 天前
1.0.2992026/10/2916 天前
1.0.2982026/10/2916 天前
1.0.2972026/10/2916 天前

关于 @evlop/native-components 的常见问题

@evlop/native-components 是什么?

A collection of React Native components with styled-system integration for building beautiful, consistent UI. These components are designed for use with AI-powered code generation tools.

如何安装 @evlop/native-components?

在项目目录运行 npm install @evlop/native-components,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:react(>=18)、lodash(^4.17.15)、i18next(^21.8.9)、polished(^4.3.1)、query-string(^7.1.0)、react-native(^0.76.1)、styled-system(^5.1.5)、@evlop/commons(^1.0.137)、react-native-svg(^15.15.1)、styled-components(^4.4.1)、react-native-webview(^11.0.2)、@notifee/react-native(^9.1.8)、react-native-elements(^3.1.0)、react-native-tab-view(4.3.2)、react-native-fast-image(^8.6.3)、react-native-vector-icons(^10.0.3)、@react-navigation/elements(^2.9.3)、react-native-drawer-layout(^4.2.2)、react-native-haptic-feedback(^2.3.3)、react-native-safe-area-context(^4.3.1)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

@evlop/native-components 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@evlop/native-components 支持 ESM 还是 CommonJS?

以 CommonJS 形式发布,可以直接 require();在 ES Module 项目中也可以用 import 引入(Node.js 会把 module.exports 作为默认导出)。

@evlop/native-components 可以商用吗?

@evlop/native-components 使用 ISC 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@evlop/native-components 的下载量有多少?

根据 npm 官方下载统计,@evlop/native-components 在 2026/10/14 – 2026/11/12 这 30 天内被下载 2,835 次,日均约 95 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@evlop/native-components 还在维护吗?

最新版本 1.0.302 发布于 2026/10/30(15 天前);至今共发布 299 个版本,其中过去 12 个月发布了 63 个;首次发布于 2019/12/13。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。