rokucommunity / rokucommunity/brighterscript

Support user-defined overridden native components

Open
#1,200 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
208
Forks
68
Avg merge
8h 39m
Merged PRs (30d)
39

Description

Users can override built-in components. Here are some findings. We should eventually support this.

Implementation in brighterscript:

  • user-defined component with same name should "win". i.e. an overridden Button should now make roSGNodeButton point to the user's instance.
  • If you need to reference the native one after overriding, then we should add a namespace that holds all these types (i.e. scenegraph.Button).

We have discovered that it is possible to override the native SceneGraph components by defining an XML component with the same name.

Questions:

Why does this work?

Is this intentional?

Could Roku please provide an official stance on whether this can be safely used or should never be used in our apps?

For example:

pkg:/components/Button.xml:

pkg:/components/MainScene.xml Screenshot of the above example:
  • Cannot extend native component with same name.
    image

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the override in pkg:/components/Button.xml and pkg:/components/MainScene.xml, then compare the behavior of the user-defined Button with the native SceneGraph component. The issue is done only when the supported behavior, native-component access, and compiler handling are clearly defined and covered by appropriate tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
compilers
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.