File tree Expand file tree Collapse file tree 3 files changed +17
-22
lines changed
packages/react-flicking/src/react-flicking Expand file tree Collapse file tree 3 files changed +17
-22
lines changed Original file line number Diff line number Diff line change @@ -312,12 +312,12 @@ class Flicking extends React.Component<Partial<FlickingProps & FlickingOptions>>
312312 : { } ;
313313
314314 return renderingIndexes . map ( idx => {
315- return < div
316- key = { idx }
317- data-element-index = { idx }
318- ref = { this . _panels [ idx ] as React . RefObject < HTMLDivElement > }
319- className = { panelClass }
320- style = { size } />
315+ return < StrictPanel key = { idx } ref = { this . _panels [ idx ] as any } >
316+ < div
317+ data-element-index = { idx }
318+ className = { panelClass }
319+ style = { size } />
320+ </ StrictPanel > ;
321321 } ) ;
322322 }
323323
Original file line number Diff line number Diff line change 55import { ElementProvider } from "@egjs/flicking" ;
66import StrictPanel from "./StrictPanel" ;
77import NonStrictPanel from "./NonStrictPanel" ;
8+ import React from "react" ;
89
910class ReactElementProvider implements ElementProvider {
10- private _elRef : React . RefObject < HTMLElement > ;
11+ private _el : StrictPanel ;
1112
12- public get element ( ) { return this . _elRef . current ! ; }
13- public get rendered ( ) { return this . _elRef . current != null ; }
13+ public get element ( ) { return this . _el ?. nativeElement }
14+ public get rendered ( ) { return this . _el ?. rendered ; }
1415
15- public constructor ( el : StrictPanel | NonStrictPanel | HTMLDivElement ) {
16- this . _elRef = el instanceof Element ? { current : el } : el . elRef ;
16+ public constructor ( el : StrictPanel ) {
17+ this . _el = el ;
1718 }
1819
1920 public show ( ) {
20- if ( this . _elRef . current ) {
21- this . _elRef . current . style . display = "" ;
22- }
21+ this . _el ?. show ( ) ;
2322 }
2423
2524 public hide ( ) {
26- if ( this . _elRef . current ) {
27- this . _elRef . current . style . display = "none" ;
28- }
25+ this . _el ?. hide ( ) ;
2926 }
3027}
3128
Original file line number Diff line number Diff line change @@ -74,15 +74,13 @@ class ReactRenderer extends ExternalRenderer {
7474 protected _collectPanels ( ) {
7575 const flicking = getFlickingAttached ( this . _flicking ) ;
7676 const reactFlicking = this . _reactFlicking ;
77- const reactPanels = reactFlicking . reactPanels . map ( panel => panel instanceof HTMLDivElement ? panel : panel . nativeElement ) ;
77+ const reactPanels = reactFlicking . reactPanels ;
7878
7979 this . _panels = this . _strategy . collectPanels ( flicking , reactPanels ) ;
8080 }
8181
82- protected _createPanel ( externalComponent : StrictPanel | NonStrictPanel | HTMLDivElement , options : PanelOptions ) {
83- const el = externalComponent instanceof HTMLDivElement ? externalComponent : externalComponent . nativeElement ;
84-
85- return this . _strategy . createPanel ( el , options ) ;
82+ protected _createPanel ( externalComponent : StrictPanel , options : PanelOptions ) {
83+ return this . _strategy . createPanel ( externalComponent , options ) ;
8684 }
8785}
8886
You can’t perform that action at this time.
0 commit comments