"use strict";

import {
  View,
  Text,
  StyleSheet
} from 'react-native';
import React, { Component, PropTypes } from 'react';

class NativeIniticon extends Component {

  _getFontSize() {
    return this.props.single ? (this.props.size)/1.7 : (this.props.size-5)/2
  }

  _getInitials(props) {
    let {text, single} = props;
    if (text !== null && typeof text === 'object') {
      return text;
    } else if (text.indexOf(" ") > 0 && !single) {
      return (text.split(" ")[0].charAt(0) + text.split(" ")[1].charAt(0)).toUpperCase();
    } else {
      return text.charAt(0).toUpperCase();
    }
  }

  render() {
    return (
      <View style={{backgroundColor: 'transparent'}}>
        <View style={[styles.icon, {
                    backgroundColor: this.props.backgroundColor,
                    height: this.props.size,
                    width: this.props.size,
                    borderRadius: this.props.size/2
                  },
                  this.props.style]}
        >
          <Text allowFontScaling={false} style={[styles.text, {fontSize: this._getFontSize(this.props), color: this.props.color, backgroundColor: 'transparent'}]}>{this._getInitials(this.props)}</Text>
        </View>
      </View>
    );
  }
};

NativeIniticon.propTypes = {
  text: React.PropTypes.string.isRequired,
  size: React.PropTypes.any.isRequired,
  color: React.PropTypes.any,
  backgroundColor: React.PropTypes.any,
  single: React.PropTypes.bool,
}

const styles = StyleSheet.create({
  icon: {
    justifyContent: 'center',
    alignItems: 'center',
    backgroundColor: 'transparent',
  },
  text: {
    color: '#fff'
  }
});

module.exports = NativeIniticon;

@@ -94,17 +94,39 @@
 omponent
-,
+ %7D from 'react';%0Aimport
  PropTyp
@@ -127,30 +127,33 @@
 ropTypes
- %7D
  from '
-react
+prop-types
 ';%0A%0Aclas
@@ -1302,22 +1302,16 @@
   text: 
-React.
 PropType
@@ -1339,22 +1339,16 @@
   size: 
-React.
 PropType
@@ -1370,30 +1370,24 @@
 d,%0A  color: 
-React.
 PropTypes.an
@@ -1408,22 +1408,16 @@
 dColor: 
-React.
 PropType
@@ -1437,14 +1437,8 @@
 le: 
-React.
 Prop
@@ -1447,17 +1447,16 @@
 pes.bool
-,
 %0A%7D%0A%0Acons

Move PropTypes