Skip to content

全局样式

🌐 Global Styling

可以通过使用 colorsizestroke width 来调整图标。\n要全局设置所有图标的样式,可以使用上下文提供者。

🌐 Adjusting icons can be done by using color, size and stroke width. To style all icons globally, you can use a context provider.

上下文提供者

🌐 Context Provider

对于使用上下文提供者的全局样式,你可以使用 lucide-react-native 包提供的 LucideProvider 组件。

🌐 For global styling using a context provider, you can use the LucideProvider component that is provided by the lucide-react-native package.

tsx
import { LucideProvider, Home } from 'lucide-react-native';

const App = () => (
  <LucideProvider
    color="red"
    size={48}
    strokeWidth={2}
  >
    <Home />
  </LucideProvider>
);

这将把 colorsizestrokeWidth 属性应用到所有属于 LucideProvider 的子图标上。

🌐 This will apply the color, size and strokeWidth props to all icons that are children of the LucideProvider.