-
Notifications
You must be signed in to change notification settings - Fork 380
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(view): view hover style #1769
base: master
Are you sure you want to change the base?
Conversation
…eat-hover-style
return enableAnimation | ||
? createElement(Animated.View, innerProps, childNode) | ||
const BaseComponent = enableAnimation | ||
? createElement(Animated.View, extendObject({}, innerProps, { style: finalStyle }), childNode) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这里不需要extend
if (!enableHoverStyle) return { enableHoverStyle } | ||
|
||
const gestureRef = useContext(ScrollViewContext).gestureRef | ||
const [isHover, setIsHover] = useState(false) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
考虑使用reanimated来实现不刷新组件的样式变更
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
和useAnimationStyle结合一下,当存在hover或者存在动画时都使用Animated.view进行包裹
@@ -610,3 +612,66 @@ export function pickStyle (styleObj: Record<string, any> = {}, pickedKeys: Array | |||
return acc | |||
}, {}) | |||
} | |||
|
|||
export function useHoverStyle ({ hoverStyle, hoverStartTime, hoverStayTime, disabled } : { hoverStyle?: ExtendedViewStyle, hoverStartTime: number, hoverStayTime: number, disabled?: boolean }) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
该钩子也需要应用到mpx-button中
8c3d8b9
to
698f805
Compare
No description provided.