Skip to content

MVCoconut/examples-react-native

Folders and files

NameName
Last commit message
Last commit date

Latest commit

8b72135 · Oct 17, 2021

History

65 Commits
Oct 28, 2018
Oct 17, 2021
Oct 17, 2021
Oct 17, 2021
Oct 17, 2021
Oct 17, 2021
Oct 17, 2021
May 25, 2017
Jul 11, 2019
May 25, 2017
Aug 2, 2017
Oct 26, 2018

Repository files navigation

Gitter

How to run this example

yarn global add lix
lix download # install haxe libraries
haxe ios.hxml # build ios
haxe android.hxml # build android
cd bin
yarn # install node modules
yarn ios # run ios
yarn android # run android

How to create a Coconut + React Native project from scratch

In a nutshell:

  1. Create a new React Native project according to the official documentation
  2. Create a Haxe project with Coconut (coconut.react-native)
  3. Replace the "entry point view" with one built with Coconut

Typically, the "entry point view" is registered with AppRegistry.registerComponent('my-app', () => Main); Since any coconut.react.View is a legitimate react component, so it can be used directly for registration. You can use Haxe's @:expose metadata to obtain the reference in JS and register there. You can also call registerComponent in Haxe code directly.