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

onItemSelect is not working in ListTemplate for android #156

Open
shubhadeep-foodhub opened this issue Nov 17, 2023 · 4 comments
Open

onItemSelect is not working in ListTemplate for android #156

shubhadeep-foodhub opened this issue Nov 17, 2023 · 4 comments
Labels
bug Something isn't working

Comments

@shubhadeep-foodhub
Copy link

shubhadeep-foodhub commented Nov 17, 2023

const template = new ListTemplate({
            sections: [
                {
                    header: 'HEADER',
                    items: [
                        {
                            text: 'Item 1',
                        },
                    ],
                },
            ],
            title: 'Test Android Auto',
            async onItemSelect(e) {
                console.log("test clicked", e);
            },
        });
        CarPlay.setRootTemplate(template);

When testing the list ListTemplate, the onItemSelect function is not working.

To Reproduce
Steps to reproduce the behavior:

  1. click on list item

Expected behavior
Should fire a onItemSelect event

Android Auto (please complete the following information):

  • Device: [e.g. Oneplus 6 and DHU]
  • Android Version: [11]
  • RNCarPlay version [2.4.0-beta.2 - Android Auto]
@shubhadeep-foodhub shubhadeep-foodhub added the bug Something isn't working label Nov 17, 2023
@birkir
Copy link
Owner

birkir commented Nov 18, 2023

Awesome, first Android bug (I expect loads...)
I will look at this

@shubhadeep-foodhub
Copy link
Author

Yes, it has lots of bugs which is causing frequent app crashes. waiting for a stable release.

@tanquetav
Copy link

List view items only trigger events if they are browsable items:

const template = new ListTemplate({
            sections: [
                {
                    header: 'HEADER',
                    items: [
                        {
                            text: 'Item 1',
                            browsable: true,
                        },
                    ],
                },
            ],
            title: 'Test Android Auto',
            async onItemSelect(e) {
                console.log("test clicked", e);
            },
        });
        CarPlay.setRootTemplate(template);

@Deepak-Foodhub
Copy link

List view items only trigger events if they are browsable items:

const template = new ListTemplate({
            sections: [
                {
                    header: 'HEADER',
                    items: [
                        {
                            text: 'Item 1',
                            browsable: true,
                        },
                    ],
                },
            ],
            title: 'Test Android Auto',
            async onItemSelect(e) {
                console.log("test clicked", e);
            },
        });
        CarPlay.setRootTemplate(template);

It works. Thanks @tanquetav

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants