hurrymaplelad / teact

Build React element trees by composing functions
MIT License
26 stars 6 forks source link

[features request] add React-Native support #6

Open emptist opened 8 years ago

emptist commented 8 years ago

Add React Native support.

hurrymaplelad commented 8 years ago

Sounds great! I haven't tried React Native yet. Do you have a sense of what would need to change? PRs welcome!

emptist commented 8 years ago

Thank you! I'm sorry I don't know much of React Native in fact. Just like to see teact there :)

scally commented 7 years ago

Just tried this out in React Native to see what would need to change -- so far, not a lot. From what I can tell, it's only the list of components that is used for the sugar methods that would need to be updated with the list of RN base components, but as a start, this is a fully functional RN app (with a Coffeescript build step added in gulp to precompile)

import React, { Component } from 'react'
import { AppRegistry, View, Text } from 'react-native'
import { crel } from 'teact'

class HelloTeact extends Component
  render: ->
    crel View, ->
      crel Text,
        style:
          marginTop: 40
        'Hello World'

AppRegistry.registerComponent 'hello_teact', () -> HelloTeact