Skip to content

Commit 8a6d463

Browse files
committed
fix ripple color
1 parent f49ad3a commit 8a6d463

File tree

3 files changed

+30
-2
lines changed

3 files changed

+30
-2
lines changed

src/core/tab-navigation-base/tab-navigation-base/index.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -255,6 +255,15 @@ export class TabNavigationBase extends View implements TabNavigationBaseDefiniti
255255
public setTabBarItemTextTransform(tabStripItem: TabStripItem, value: any): void {
256256
// overridden by inheritors
257257
}
258+
259+
public setTabBarRippleColor(value: Color) {
260+
// overridden by inheritors
261+
}
262+
263+
public getTabBarRippleColor() {
264+
// overridden by inheritors
265+
return null;
266+
}
258267
}
259268

260269
const MIN_ICON_SIZE = 24;

src/core/tab-navigation-base/tab-strip/index.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
/**
22
* @module @nativescript-community/ui-material-core/tab-navigation-base/tab-strip
33
*/
4+
import { rippleColorProperty } from '../../cssproperties';
45
import { AddArrayFromBuilder, AddChildFromBuilder, CSSType, Color, CssProperty, Property, Style, View, ViewBase, booleanConverter } from '@nativescript/core';
56
import { backgroundColorProperty, backgroundInternalProperty, colorProperty, fontInternalProperty } from '@nativescript/core/ui/styling/style-properties';
67
import { textTransformProperty } from '@nativescript/core/ui/text-base';
@@ -172,6 +173,18 @@ export class TabStrip extends View implements TabStripDefinition, AddChildFromBu
172173

173174
return parent && parent.setTabBarUnSelectedItemColor(value);
174175
}
176+
177+
[rippleColorProperty.getDefault](): Color {
178+
const parent = this.parent as TabNavigationBase;
179+
180+
return parent && parent.getTabBarRippleColor();
181+
}
182+
183+
[rippleColorProperty.setNative](value: Color) {
184+
const parent = this.parent as TabNavigationBase;
185+
186+
return parent && parent.setTabBarRippleColor(value);
187+
}
175188
}
176189

177190
const itemsProperty = new Property<TabStrip, TabStripItem[]>({

src/tabs/tabs.ios.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { rippleColorProperty, themer } from '@nativescript-community/ui-material-core';
1+
import { themer } from '@nativescript-community/ui-material-core';
22
import { Color, Device, Font, Frame, IOSHelper, ImageSource, Trace, Utils, View, ViewBase } from '@nativescript/core';
33
import { TabsBase, swipeEnabledProperty } from './tabs-common';
44

@@ -493,6 +493,7 @@ export class Tabs extends TabsBase {
493493
public _needsCacheUpdate = false;
494494
public _animateNextChange = true;
495495
private _selectionIndicatorColor: Color;
496+
private _rippleColor: Color;
496497

497498
constructor() {
498499
super();
@@ -1123,10 +1124,15 @@ export class Tabs extends TabsBase {
11231124
});
11241125
}
11251126

1126-
[rippleColorProperty.setNative](value: Color) {
1127+
public setTabBarRippleColor(value: Color) {
1128+
this._rippleColor = value;
11271129
this._ios.tabBar.rippleColor = value.ios;
11281130
}
11291131

1132+
public getTabBarRippleColor(): Color {
1133+
return this._rippleColor;
1134+
}
1135+
11301136
[selectedIndexProperty.setNative](value: number) {
11311137
// TODO
11321138
// if (traceEnabled()) {

0 commit comments

Comments
 (0)