Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Accordion][IOS] Plugin doesn't work #183

Open
kefahB opened this issue Aug 10, 2023 · 1 comment
Open

[Accordion][IOS] Plugin doesn't work #183

kefahB opened this issue Aug 10, 2023 · 1 comment

Comments

@kefahB
Copy link
Contributor

kefahB commented Aug 10, 2023

Hi @triniwiz,

The plugin show this:

The problem come from this line at the init time itemHeaderTemplate is undefined and for that the plugin set the json data to the view instead of the template for that we see [object object]

I tried setTimeOut on the constructor but it doesn't solve it but if I did that it work for the header and need to be set for all templates! :

this._defaultItemHeaderTemplate = {
            key: 'default',
            createView: () => {
                
                return Builder.parse(`<StackLayout id="headerTemplate" backgroundColor="green" >
                <Label text="{{headerText}}"/>
            </StackLayout>`, this);
            }
        };

What can we do on this scenario ?

my code is same as the doc, here it:

<accordion:Accordion height="100%" items="{{items}}" allowMultiple="false" selectedIndexes="{{selectedIndexes}}">

                <accordion:Accordion.headerTemplate>
                    <StackLayout id="headerTemplate" backgroundColor="green" >
                        <Label text="{{headerText}}"/>
                    </StackLayout>
                </accordion:Accordion.headerTemplate>


                <accordion:Accordion.itemHeaderTemplate>
                    <GridLayout backgroundColor="blue">
                    <Label height="100%" text="{{title}}"/>
                    </GridLayout>
                </accordion:Accordion.itemHeaderTemplate>

                <accordion:Accordion.itemContentTemplate>
                    <StackLayout backgroundColor="orange">
                    <Image height="200" decodeWidth="200" decodeHeight="200"  src="{{image}}"/>
                    <Label text="{{text}}"/>
                    </StackLayout>
                </accordion:Accordion.itemContentTemplate>


                <accordion:Accordion.footerTemplate>
                    <StackLayout backgroundColor="yellow">
                    <Label text="{{footerText}}"/>
                    </StackLayout>
                </accordion:Accordion.footerTemplate>
            </accordion:Accordion>
export class HowToViewModel extends Observable {

    selectedIndexes = [0]
    items: ObservableArray<any>

	constructor() {
		super();
        this.items = new ObservableArray([
            {
              title: '1',
              footer: '10',
              headerText: 'First',
              footerText: '4',
              image: 'http://placehold.it/120x120&text=First',
              items: [
                {image: '~/images/a9ff17db85f8136619feb0d5a200c0e4.png', text: 'Stop'},
                {
                  text: 'Drop',
                  image: '~/images/shazam.jpg'
                }]
            },
            {
              title: '2',
              footer: '20',
              headerText: 'Second',
              footerText: '5',
              image: 'http://placehold.it/120x120&text=Second',
              items: [{
                text: 'Drop',
                image: '~/images/batman.jpg'
              }, {text: 'Drop', image: '~/images/f29.png'}]
            },
            {
              title: '3',
              footer: '30',
              headerText: 'Third',
              footerText: '6',
              image: 'http://placehold.it/120x120&text=Third',
              items: [{text: 'Drop', image: '~/images/strider.png'}, {
                text: 'Drop',
                image: '~/images/f29.png'
              }]
            }
          ]);
	}

}
@triniwiz
Copy link
Owner

I’ll do some testing to verify if something changed along the way, as for code test test with you can check out the demo in the older package

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants