Skip to content

Instantly share code, notes, and snippets.

@threepointone
Last active December 20, 2017 04:43
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save threepointone/de05fd8bf8de79f15b5d994b1c5d5b6e to your computer and use it in GitHub Desktop.
Save threepointone/de05fd8bf8de79f15b5d994b1c5d5b6e to your computer and use it in GitHub Desktop.
// rn.js
import {createElement} from 'react'
import {View, Text, Image} from 'react-native'
const map = { view: View, text: Text, image: Image }
export default function rn(type, props, ...children){
return createElement(map[type] || type, props, ...children)
}
// app.js
// @jsx rn
import rn from './rn'
// ...
<view>
<text> what up </text>
<image source={}/>
// ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment