Instantly share code, notes, and snippets.

View buildconfigapikey.groovy
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt')
, 'proguard-rules.pro'
}
applicationVariants.all { variant ->
variant.buildConfigField "String", "GOOGLE_MAPS_API_KEY"
View manifestapikey.xml
<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="${GOOGLE_MAPS_API_KEY}" />
View manifestplaceholdersapikey.groovy
defaultConfig {
defaultPublishConfig 'debug'
applicationId "YOUR_APPLICATION_ID"
minSdkVersion 19
targetSdkVersion 27
versionCode 1000
versionName '0.1.0'
manifestPlaceholders = [ GOOGLE_MAPS_API_KEY:getApiKey()]
}
View readkey.groovy
def getApiKey(){
def Properties props = new Properties()
props.load(new FileInputStream(new File('secrets.properties')))
return props['GOOGLE_MAPS_API_KEY']
}
View recycleradaptercallback.java
mAdapter.SetOnItemClickListener(new RecyclerViewAdapter.OnItemClickListener() {
@Override
public void onItemClick(View view, int position, AbstractModel model) {
//Do your stuff
}
});
View statedemo.java
class Button extends Component {
state = {
text: 'Failure'
}
updateButtonText = () ⇒ this.setState({ text: 'Success' })
render() {
return (
<View>
View propstab2.java
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 );
} }
}
View propstab1java.java
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(); );
};
}
}
View index.js
import React from 'react';
import { AppRegistry } from 'react-native';
import App from './src/components/importcomponentdemo';
const App = () => (
<Title />
);
AppRegistry.registerComponent('ComponentDemo', () => App);
View importcomponentdemo.js
import React from 'react';
import { Text } from 'react-native';
const Title = () => (
<Text>Hello Title</Text>
);
export default Title;