Writing React-Native Apps with Haxe – Using Components
First thing i needed to learn is to write externs.
Not all react-components that are available from scratch are ready-to-use with haxe-react-native (https://github.com/haxe-react/haxe-react-native).
For example to use the Button Component as described here: https://facebook.github.io/react-native/docs/button.html
you will get an Error Message similar to this:
Unknown identifier : Button
To use this Component as wanted, you will need do write an extern as documented here: https://haxe.org/manual/lf-externs.html
If you know what to to, just create a class in a packagename with identical name of the Component, you want to use:
com.packagemname.js.reactnative.Button
With following content:
package com.packagemname.js.reactnative;
@:jsRequire('react-native', 'Button')
extern class Button extends react.ReactComponent {}
Now you are all set to use this component by importing the extern
import de.superclass.js.reactnative.Button;
and use it:
var button = cast jsx(<Button key="unique-key" title="hey" onPress={_onPress}></Button>\');