Skip to content

Latest commit

 

History

History
38 lines (30 loc) · 1.87 KB

header.md

File metadata and controls

38 lines (30 loc) · 1.87 KB

Nativescript Material Components

License: Apache 2.0 TypeScript lerna--lite

Build beautiful, usable products using Material Components for NativeScript.

Installation

Android

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.

Production build

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

Theming

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');
}

Mixins

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();