wrapViewable turns a Viewable into a View by creating a componentNode whose renderFn invokes Body with the current scope.
(v Viewable)
| 51 | |
| 52 | // wrapViewable turns a Viewable into a View by creating a componentNode whose renderFn invokes Body with the current scope. |
| 53 | func wrapViewable(v Viewable) View { |
| 54 | return &componentNode{ |
| 55 | node: viewNode{kind: viewKindComponent}, |
| 56 | renderFn: func(s *Scope) View { return v.Body(s) }, |
| 57 | } |
| 58 | } |
| 59 | |
| 60 | // asView converts an argument passed to a layout constructor into a View. |
| 61 | // Accepts View (returned as-is), Viewable (wrapped), and nil (returned |