-
create-react-native-app purescript-app; cd purescript-app
-
pulp init --force
-
pulp build
-
src/Main.js
var React = require("react");
var RN = require("react-native");
exports.text = function(props){
return function(str){
return React.createElement(RN.Text, props, str);
};
};
- src/Main.purs
module Main where
foreign import data ReactElement :: Type
foreign import text :: forall props. props -> String -> ReactElement
main :: ReactElement
main = text { style : { color : "green", fontSize : 50 } } "Hello from PureScript!"
- ./App.js
import React from 'react';
import Main from "./output/Main";
export default class App extends React.Component {
render() {
return Main.main;
}
}
-
pulp build
-
yarn start
(create-react-native-app insists you use yarn, but npm may also work)