Skip to content

Instantly share code, notes, and snippets.

@reactnative
Last active August 29, 2015 14:14
Show Gist options
  • Save reactnative/122e5b0063f2311303e7 to your computer and use it in GitHub Desktop.
Save reactnative/122e5b0063f2311303e7 to your computer and use it in GitHub Desktop.
ReactJSConf snippets
//[...]
var getImageSource = require('./getImageSource');
var MovieCell = React.createClass({
render: function() {
return (
<View>
<TouchableHighlight onPress={this.props.onselect}>
<View style={styles.row}>
<Image
source={getImageSource(this.props.movie, 'det')}
style={styles.cellImage}
/>
<View style={styles.textContainer}>
<Text style={styles.movieTitle} numberOfLines={2}>
{this.props.movie.title}
</Text>
<Text style={styles.movieYear} numberOfLines={1}>
{this.props.movie.year}
</Text>
</View>
</View>
</TouchableHighlight>
<View style={styles.cellBorder} />
</View>
);
}
});
//[...]
var MoviesApp = React.createClass({
render: function() {
return (
<NavigatorIOS
style={styles.container}
initialRoute={{title: 'Movies', component: <SearchScreen >}}
routeMapper={MoviesRouteMapper}
/>
);
}
});`
`var styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: 'white',
}
});
module.exports = MoviesApp;
#import "RKView.h"
#import <UiKit/UIKit.h>
#import <FBReactKit/UIView+FBReactKit.h>
#import "UIView+FBReactKit.h"
@interface RKView : UIView
var styles = {
movieTitle: {
flex: 1,
fontSize: 16,
fontWeight: 'bold',
marginBottom: 2,
},
movieYear: {
color: '#999999',
fontSize: 12
},
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment