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

Support component classes declared in JS #112

Closed

Conversation

greglittlefield-wf
Copy link
Collaborator

Not a clean diff: Depends on PRs #110 and #111


Problem

#109 There wasn't a path to use React components declared in JS within react-dart.

Solution

  • Add ReactJsComponentFactoryProxy to enable wrapping of JS components
  • Add example of using JS components from within Dart
  • Add index to example directory
  • Add common factory proxy tests
  • Deprecate jsify, add new jsifyAndAllowInterop
    • More closely matches jsify from package:js, and doesn't name-collide
  • TODO:
    • tests around:
      • conditional event handler wrapping
      • wrapEventHandler
      • ReactJsComponentFactoryProxy construction

Testing

  • Verify unit tests pass
  • Verify example makes sense and works as expected

@greglittlefield-wf greglittlefield-wf changed the title WIP: JS Components Support for component classes declared in JS Jan 2, 2017
@greglittlefield-wf greglittlefield-wf changed the title Support for component classes declared in JS Support component classes declared in JS Jan 2, 2017
///
/// This is optional, as you won't always need to access the component's API.
@JS()
class FooComponent {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just for my own understanding, this is only necessary if you want a typed interface into your JS component correct? You could still call API methods on the component you just wouldn't get autocompletion or static analysis, right?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good question; I'll clarify this in the comment.

For package:js, you actually have to declare the interop class to be able to call those methods on it. The typing, however, doesn't matter, so long as it is a @JS.

@greglittlefield-wf
Copy link
Collaborator Author

This will be added in some form as part of the upcoming react-dart 5.0.0 release

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

Successfully merging this pull request may close these issues.

2 participants