u
This commit is contained in:
1 parent
b8a6b15355
commit
95d645f572
13 files changed
+660
-63
No files matched your search
@@ -10,6 +10,7 @@ interface LucideIconProps {
|
||||
strokeWidth?: number
|
||||
onPress?: (event: GestureResponderEvent) => void
|
||||
style?: ViewStyle
|
||||
clickable?: boolean // 新增参数,是否可点击,默认 true
|
||||
}
|
||||
|
||||
export default function LucideIcon({
|
||||
@@ -19,12 +20,18 @@ export default function LucideIcon({
|
||||
strokeWidth = 2,
|
||||
onPress,
|
||||
style,
|
||||
clickable = true,
|
||||
}: LucideIconProps) {
|
||||
const IconComponent = icons[icon]
|
||||
|
||||
if (!IconComponent)
|
||||
return null
|
||||
|
||||
if (!clickable) {
|
||||
return <IconComponent size={size} color={color} strokeWidth={strokeWidth} style={style} />
|
||||
}
|
||||
|
||||
// clickable 为 true,包 Pressable
|
||||
return (
|
||||
<Pressable onPress={onPress} style={style}>
|
||||
<IconComponent size={size} color={color} strokeWidth={strokeWidth} />
|
||||
|
||||
Reference in new issue
Block a user