-
Notifications
You must be signed in to change notification settings - Fork 134
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: add CrossFlicking Preset #901
Conversation
*/ | ||
import React, { ReactNode } from "react"; | ||
|
||
const CrossGroup = React.forwardRef((props: { children?: ReactNode }, ref: React.Ref<HTMLDivElement>) => <div ref={ref}>{props.children}</div>); |
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.
It seems that CrossGroup should also have Element properties (className).
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.
Fixed to use properties of elements in CrossGroup.
} | ||
|
||
public render() { | ||
const props = this.props; |
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.
It seems like you'll need to filter only the parts you need from Cross's props.
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.
Added logic to filter props before passing them to the CrossFlicking instance.
|
||
Object.keys(SIDE_EVENTS).forEach((eventKey: keyof typeof EVENTS) => { | ||
const eventName = SIDE_EVENTS[eventKey]; | ||
this._bindEvent(eventName); |
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.
Must be paired with unmount.
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.
Extended from react-flicking, react-crossflicking calls destroy on unmount to remove all event handlers.
onSideChanged: (e: CrossFlickingEvent<ChangedEvent>) => {}, | ||
}; | ||
|
||
class CrossFlicking extends Flicking { |
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.
Is the method available?
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.
CrossFlicking extends Flicking in react, and Flicking includes a @withFlickingMethods decorator that allows to use existing methods.
77736df
to
f7b3fe2
Compare
1f39720
to
32bc785
Compare
32bc785
to
5f632ca
Compare
Details
CrossFlicking supports flicking that can move in both horizontal and vertical directions.
You can easily create UIs with panels with multiple categories with this preset.
Documentation
https://malangfox.github.io/egjs-flicking/Presets
Examples
Rules