react-native-reactify

1.0.0 • Public • Published

Reactify

Create React Native interfaces using JSON format.

Install

npm install react-native-reactify --save

Usage

import React from 'react';
import {View, Button, Alert} from 'react-native';
import reactify from 'react-native-reactify';

/**
 * It will be executed when the "Hello" button is pressed.
 *
 * @param {Event} e
 */
function onPress(e) {
  Alert.alert('World');
}

/**
 * Object description of a React component.
 */
const helloWorld = {
  type: 'View',
  style: {
    flex: 1,
    alignItems: 'center',
    justifyContent: 'center',
    backgroundColor: '#eff'
  },
  children: {
    type: 'Button',
    title: 'Hello',
    onPress,
    style: {
      fontSize: 40,
      color: '#444'
    }
  }
};

export default class App extends React.Component {
  render() {
    return reactify(helloWorld, {View, Button});
  }
}

Package Sidebar

Install

npm i react-native-reactify

Weekly Downloads

1

Version

1.0.0

License

ISC

Last publish

Collaborators

  • amelo_pm
  • adrianomelo