Closed varadig closed 7 years ago
class MyComp extends react.ReactComponent.ReactComponentOfProps<{text:String, source:{uri:String}}> {}
So something like this?
package view.componenets;
import react.ReactComponent;
import haxe.macro.Expr;
import react.ReactMacro;
import react.ReactMacro.jsx;
import react.native.component.*;
class ImageBox extends ReactComponentOfProps<{text:String, source:{uri:String}}>{
public function new() {
super();
}
override function render() {
return jsx("
<View>
<Text>{text}</Text>
<Image source={source}></Image>
</View>");
}
}
I got this error when compile:
src/view/componenets/ImageBox.hx:16: lines 16-20 : Unknown identifier : text
src/view/componenets/ImageBox.hx:16: lines 16-20 : For function argument 'children'
You need to say props.text
and props.source
, just as in normal react.
Thanks you (y)
I have another question. When I create custom componenet, how can I create property for that. So I need to inject value of custom componenet property, like text,source...etc