https://linen.dev logo
Join Discord
Powered by
# react
  • u

    user

    12/02/2020, 1:51 PM
    Hmm you might have some issues with components re-rendering too much because you reassign an enum value that matches previous value but is a different reference and so is considered different (you can handle this in shouldComponentUpdate if needed)
  • u

    user

    12/02/2020, 1:51 PM
    Also, they should be serialisable
  • w

    wide-greece-63479

    12/02/2020, 1:53 PM
    Ah. I get the reference thing, but "they should be serializable", does that apply to anything else than loading/saving persistent data?
  • u

    user

    12/02/2020, 1:55 PM
    Haxe had some trouble with json serialisation of enums a long time ago iirc I also think massive were (are still) using an older haxe version, so maybe this warning was about that I don't think there're issues now, I'd say you can ignore the warning
  • w

    wide-greece-63479

    12/02/2020, 1:55 PM
    Ok, thanks!
  • w

    wide-greece-63479

    12/15/2020, 7:27 AM
    What is the latest React version supported by haxe-react? (I'm right now looking for the possibility to use Fragments...)
  • u

    user

    12/15/2020, 7:34 AM
    Fragments are supported (
    <>...</>
    or
    <Fragment key="somekey">...</Fragment>
    when you need key, with
    react.Fragment
    )
  • u

    user

    12/15/2020, 7:35 AM
    Might miss some APIs but latest (or the one before the new jsx if it's not retrocompatible but I think it is) should be ok
  • w

    wide-greece-63479

    12/17/2020, 5:22 PM
    Thanks, @User! I missed that there was a compiler flag needed in react.Fragments to assure you're on R16.2+...
  • w

    wide-greece-63479

    12/17/2020, 6:50 PM
    Taking some React-Native baby steps here... When running a Haxe-compiled app, I get the following: "Component Exception - Element type is invalid: expected a string (for built-in components) or a class/function...
  • w

    wide-greece-63479

    12/17/2020, 6:51 PM
    I'm on Andriod studio: 4.1.1, react-native-cli: 2.0.1, react-native: 0.56.0
  • w

    wide-greece-63479

    12/17/2020, 6:51 PM
    Compiled with Haxe 4.1.4
  • w

    wide-greece-63479

    12/17/2020, 6:53 PM
    Ideas?
  • u

    user

    12/17/2020, 6:57 PM
    Does it work on web?
  • u

    user

    12/17/2020, 6:58 PM
    Usually (on web), you get this error when using an extern with a wrong @:jsRequire
  • w

    wide-greece-63479

    12/17/2020, 7:08 PM
    It's just a simple test app:
  • w

    wide-greece-63479

    12/17/2020, 7:08 PM
    Copy code
    haxe
    package myapp;
    
    import react.ReactComponent;
    import react.ReactMacro.jsx;
    import react.native.component.*;
    
    @:expose('App')
    class App extends react.ReactComponent {
    
        public static function main() {
            new App();
        }
    
        override function render() {
            return jsx('
                <View>
                    <Text>Hello</Text>
                </View>
            ');
        }
    }
  • w

    wide-greece-63479

    12/17/2020, 7:09 PM
    (Can't run that on the web, can I? Is there a RN-web-emulator..?)
  • u

    user

    12/17/2020, 7:35 PM
    I don't know how to react-native sorry
  • u

    user

    12/17/2020, 7:35 PM
    @cool-psychiatrist-49311 maybe?
  • w

    wide-greece-63479

    12/17/2020, 9:46 PM
    Hm, it seem related to how haxe scopes and exports the App instance...
  • u

    user

    12/17/2020, 9:46 PM
    Could be. I think there are some haxe + react-native templates / test projects on github
  • w

    wide-greece-63479

    12/17/2020, 9:47 PM
    If I use
    -D js-es=6
    and replace
    $hx_exports["App"] = App;
    with
    export default App;
    , it works.
  • u

    user

    12/17/2020, 9:47 PM
    For example https://github.com/haxe-react/haxe-react-native-sample/blob/master/src/Main.hx Don't know why the registering is commented out x)
  • u

    user

    12/17/2020, 9:48 PM
    Try
    @:native('App')
    on
    class App
    maybe?
  • u

    user

    12/17/2020, 9:48 PM
    Nah it's expose, nvm
  • w

    wide-greece-63479

    12/17/2020, 9:49 PM
    Thank you, klabs - I've tried them all... 🙂
  • w

    wide-greece-63479

    12/17/2020, 9:49 PM
    Maybe it's a latest-version-of-RN-cli-thing.
  • u

    user

    12/17/2020, 9:49 PM
    Maybe, they all seem a little outdated :x
  • w

    wide-greece-63479

    12/17/2020, 9:52 PM
    I'm using Thomas Fétivau's repo https://github.com/zabojad/haxe-react-native-stack now - seems to be a good match between react-native-cli and Haxe workflows...
1...555657...80Latest