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

    cool-psychiatrist-49311

    03/12/2020, 7:51 AM
    You can use conditional and support both, for a smooth transition
  • c

    cool-psychiatrist-49311

    03/12/2020, 7:51 AM
    (if you have the energy)
  • u

    user

    03/12/2020, 7:54 AM
    I don't think you can since it doesn't parse
  • c

    cool-psychiatrist-49311

    03/12/2020, 8:37 AM
    why not
  • c

    cool-psychiatrist-49311

    03/12/2020, 8:37 AM
    meta.extract(if(Context.defined('haxe4') ":react.wrap" else ":wrap")
    no?
  • u

    user

    03/12/2020, 9:22 AM
    In macros yeah, but there would be
    #if react.xx
    everywhere, and those wouldn't parse in haxe < 4
  • c

    cool-psychiatrist-49311

    03/12/2020, 9:25 AM
    argh.... I misunderstood scoped metas
  • c

    cool-psychiatrist-49311

    03/12/2020, 9:26 AM
    I was thinking
    @:react.xx
  • c

    cool-psychiatrist-49311

    03/12/2020, 9:26 AM
    ok yeah that seems to be a tough choice
  • u

    user

    03/12/2020, 9:27 AM
    But yeah I should move to scoped metas too
  • u

    user

    03/12/2020, 9:27 AM
    Well at least support them
  • u

    user

    03/12/2020, 9:27 AM
    I don't think I want to have
    @:react.wrap
    everywhere
  • c

    cool-psychiatrist-49311

    03/12/2020, 9:28 AM
    I want them though, much clearer
  • u

    user

    03/12/2020, 9:29 AM
    In a react codebase it's mostly redundant
  • u

    user

    03/12/2020, 9:29 AM
    Maybe with coconut/tink which are meta heavy it's less clear, though
  • b

    bitter-family-72722

    03/12/2020, 9:30 AM
    that's a confusing abbreviation, I thought you meant Vim's coc at first 😛
  • u

    user

    03/12/2020, 9:30 AM
    Whoops of course, not intentional x)
  • c

    cool-psychiatrist-49311

    03/12/2020, 9:32 AM
    does haxe3 supports
    haxe Main -D scoped.define=1
    ?
  • u

    user

    03/12/2020, 9:32 AM
    It defines scoped_define I think
  • b

    bitter-family-72722

    03/12/2020, 9:33 AM
    I don't think it does?
  • u

    user

    03/12/2020, 9:34 AM
    It does for -, I'm checking with .
  • b

    bitter-family-72722

    03/12/2020, 9:34 AM
    otherwise thx.core wouldn't have needed
    -D thx_core
    in its extraParams
  • u

    user

    03/12/2020, 9:34 AM
    Yeah, it doesn't
  • r

    refined-electrician-68261

    03/31/2020, 11:22 AM
    Do you guys know if this is still given any consideration https://github.com/HaxeFoundation/haxe-evolution/issues/60
  • u

    user

    03/31/2020, 12:00 PM
    What do you mean?
  • q

    quick-salesclerk-81994

    04/04/2020, 11:45 AM
    hey guys I'm struggling with externs for react-navigation, specifically this:
    Copy code
    js
    const Stack = createStackNavigator();
    
    function App() {
      return (
        <NavigationContainer>
          <Stack.Navigator>
            <Stack.Screen name="Home" component={HomeScreen} />
          </Stack.Navigator>
        </NavigationContainer>
      );
    }
  • q

    quick-salesclerk-81994

    04/04/2020, 11:45 AM
    can you give me a hint how I write this in haxe externs?
  • q

    quick-salesclerk-81994

    04/04/2020, 12:04 PM
    answering my own question: this mostly naive implementation works:
    Copy code
    haxe
    @:jsRequire('@react-navigation/native','NavigationContainer')
    extern class NavigationContainer extends ReactComponentOfProps<ViewProps> {}
    
    @:jsRequire('@react-navigation/stack','createStackNavigator()')
    extern class Stack extends ReactComponentOfProps<ViewProps> {}
    
    @:native('Stack.Navigator')
    extern class StackNavigator extends ReactComponentOfProps<ViewProps> {}
    
    @:native('Stack.Screen')
    extern class StackScreen extends ReactComponentOfProps<{name:String, component:Dynamic}> {}
  • u

    user

    04/04/2020, 12:07 PM
    Yep, should do You can add static vars to Stack with a type of
    ReactTypeOf<{...props...}>
    too if you want to use Stack.Navigator (assuming you're using react-next?)
  • a

    ambitious-knife-25690

    04/04/2020, 12:08 PM
    @quick-salesclerk-81994 I think there's already externs for react navigation
1...454647...80Latest