diff --git a/app/CommentItem.js b/app/CommentItem.js
index c9e1657..fe19089 100644
--- a/app/CommentItem.js
+++ b/app/CommentItem.js
@@ -1,54 +1,55 @@
"use strict";
-
-var React = require("react-native");
-var {
+import React, {
+ Component,
Image,
StyleSheet,
PixelRatio,
Text,
TouchableHighlight,
View,
- Component,
Dimensions
-} = React;
+} from 'react-native';
-var Icon = require("react-native-vector-icons/FontAwesome"),
- getImage = require("./helpers/getImage"),
- HTML = require("react-native-htmlview"),
- screen = Dimensions.get('window');
+import * as getImage from './helpers/getImage';
+import { Icon } from 'react-native-vector-icons/FontAwesome';
+import HTML from 'react-native-htmlview';
+const screen = Dimensions.get('window');
-var CommentItem = React.createClass({
- getDefaultProps: function() {
- return {
- comments: []
- }
- },
+export default class CommentItem extends Component {
+ constructor(props) {
+ super(props);
+ }//constructor
- render: function() {
- return
-
-
-
-
-
-
- {this.props.comment.user.name}
-
-
-
-
+ render() {
+ return (
+
+
+
+
+
+
+
+ {this.props.comment.user.name}
+
+
+
+
+
+
-
-
-
- ;
- }
-});
+
+
+ )//return
+ }//render
+}//class
+CommentItem.propTypes = {comments: React.PropTypes.array.isRequired};
+CommentItem.defaultProps = {comments: []};
-var styles = StyleSheet.create({
+const styles = StyleSheet.create({
commentContent: {
padding: 10,
flex: 1,
@@ -80,5 +81,3 @@ var styles = StyleSheet.create({
marginRight: 10
}
});
-
-module.exports = CommentItem;
diff --git a/app/ShotCell.js b/app/ShotCell.js
index e797a13..d0fc4ed 100644
--- a/app/ShotCell.js
+++ b/app/ShotCell.js
@@ -1,7 +1,7 @@
"use strict";
-var React = require("react-native");
-var {
+import React, {
+ Component,
Image,
PixelRatio,
StyleSheet,
@@ -9,13 +9,16 @@ var {
TouchableHighlight,
View,
Dimensions
-} = React;
+} from 'react-native';
-var getImage = require("./helpers/getImage"),
- screen = Dimensions.get('window');
+import * as getImage from "./helpers/getImage";
+const screen = Dimensions.get('window');
-var ShotCell = React.createClass({
- render: function() {
+export default class ShotCell extends Component {
+ constructor(props) {
+ super(props);
+ }
+ render() {
return (
@@ -29,11 +32,11 @@ var ShotCell = React.createClass({
- );
- }
-});
+ )//return
+ }//render
+};//class
-var styles = StyleSheet.create({
+const styles = StyleSheet.create({
textContainer: {
flex: 1,
},
@@ -54,5 +57,3 @@ var styles = StyleSheet.create({
marginLeft: 4,
},
});
-
-module.exports = ShotCell;
diff --git a/app/helpers/getImage.js b/app/helpers/getImage.js
index eb20676..dd90222 100644
--- a/app/helpers/getImage.js
+++ b/app/helpers/getImage.js
@@ -1,18 +1,17 @@
'use strict';
-module.exports = {
- shotImage: function(shot: Object): {uri: ?string} {
- var uri = shot.images.normal ? shot.images.normal : shot.images.teaser;
+export function shotImage(shot: Object): {uri: ?string} {
+ var uri = shot.images.normal ? shot.images.normal : shot.images.teaser;
+ return {uri};
+}
+
+export function authorAvatar(player: Object): {uri: ?string} {
+ var uri;
+ if (player) {
+ uri = player.avatar_url;
return {uri};
- },
- authorAvatar: function(player: Object): {uri: ?string} {
- var uri;
- if (player) {
- uri = player.avatar_url;
- return {uri};
- } else {
- uri = require('../../img/AuthorAvatar.png');
- return uri;
- }
+ } else {
+ uri = require('../../img/AuthorAvatar.png');
+ return uri;
}
}
diff --git a/index.ios.js b/index.ios.js
index 95465c5..dfc8d28 100644
--- a/index.ios.js
+++ b/index.ios.js
@@ -3,28 +3,31 @@
* Github url: https://github.com/catalinmiron/react-native-dribbble-app
*/
"use strict";
-
-var React = require("react-native");
-var {
+import React, {
+ Component,
AppRegistry,
NavigatorIOS,
StyleSheet,
TabBarIOS,
View,
Text
-} = React;
+} from 'react-native';
-var ShotList = require("./app/ShotList"),
- Icon = require("react-native-vector-icons/FontAwesome");
+const ShotList = require("./app/ShotList"),
+ Icon = require("react-native-vector-icons/FontAwesome");
-var DribbbleApp = React.createClass({
- getInitialState: function() {
- return {
- selectedTab: "default"
- };
- },
+export default class DribbbleApp extends Component {
+ constructor(props) {
+ super(props);
- _renderContent: function(category: string, title: ?string) {
+ this.state = {
+ selectedTab: "default"
+ }
+ }//constructor
+
+ //_renderContent(category: string, title: ?string) {
+ _renderContent(category, title) {
+ console.log(arguments);
return (
);
- },
+ };
- render: function() {
+ render() {
return (
- );
- }
-});
+ ) //return
+ } //render
+}//class
-var styles = StyleSheet.create({
+const styles = StyleSheet.create({
tabContent: {
flex: 1,
alignItems: "center",
@@ -107,5 +110,3 @@ var styles = StyleSheet.create({
});
AppRegistry.registerComponent("DribbbleApp", () => DribbbleApp);
-
-module.exports = DribbbleApp;