Skip to content

Instantly share code, notes, and snippets.

View ckdevrel's full-sized avatar

Chandrasekar Kuppusamy ckdevrel

View GitHub Profile
mAdapter.SetOnItemClickListener(new RecyclerViewAdapter.OnItemClickListener() {
@Override
public void onItemClick(View view, int position, AbstractModel model) {
//Do your stuff
}
});
class Button extends Component {
state = {
text: 'Failure'
}
updateButtonText = () ⇒ this.setState({ text: 'Success' })
render() {
return (
<View>
JAVA React Native
1. public class App { class App extends Component {
Props probs = new Props(); render() {
props.setTitle("Awesome React"); return (
Toolbar toolbar = new Toolbar(props); <Toolbar
title='Awesome React' />
//Do your stuff );
} }
}
JAVA React Native
1. public class Toolbar { const Toolbar = (props) => {
private String mTitle; return (
public Toolbar(Props props){ <Text>{props.title} </Text>
this.mTitle = props.getTitle(); );
};
}
}
@ckdevrel
ckdevrel / index.js
Last active October 31, 2017 20:22
import React from 'react';
import { AppRegistry } from 'react-native';
import App from './src/components/importcomponentdemo';
const App = () => (
<Title />
);
AppRegistry.registerComponent('ComponentDemo', () => App);
import React from 'react';
import { Text } from 'react-native';
const Title = () => (
<Text>Hello Title</Text>
);
export default Title;
@ckdevrel
ckdevrel / index.js
Last active October 31, 2017 17:59
import React from 'react';
import { Text, AppRegistry } from 'react-native';
const App = () => (
<Text>Hello Component!</Text>
);
AppRegistry.registerComponent('ComponentDemo', () => App);

Simple RecyclerView (List & Grid)

VERTICAL:

HORIZONTAL:

<#if layoutmanager == 'grid'>
GridLayoutManager layoutManager = new GridLayoutManager(${activityClass}.this, 2);
recyclerView.addItemDecoration(new GridMarginDecoration(${activityClass}.this, 2, 2, 2, 2));
<#else>
LinearLayoutManager layoutManager = new LinearLayoutManager(this);
</#if>
recyclerView.setLayoutManager(layoutManager);
<#if features == 'banner'>
<#include "YOUR_LAYOUT_FOR_BANNER_RECYCLERVIEW.xml.ftl"/>
<#elseif features == 'section'>
<#include "YOUR_LAYOUT_FOR_SECTION_RECYCLERVIEW.xml.ftl"/>
<#else>
<#include "YOUR_DEFAULT_LAYOUT_TO_REMAINING_RECYCLERVIEW_STYLES.xml.ftl"/></#if>