alexrainman / nativescript-carousel-view

CarouselView plugin for NativeScript
MIT License
16 stars 5 forks source link

css not applying to slides #6

Closed terreb closed 7 years ago

terreb commented 7 years ago

nativescript 2.3.0 tns-core-modules 2.3.0 tns-ios 2.3.0 nativescript-carousel-view 2.0.1 simulator iOS 9.3

!!! Probably it's me doing something wrong if so please correct me. !!!

How to reproduce:

  1. In demo app add any css classes to slider-view.xml
  2. Add any styles to those classes to app.css
  3. Run the app, see if styles are applied

I also tried to add slider-view.css with those styles to app/Views/Slides folder and change template-selector.ts as

import { ITemplateSelector } from 'nativescript-carousel-view'
import { View } from 'ui/core/view'
import { topmost } from 'ui/frame'
import * as builder from 'ui/builder'

export class SlideTemplateSelector implements ITemplateSelector {

    OnSelectTemplate(position: number, bindingContext: any) {

        const page = topmost().currentPage

        let view = <View>builder.load({
            path: '~/components/order-online/choose-products/slides',
            name: 'slider-view',
            page: page
        })

        view.bindingContext = bindingContext

        return view
    }
}

...but nothing helped. Please advise.

alexrainman commented 7 years ago

@terreb i submitted a question to {N} team. CSS is being loaded but it's not being applied. Why? I don't know, yet :)

alexrainman commented 7 years ago

You can follow this https://github.com/NativeScript/NativeScript/issues/3054

terreb commented 7 years ago

Ok, awesome, thanks!

alexrainman commented 7 years ago

As a workaround, you can use inline CSS until we solve this issue.

https://docs.nativescript.org/ui/styling#inline-css

alexrainman commented 7 years ago

Solved!

terreb commented 7 years ago

Awesome, thanks a lot!