fix(ripple-effect): tapclick is required in ionic

This commit is contained in:
Manu Mtz.-Almeida
2018-03-27 23:45:12 +02:00
parent b70837278d
commit d57122c382
14 changed files with 28 additions and 21 deletions

View File

@ -286,7 +286,7 @@ export class Alert implements OverlayInterface {
{i.label} {i.label}
</div> </div>
</div> </div>
{this.mode === 'md' ? <ion-ripple-effect /> : null} {this.mode === 'md' && <ion-ripple-effect useTapClick={true}/>}
</button> </button>
))} ))}
</div> </div>
@ -306,7 +306,7 @@ export class Alert implements OverlayInterface {
{i.label} {i.label}
</div> </div>
</div> </div>
{this.mode === 'md' ? <ion-ripple-effect /> : null} {this.mode === 'md' && <ion-ripple-effect useTapClick={true}/>}
</button> </button>
))} ))}
</div> </div>

View File

@ -40,7 +40,7 @@ export class App {
render() { render() {
return [ return [
this.deviceHacks && <ion-input-shims />, this.deviceHacks && <ion-input-shims />,
this.isDevice && <ion-tap-click />, <ion-tap-click />,
this.isDevice && <ion-status-tap />, this.isDevice && <ion-status-tap />,
<slot></slot> <slot></slot>
]; ];

View File

@ -63,7 +63,7 @@ export class BackButton {
onClick={(ev) => this.onClick(ev)}> onClick={(ev) => this.onClick(ev)}>
{ backButtonIcon && <ion-icon name={backButtonIcon}/> } { backButtonIcon && <ion-icon name={backButtonIcon}/> }
{ backButtonText && <span class='button-text'>{backButtonText}</span> } { backButtonText && <span class='button-text'>{backButtonText}</span> }
{ this.mode === 'md' && <ion-ripple-effect/> } { this.mode === 'md' && <ion-ripple-effect useTapClick={true} /> }
</button> </button>
); );
} }

View File

@ -157,7 +157,7 @@ export class Button {
<span class='button-text'><slot></slot></span> <span class='button-text'><slot></slot></span>
<slot name='end'></slot> <slot name='end'></slot>
</span> </span>
{ this.mode === 'md' && <ion-ripple-effect/> } { this.mode === 'md' && <ion-ripple-effect useTapClick={true}/> }
</TagType> </TagType>
); );
} }

View File

@ -68,7 +68,7 @@ export class ChipButton {
<span class='chip-button-inner'> <span class='chip-button-inner'>
<slot></slot> <slot></slot>
</span> </span>
{ this.mode === 'md' && <ion-ripple-effect/> } { this.mode === 'md' && <ion-ripple-effect useTapClick={true}/> }
</TagType> </TagType>
); );
} }

View File

@ -628,7 +628,7 @@ export class Datetime {
aria-disabled={this.disabled ? 'true' : false} aria-disabled={this.disabled ? 'true' : false}
onClick={this.open.bind(this)} onClick={this.open.bind(this)}
class='datetime-cover'> class='datetime-cover'>
{this.mode === 'md' ? <ion-ripple-effect /> : null} {this.mode === 'md' && <ion-ripple-effect useTapClick={true}/>}
</button> </button>
]; ];
} }

View File

@ -110,7 +110,7 @@ export class FabButton {
<span class='fab-button-inner'> <span class='fab-button-inner'>
<slot></slot> <slot></slot>
</span> </span>
{ this.mode === 'md' && <ion-ripple-effect/> } { this.mode === 'md' && <ion-ripple-effect useTapClick={true}/> }
</TagType> </TagType>
); );
} }

View File

@ -133,7 +133,7 @@ export class Item {
</div> </div>
<slot name='end'></slot> <slot name='end'></slot>
</div> </div>
{ clickable && this.mode === 'md' && <ion-ripple-effect/> } { clickable && this.mode === 'md' && <ion-ripple-effect useTapClick={true}/> }
</TagType> </TagType>
); );
} }

View File

@ -14,7 +14,7 @@ export class RippleEffect {
@Prop({context: 'dom'}) dom: DomController; @Prop({context: 'dom'}) dom: DomController;
@Prop({context: 'enableListener'}) enableListener: EventListenerEnable; @Prop({context: 'enableListener'}) enableListener: EventListenerEnable;
@Prop({ mutable: true }) useTapClick: boolean; @Prop() useTapClick = false;
@Watch('useTapClick') @Watch('useTapClick')
tapClickChanged(useTapClick: boolean) { tapClickChanged(useTapClick: boolean) {
this.enableListener(this, 'parent:ionActivated', useTapClick); this.enableListener(this, 'parent:ionActivated', useTapClick);
@ -42,12 +42,6 @@ export class RippleEffect {
} }
} }
componentWillLoad() {
if (this.useTapClick === undefined) {
this.useTapClick = !!document.querySelector('ion-tap-click');
}
}
componentDidLoad() { componentDidLoad() {
this.tapClickChanged(this.useTapClick); this.tapClickChanged(this.useTapClick);
} }

View File

@ -9,6 +9,7 @@
<style> <style>
.my-block { .my-block {
position: relative; position: relative;
display: block;
background: blue; background: blue;
color: white; color: white;
width: 300px; width: 300px;
@ -54,6 +55,18 @@
This is just a div + effect This is just a div + effect
<ion-ripple-effect></ion-ripple-effect> <ion-ripple-effect></ion-ripple-effect>
</div> </div>
<a class="my-block">
This is just a a + effect on top
<ion-button onclick="buttonClicked()">Nested button</ion-button>
<ion-ripple-effect></ion-ripple-effect>
</a>
<button class="my-block">
This is just a button + effect on top
<ion-button onclick="buttonClicked()">Nested button</ion-button>
<ion-ripple-effect></ion-ripple-effect>
</button>
</ion-content> </ion-content>
</ion-app> </ion-app>

View File

@ -98,7 +98,7 @@ export class SegmentButton {
href={this.href} href={this.href}
onClick={this.segmentButtonClick.bind(this)}> onClick={this.segmentButtonClick.bind(this)}>
<slot></slot> <slot></slot>
{ this.mode === 'md' && <ion-ripple-effect/> } { this.mode === 'md' && <ion-ripple-effect useTapClick={true}/> }
</TagType> </TagType>
]; ];
} }

View File

@ -509,7 +509,7 @@ export class Select {
onBlur={this.onBlur.bind(this)} onBlur={this.onBlur.bind(this)}
class='select-cover'> class='select-cover'>
<slot></slot> <slot></slot>
{this.mode === 'md' ? <ion-ripple-effect /> : null} {this.mode === 'md' && <ion-ripple-effect useTapClick={true}/>}
</button>, </button>,
<input type='hidden' name={this.name} value={this.value}/> <input type='hidden' name={this.name} value={this.value}/>
]; ];

View File

@ -87,7 +87,7 @@ export class TabButton {
{ tab.icon && <ion-icon class='tab-button-icon' name={tab.icon}></ion-icon> } { tab.icon && <ion-icon class='tab-button-icon' name={tab.icon}></ion-icon> }
{ tab.title && <span class='tab-button-text'>{tab.title}</span> } { tab.title && <span class='tab-button-text'>{tab.title}</span> }
{ tab.badge && <ion-badge class='tab-badge' color={tab.badgeStyle}>{tab.badge}</ion-badge> } { tab.badge && <ion-badge class='tab-badge' color={tab.badgeStyle}>{tab.badge}</ion-badge> }
{ this.mode === 'md' && <ion-ripple-effect/> } { this.mode === 'md' && <ion-ripple-effect useTapClick={true}/> }
</a> </a>
]; ];
} }

View File

@ -5,7 +5,7 @@ const autoprefixer = require('autoprefixer');
exports.config = { exports.config = {
namespace: 'Ionic', namespace: 'Ionic',
bundles: [ bundles: [
{ components: ['ion-app', 'ion-content', 'ion-scroll', 'ion-footer', 'ion-header', 'ion-title', 'ion-toolbar'] }, { components: ['ion-app', 'ion-tap-click', 'ion-content', 'ion-scroll', 'ion-footer', 'ion-header', 'ion-title', 'ion-toolbar'] },
{ components: ['ion-action-sheet', 'ion-action-sheet-controller'] }, { components: ['ion-action-sheet', 'ion-action-sheet-controller'] },
{ components: ['ion-alert', 'ion-alert-controller'] }, { components: ['ion-alert', 'ion-alert-controller'] },
{ components: ['ion-avatar', 'ion-badge', 'ion-thumbnail'] }, { components: ['ion-avatar', 'ion-badge', 'ion-thumbnail'] },
@ -32,7 +32,7 @@ exports.config = {
{ components: ['ion-refresher', 'ion-refresher-content']}, { components: ['ion-refresher', 'ion-refresher-content']},
{ components: ['ion-tabs', 'ion-tab', 'ion-tabbar', 'ion-tab-button'] }, { components: ['ion-tabs', 'ion-tab', 'ion-tabbar', 'ion-tab-button'] },
{ components: ['ion-toast', 'ion-toast-controller'] }, { components: ['ion-toast', 'ion-toast-controller'] },
{ components: ['ion-tap-click', 'ion-status-tap'] }, { components: ['ion-status-tap'] },
{ components: ['ion-platform', 'ion-cordova-platform'] }, { components: ['ion-platform', 'ion-cordova-platform'] },
{ components: ['ion-hide-when', 'ion-show-when'] }, { components: ['ion-hide-when', 'ion-show-when'] },
], ],