René's URL Explorer Experiment


Title: Better documentation for extending native classes · Issue #141 · NativeScript/docs · GitHub

Open Graph Title: Better documentation for extending native classes · Issue #141 · NativeScript/docs

X Title: Better documentation for extending native classes · Issue #141 · NativeScript/docs

Description: Is your feature request related to a problem? Please describe. I need to have access to a native method for the ListView component. The documentation is very unclear about how I would go about doing this. It says that I can subclass andr...

Open Graph Description: Is your feature request related to a problem? Please describe. I need to have access to a native method for the ListView component. The documentation is very unclear about how I would go about doin...

X Description: Is your feature request related to a problem? Please describe. I need to have access to a native method for the ListView component. The documentation is very unclear about how I would go about doin...

Opengraph URL: https://github.com/NativeScript/docs/issues/141

X: @github

direct link

Domain: patch-diff.githubusercontent.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Better documentation for extending native classes","articleBody":"### Is your feature request related to a problem? Please describe.\n\nI need to have access to a native method for the ListView component. The documentation is very unclear about how I would go about doing this. It says that I can subclass android components and has a short example of what this would look like, but the example is frankly very unhelpful:\r\n\r\n```typescript\r\nlet constructorCalled = false\r\n\r\n@NativeClass\r\nclass MyButton extends android.widget.Button {\r\n  constructor() {\r\n    super()\r\n    constructorCalled = true\r\n\r\n    // necessary when extending TypeScript constructors\r\n    return global.__native(this)\r\n  }\r\n\r\n  setEnabled(enabled: boolean): void {\r\n    this.super.setEnabled(enabled)\r\n  }\r\n}\r\n\r\nconst button = new MyButton(context)\r\n```\r\nThis example refers to the `NativeClass` decorator and the `android.widget.Button` class. Presumeable these would have to be imported from some nativescript modules, but there are no import statements at the top of the file. Where are these coming from? Also, how do I then use this class after extending the base class? If I want it to show up in a stack layout on my main page, for example, how would I do this using nativescript? What about with Vue? Or Svelte? Just instantiating it at the bottom of the file does nothing to tell the application where it should be placed. Also, do I need to place this code in some specific file or directory for it to be picked up by the rest of my code, like from the .xml file?\r\n\r\nNone of this is mentioned.\n\n### Describe the solution you'd like\n\nI'd be satisfied if someone could answer my questions here, but I think the documentation could benefit a lot from this information being added to it directly.\n\n### Describe alternatives you've considered\n\nI've searched through the docs, and searched the web too. Nothing is helpful.\n\n### Anything else?\n\n_No response_\n\n### Please accept these terms\n\n- [X] I have searched the [existing issues](https://github.com/NativeScript/NativeScript/issues) as well as [StackOverflow](https://stackoverflow.com/questions/tagged/nativescript) and this has not been posted before\n- [X] I agree to follow this project's [Code of Conduct](https://github.com/NativeScript/NativeScript/blob/master/tools/notes/CONTRIBUTING.md#coc)","author":{"url":"https://github.com/pianocomposer321","@type":"Person","name":"pianocomposer321"},"datePublished":"2024-04-17T17:22:12.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":1},"url":"https://github.com/141/docs/issues/141"}

route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:e8116cc8-bf8b-2182-c606-ea441c8670f2
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idC124:231E3E:36D0AC:4B8A4D:696E6FA0
html-safe-noncec1f4596b432bd405cdc17746729a16fbdf0834b67ecb2d0d946033116354447a
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDMTI0OjIzMUUzRTozNkQwQUM6NEI4QTREOjY5NkU2RkEwIiwidmlzaXRvcl9pZCI6Ijc2NDUzNDYyMDczNDA4NTExMDQiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ==
visitor-hmacdba874a7e2d4c8a0363e164fb463b048e3725cbf3999503d9196fc59b1141ab1
hovercard-subject-tagissue:2248926392
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/NativeScript/docs/141/issue_layout
twitter:imagehttps://opengraph.githubassets.com/785fa00a7af91d56b286ae9625424fbc3adafd90ec749e7faee40f3c0f0e7acd/NativeScript/docs/issues/141
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/785fa00a7af91d56b286ae9625424fbc3adafd90ec749e7faee40f3c0f0e7acd/NativeScript/docs/issues/141
og:image:altIs your feature request related to a problem? Please describe. I need to have access to a native method for the ListView component. The documentation is very unclear about how I would go about doin...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamepianocomposer321
hostnamegithub.com
expected-hostnamegithub.com
Nonedd24262d9e4947a6c63df018b01e9a6da49caaf8259148a56a04b665d15d66b3
turbo-cache-controlno-preview
go-importgithub.com/NativeScript/docs git https://github.com/NativeScript/docs.git
octolytics-dimension-user_id7392261
octolytics-dimension-user_loginNativeScript
octolytics-dimension-repository_id567462026
octolytics-dimension-repository_nwoNativeScript/docs
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id567462026
octolytics-dimension-repository_network_root_nwoNativeScript/docs
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release307ab96ec5f21762ff6c530a60b1ef6b1e74dd5a
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://patch-diff.githubusercontent.com/NativeScript/docs/issues/141#start-of-content
https://patch-diff.githubusercontent.com/
Sign in https://patch-diff.githubusercontent.com/login?return_to=https%3A%2F%2Fgithub.com%2FNativeScript%2Fdocs%2Fissues%2F141
GitHub CopilotWrite better code with AIhttps://github.com/features/copilot
GitHub SparkBuild and deploy intelligent appshttps://github.com/features/spark
GitHub ModelsManage and compare promptshttps://github.com/features/models
MCP RegistryNewIntegrate external toolshttps://github.com/mcp
ActionsAutomate any workflowhttps://github.com/features/actions
CodespacesInstant dev environmentshttps://github.com/features/codespaces
IssuesPlan and track workhttps://github.com/features/issues
Code ReviewManage code changeshttps://github.com/features/code-review
GitHub Advanced SecurityFind and fix vulnerabilitieshttps://github.com/security/advanced-security
Code securitySecure your code as you buildhttps://github.com/security/advanced-security/code-security
Secret protectionStop leaks before they starthttps://github.com/security/advanced-security/secret-protection
Why GitHubhttps://github.com/why-github
Documentationhttps://docs.github.com
Bloghttps://github.blog
Changeloghttps://github.blog/changelog
Marketplacehttps://github.com/marketplace
View all featureshttps://github.com/features
Enterpriseshttps://github.com/enterprise
Small and medium teamshttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
App Modernizationhttps://github.com/solutions/use-case/app-modernization
DevSecOpshttps://github.com/solutions/use-case/devsecops
DevOpshttps://github.com/solutions/use-case/devops
CI/CDhttps://github.com/solutions/use-case/ci-cd
View all use caseshttps://github.com/solutions/use-case
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
View all industrieshttps://github.com/solutions/industry
View all solutionshttps://github.com/solutions
AIhttps://github.com/resources/articles?topic=ai
Software Developmenthttps://github.com/resources/articles?topic=software-development
DevOpshttps://github.com/resources/articles?topic=devops
Securityhttps://github.com/resources/articles?topic=security
View all topicshttps://github.com/resources/articles
Customer storieshttps://github.com/customer-stories
Events & webinarshttps://github.com/resources/events
Ebooks & reportshttps://github.com/resources/whitepapers
Business insightshttps://github.com/solutions/executive-insights
GitHub Skillshttps://skills.github.com
Documentationhttps://docs.github.com
Customer supporthttps://support.github.com
Community forumhttps://github.com/orgs/community/discussions
Trust centerhttps://github.com/trust-center
Partnershttps://github.com/partners
GitHub SponsorsFund open source developershttps://github.com/sponsors
Security Labhttps://securitylab.github.com
Maintainer Communityhttps://maintainers.github.com
Acceleratorhttps://github.com/accelerator
Archive Programhttps://archiveprogram.github.com
Topicshttps://github.com/topics
Trendinghttps://github.com/trending
Collectionshttps://github.com/collections
Enterprise platformAI-powered developer platformhttps://github.com/enterprise
GitHub Advanced SecurityEnterprise-grade security featureshttps://github.com/security/advanced-security
Copilot for BusinessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/premium-support
Pricinghttps://github.com/pricing
Search syntax tipshttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
documentationhttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
Sign in https://patch-diff.githubusercontent.com/login?return_to=https%3A%2F%2Fgithub.com%2FNativeScript%2Fdocs%2Fissues%2F141
Sign up https://patch-diff.githubusercontent.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=NativeScript%2Fdocs
Reloadhttps://patch-diff.githubusercontent.com/NativeScript/docs/issues/141
Reloadhttps://patch-diff.githubusercontent.com/NativeScript/docs/issues/141
Reloadhttps://patch-diff.githubusercontent.com/NativeScript/docs/issues/141
NativeScript https://patch-diff.githubusercontent.com/NativeScript
docshttps://patch-diff.githubusercontent.com/NativeScript/docs
Please reload this pagehttps://patch-diff.githubusercontent.com/NativeScript/docs/issues/141
Notifications https://patch-diff.githubusercontent.com/login?return_to=%2FNativeScript%2Fdocs
Fork 33 https://patch-diff.githubusercontent.com/login?return_to=%2FNativeScript%2Fdocs
Star 15 https://patch-diff.githubusercontent.com/login?return_to=%2FNativeScript%2Fdocs
Code https://patch-diff.githubusercontent.com/NativeScript/docs
Issues 25 https://patch-diff.githubusercontent.com/NativeScript/docs/issues
Pull requests 4 https://patch-diff.githubusercontent.com/NativeScript/docs/pulls
Actions https://patch-diff.githubusercontent.com/NativeScript/docs/actions
Projects 1 https://patch-diff.githubusercontent.com/NativeScript/docs/projects
Security Uh oh! There was an error while loading. Please reload this page. https://patch-diff.githubusercontent.com/NativeScript/docs/security
Please reload this pagehttps://patch-diff.githubusercontent.com/NativeScript/docs/issues/141
Insights https://patch-diff.githubusercontent.com/NativeScript/docs/pulse
Code https://patch-diff.githubusercontent.com/NativeScript/docs
Issues https://patch-diff.githubusercontent.com/NativeScript/docs/issues
Pull requests https://patch-diff.githubusercontent.com/NativeScript/docs/pulls
Actions https://patch-diff.githubusercontent.com/NativeScript/docs/actions
Projects https://patch-diff.githubusercontent.com/NativeScript/docs/projects
Security https://patch-diff.githubusercontent.com/NativeScript/docs/security
Insights https://patch-diff.githubusercontent.com/NativeScript/docs/pulse
New issuehttps://patch-diff.githubusercontent.com/login?return_to=https://github.com/NativeScript/docs/issues/141
New issuehttps://patch-diff.githubusercontent.com/login?return_to=https://github.com/NativeScript/docs/issues/141
Better documentation for extending native classeshttps://patch-diff.githubusercontent.com/NativeScript/docs/issues/141#top
https://github.com/pianocomposer321
https://github.com/pianocomposer321
pianocomposer321https://github.com/pianocomposer321
on Apr 17, 2024https://github.com/NativeScript/docs/issues/141#issue-2248926392
existing issueshttps://github.com/NativeScript/NativeScript/issues
StackOverflowhttps://stackoverflow.com/questions/tagged/nativescript
Code of Conducthttps://github.com/NativeScript/NativeScript/blob/master/tools/notes/CONTRIBUTING.md#coc
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.