Closed varadig closed 7 years ago
I wanted to use external jsx for instead of inline, with compiletime macro:
class Main { public static function main() { AppRegistry.registerComponent('TestReactNative', function() return App); } } @:expose('App') class App extends ReactComponent{ function new(props) { super(props); state = { scene: 0 } } override function render() { function goto(i) setState({scene: i}); return switch state.scene { default: jsx(CompileTime.readFile("jsx/Home.jsx")); } } }
Home.jsx:
<WebView source={{uri: 'https://github.com/facebook/react-native'}} style={{marginTop: 20}} > </WebView>
but I got this error when compile:
/usr/local/lib/haxe/std/haxe/macro/ExprTools.hx:289: characters 11-16 : Unsupported expression: { expr => ECall({ expr => EField({ expr => EConst(CIdent(CompileTime)), pos => #pos(src/Main.hx:35: characters 20-31) },interpolateFile), pos => #pos(src/Main.hx:35: characters 20-47) },[{ expr => EConst(CString(jsx/Home.jsx)), pos => #pos(src/Main.hx:35: characters 48-62) }]), pos => #pos(src/Main.hx:35: characters 20-63) } /Volumes/Work/develop/hx/libs/react/git/src/lib/react/ReactMacro.hx:27: characters 19-43 : Called from src/Main.hx:35: characters 16-64 : Called from
How can I use external jsx with RNhaxe, if I can?
thanks
The jsx macro isn't defined in this library, please report the issue at https://github.com/massiveinteractive/haxe-react.
I wanted to use external jsx for instead of inline, with compiletime macro:
Home.jsx:
but I got this error when compile:
How can I use external jsx with RNhaxe, if I can?
thanks