fix(segment): do not show ripple effect if disabled via config (#20542)

fixes #20533
This commit is contained in:
Liam DeBeasi
2020-02-18 14:02:34 -05:00
committed by GitHub
parent 9b5854d797
commit 7a461c59c5

View File

@ -1,5 +1,6 @@
import { Component, ComponentInterface, Element, Event, EventEmitter, Host, Prop, State, Watch, h, writeTask } from '@stencil/core'; import { Component, ComponentInterface, Element, Event, EventEmitter, Host, Prop, State, Watch, h, writeTask } from '@stencil/core';
import { config } from '../../global/config';
import { getIonMode } from '../../global/ionic-global'; import { getIonMode } from '../../global/ionic-global';
import { Color, SegmentChangeEventDetail, StyleEventDetail } from '../../interface'; import { Color, SegmentChangeEventDetail, StyleEventDetail } from '../../interface';
import { Gesture, GestureDetail } from '../../utils/gesture'; import { Gesture, GestureDetail } from '../../utils/gesture';
@ -145,6 +146,9 @@ export class Segment implements ComponentInterface {
* and where the cursor ended. * and where the cursor ended.
*/ */
private addRipple(detail: GestureDetail) { private addRipple(detail: GestureDetail) {
const useRippleEffect = config.getBoolean('animated', true) && config.getBoolean('rippleEffect', true);
if (!useRippleEffect) { return; }
const buttons = this.getButtons(); const buttons = this.getButtons();
const checked = buttons.find(button => button.value === this.value); const checked = buttons.find(button => button.value === this.value);