On Tue, Mar 15, 2016 at 8:12 PM, Paul Stockley <pstockl...@gmail.com> wrote:

> I didn't have any success with any of the methods you presented. See below
>
> import java.util.function.Function;
>
> @JsType(namespace = JsPackage.GLOBAL, name="CustomComponent")
>
>
You don't need provide name when it is same as the original name,


> public class CustomComponent extends React.Component {
>     public BaseProps props;
>
>     public ReactElement<?> render() {
>         return React.createElement("div", null, "Classic Comp works");
>     }
>
>     // 1) Just returns undefined
>     @JsProperty(namespace = JsPackage.GLOBAL)
>     public static native Function getCustomComponent();
>
> This should work accept that "java.util.function.Function" is not a
JavaScript function. Replace that with JavaScriptObject or a JsType that
maps to JavaScript function.
However, regardless you should not be getting 'undefined' unless you didn't
pass the "--generateJsInteropExport true" flag. If you are using RC
release, try switching to a snapshot release.


>     // 2) Crashes compiler with internal error
>
> Can you provide mode detail on error?


>     public static native Function constructor() /*-{
>         return @com.ocs.react.client.CustomComponent::new(*);
>     }-*/;
>
>     // 3) Crashes compiler with internal error
>
> Can you provide mode detail on error?

>     public static native Function constructor(String qualifiedJsTypeName) /*-{
>         var cur = $wnd;
>         var parts = namespace.split('.');
>         for (var part; parts.length && (part = parts.shift());) {
>             cur = cur[part];
>         }
>         return cur;
>     }-*/;
> }
>
>
>
>> --
> You received this message because you are subscribed to the Google Groups
> "GWT Contributors" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to google-web-toolkit-contributors+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/google-web-toolkit-contributors/a52830d0-c2af-4660-b706-b9cc1d7123dd%40googlegroups.com
> <https://groups.google.com/d/msgid/google-web-toolkit-contributors/a52830d0-c2af-4660-b706-b9cc1d7123dd%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups "GWT 
Contributors" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-web-toolkit-contributors+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-web-toolkit-contributors/CAN%3DyUA2ye8vD5PnMU8kxqjqZjFJkgb4mL7KOZs33DzROujeCjw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to