File tree Expand file tree Collapse file tree 1 file changed +13
-3
lines changed
Expand file tree Collapse file tree 1 file changed +13
-3
lines changed Original file line number Diff line number Diff line change @@ -131,7 +131,7 @@ You can see the difference in the following video. The first example shows `ion-
131131This is a known issue that has been shared with the Ionic team. We will update this library accordingly once Ionic Core addresses it.
132132
133133
134- ### Experimental: Using Tap Animation with IonTabButton / IonSegmentButton
134+ ### Experimental: Using Gesture Animation with IonTabButton / IonSegmentButton
135135
136136__ This feature is experimental. The library can be used without this feature.__
137137
@@ -140,8 +140,18 @@ By registering IonTabBar / IonSegment, you can display animation effects on IonT
140140``` js
141141import { registerTabBarEffect , registerSegmentEffect } from ' @rdlabo/ionic-theme-ios26' ;
142142
143- registerTabBarEffect (document .querySelector < HTMLElement > (' ion-tab-bar' ));
144- registerSegmentEffect (document .querySelector < HTMLElement > (' ion-segment' ));
143+ const registeredTabBarEffect = registerTabBarEffect (document .querySelector < HTMLElement > (' ion-tab-bar' ));
144+ const registeredSegmentEffect = registerSegmentEffect (document .querySelector < HTMLElement > (' ion-segment' ));
145+
146+ const destroy = () => {
147+ /**
148+ * If the registered DOM element is removed (e.g., due to page navigation),
149+ * make sure to destroy the gesture and animation. This will also remove the event listeners.
150+ * You can re-register them if needed.
151+ */
152+ registeredTabBarEffect? .destroy ();
153+ registeredSegmentEffect? .destroy ();
154+ }
145155` ` `
146156
147157
You can’t perform that action at this time.
0 commit comments