Styling Dataform not working - can not find module android


Hi, I want styling native form :
In example is used package android (android.widget.SeekBar), in git it is imported by import { android as androidApplication } from ‘tns-core-modules/application’;
If I download example app it works, but in my app I get error: error TS2503: Cannot find namespace ‘android’ and so on: error TS2304: Cannot find name ‘android’, Cannot find name ‘com’, Cannot find name ‘UISegmentedControl’.
What I have wrong?

My code is now copied from example:

dfEditorUpdate(args: DataFormEventData) {
        if (androidApplication) {
            switch (args.propertyName) {
                case 'searchType':
        } else {
            const entityProperty: EntityProperty =
            switch (entityProperty.editor.type) {
                case 'SegmentedEditor':

    editorSetupSwitchAndroid(editor) {
        const androidContext = editor.getEditorView().getContext();
        const customLayoutResourceId = androidContext.getResources().getIdentifier('custom_switch_editor_layout', 'layout', androidContext.getPackageName());


    editorSetupSegmentedEditorAndroid(editor) {
        const radioGroup: android.widget.RadioGroup = <android.widget.RadioGroup>editor.getEditorView();
        radioGroup.setPadding(8, 8, 8, 8);

        const androidContext = editor.getEditorView().getContext();

        const segmentDividerResourceId = androidContext.getResources().getIdentifier('df_segment_divider', 'drawable', androidContext.getPackageName());
        const segmentDivider = androidContext.getResources().getDrawable(segmentDividerResourceId);

        const segmentItemResourceId = androidContext.getResources().getIdentifier('df_segment_item', 'drawable', androidContext.getPackageName());
        const segmentTextColorResourceId = androidContext.getResources().getIdentifier('df_segment_text_color', 'color', androidContext.getPackageName());

            apply(argument: android.widget.RadioButton) {
                const segmentItemDrawable = androidContext.getResources().getDrawable(segmentItemResourceId);
                const segmentTextColor = androidContext.getResources().getColorStateList(segmentTextColorResourceId);

    editorSetupSegmentedEditorIOS(editor) {
        const coreEditor = <UISegmentedControl>editor.editor;
        coreEditor.tintColor = colorDark.ios;


Install tns-platform-declarations plugin.


I added it by type it to package.json without change.
Now I remove from node_modules and package.json it and run: npm i tns-platform-declarations
It install to dependencies. I get the same errors: error TS2304: Cannot find name ‘android’. etc…
Have I installed another way or do something else?

I get errors when create bundle of app

Did you go through the plugin’s read me file, followed the steps given there?


Yea I read it here , but Idid not fully understand it.
I dont know where I should create file reference.d.ts and If I have to generate android .d.ts files, and for what they are.


You have to create the reference.d.ts file at project root.


Ok, I create it and it help. Now I get only one error here: new TS2339: Property ‘telerik’ does not exist on type ‘typeof com’ and it not effect segmented bar form. I dont see in example, any others imports.


Just say declare var com; at top of your file.


Yea it works, thanks