Build beautiful, usable products using Material Components for NativeScript.
Ensure your Android Theme is inheriting from MaterialComponents
.
Inside App_resources/android/res/values/styles.xml
replace all occurences of Theme.AppCompat
with Theme.MaterialComponents
You can see an example in the demo-vue app.
If you are using proguard on Android build you need ensure some resource from this plugin are not minified. You need to add tools:keep="@layout/ns_*"
as explained here
Defining the theme and the default colors must be done a bit differently on iOS and Android
- Android: You must set the colors through android Style
- iOS: You must set the colors programmatically at your app startup
import { themer } from '@nativescript-community/ui-material-core';
if (global.isIOS) {
themer.setPrimaryColor('#bff937');
themer.setAccentColor('#ff8a39');
themer.setSecondaryColor('#a830d7');
}
Through this component you can apply elevation
or rippleColor
to any View
. To enable that feature your must "install" the mixins. Make sure you do it before creating any view.
import { installMixins } from '@nativescript-community/ui-material-core';
installMixins();