mlmorg / react-hyperscript

Hyperscript syntax for React.js markup
MIT License
710 stars 45 forks source link

compatibility with react native #12

Closed reqshark closed 8 years ago

reqshark commented 8 years ago

that would be slick

reqshark commented 8 years ago

btw got it to work with the react-native demo on my iphone, but i had to do it like:

var styles = StyleSheet.create({
  container: {
    flex: 1,
    justifyContent: 'center',
    alignItems: 'center',
    backgroundColor: '#F5FCFF',
  },
  welcome: {
    fontSize: 20,
    textAlign: 'center',
    margin: 10,
  },
});

var AwesomeProject = React.createClass({
  render: function() {
    return h(View, { style: styles.container }, [
      h(Text, { style: styles.welcome }, 'hello')
    ])
  }
});

replace this repo's index.js references:

'use strict';
var parseTag = require('virtual-hyperscript/parse-tag');
var React = require('react');

with:

'use strict';
var parseTag = require('./parse-tag');
var React = require('react-native');

module.exports = h;
kumavis commented 8 years ago

@reqshark did you make your own ./parse-tag?

reqshark commented 8 years ago

@kumavis, yea copied it from here when i added my modified react-hyperscript module...

and TBH I don't fully know yet how react-native does it's JS packaging, like browserifyish deps

reqshark commented 8 years ago

juggling between a react-native dep and react seems pretty complicated. native compatibility might be unrealistic given the simple interface we expect with hyperscript,

so that's why i forked it.

unless someone can show otherwise (how to PR that) I'll just maintain react-native-hyperscript

mlmorg commented 8 years ago

:+1: I think that makes the most sense. Will close for now unless folks have better ideas.