Skip to content
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

Open
wants to merge 21 commits into
base: master
Choose a base branch
from
Open

feat(view): view hover style #1769

wants to merge 21 commits into from

Conversation

nianxiongdi
Copy link
Collaborator

No description provided.

@nianxiongdi nianxiongdi changed the base branch from fix-drn to master December 19, 2024 12:53
return enableAnimation
? createElement(Animated.View, innerProps, childNode)
const BaseComponent = enableAnimation
? createElement(Animated.View, extendObject({}, innerProps, { style: finalStyle }), childNode)
Copy link
Collaborator

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)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

考虑使用reanimated来实现不刷新组件的样式变更

Copy link
Collaborator

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 }) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

该钩子也需要应用到mpx-button中

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants