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

Initial React Native support #119

Merged
merged 22 commits into from
Mar 18, 2018
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Update CHANGELOG
  • Loading branch information
shadaj committed Mar 15, 2018
commit d23d9dccc6739cf8e2901ca0727c612e75161e74
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
# Changelog

## vNEXT
### Highlights
+ Slinky now has support for **React Native**, available in the `slinky-native` module.

### Details
+ The `@react` macro now produces nicer APIs for external components that have default values for all props parameters.
+ Add more variations for `ExternalComponent` that support providing a statically-typed interface for the component instance: `ExternalComponentWithRefType`, `ExternalComponentWithAttributesWithRefType`, `ExternalComponentNoPropsWithRefType`, `ExternalComponentNoPropsWithAttributesWithRefType`

## v0.3.2
+ Improve support for creating custom tags and attributes (see docs for details) [PR #116](https://github.com/shadaj/slinky/pull/116)
Expand Down
8 changes: 8 additions & 0 deletions core/src/main/scala/slinky/core/annotations/react.scala
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,14 @@ class react extends scala.annotation.StaticAnnotation {
val objStats = createExternalBody(obj) ++ obj.templ.stats.getOrElse(Nil)
obj.copy(templ = obj.templ.copy(stats = Some(objStats)))

case obj@Defn.Object(_, _, Template(_, Seq(Term.Apply(Term.ApplyType(Ctor.Ref.Name("ExternalComponentWithRefType"), _), _)), _, _)) =>
val objStats = createExternalBody(obj) ++ obj.templ.stats.getOrElse(Nil)
obj.copy(templ = obj.templ.copy(stats = Some(objStats)))

case obj@Defn.Object(_, _, Template(_, Seq(Term.Apply(Term.ApplyType(Ctor.Ref.Name("ExternalComponentWithAttributesWithRefType"), _), _)), _, _)) =>
val objStats = createExternalBody(obj) ++ obj.templ.stats.getOrElse(Nil)
obj.copy(templ = obj.templ.copy(stats = Some(objStats)))

case Defn.Object(_, _, Template(_, Seq(Term.Apply(Ctor.Ref.Name("ExternalComponentWithAttributes"), _)), _, _)) =>
abort("ExternalComponentWithAttributes must take a type argument of the target tag type but found none")

Expand Down