Skip to content

Commit 965436a

Browse files
committed
chore: update readme for gesture
1 parent e313c59 commit 965436a

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

README.md

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ You can see the difference in the following video. The first example shows `ion-
131131
This 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
141141
import { 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

0 commit comments

Comments
 (0)