Skip to content

Instantly share code, notes, and snippets.

View peterpme's full-sized avatar
🏠
Working from home

Peter Piekarczyk peterpme

🏠
Working from home
View GitHub Profile
@peterpme
peterpme / loading.js
Created April 18, 2018 02:23
LOADING
class InfoScreen extends React.PureComponent {
render() {
if (this.props.loading) return <ActivityIndicator />
return (
<View style={styles.container}>
<Text>Hi</Text>
</View>
)
}
}
@peterpme
peterpme / Label.jsx
Last active March 2, 2018 19:10
ReactJS Component Label for Medium
import React from 'react'
import { View, Text, StyleSheet } from 'react-native'
const Label = ({ label }) => (
<View style={styles.container}>
<Text style={styles.label}>{label}</Text>
</View>
)
const styles = StyleSheet.create({
@peterpme
peterpme / User.graphql
Last active March 1, 2018 05:47
User Mutation Clarification - imagine User having 20 keys, 5 of which are non-nullable (email_verified: Boolean!)
type User = {
id: ID!
first_name: String
last_name: String
email_verified: Boolean!
}
input UpdateUserInput {
first_name: String
last_name: String
@peterpme
peterpme / Label.re
Last active March 3, 2018 19:01
Reason Label
open BsReactNative;
let component = ReasonReact.statelessComponent("Label");
let styles =
StyleSheet.create(
Style.(
{
"container":
style([
@peterpme
peterpme / bsconfig.json
Created February 27, 2018 18:33
React Native + ReasonML bsconfig.json
{
"name": "altos-react-native",
"reason": {"react-jsx" : 2},
"bsc-flags": ["-bs-super-errors"],
"package-specs": [{
"module": "commonjs",
"in-source": true
}],
"suffix": ".bs.js",
"namespace": true,
@peterpme
peterpme / ScrollView.js
Created February 3, 2018 08:00
React Native ScrollView & flexGrow
const Layout = () => (
<ScrollView
contentContainerStyle={{
flexGrow: 1,
justifyContent: 'space-between'
}}>
<Row />
<Row />
<Row />
<Row />
@peterpme
peterpme / ScrollView.js
Last active February 3, 2018 07:55
React Native's ScrollView Tricks
const Layout = () => (
<ScrollView
contentContainerStyle={{
flex: 1,
justifyContent: 'space-between'
}}>
<Row />
<Row />
<Row />
<Row />
@peterpme
peterpme / environment.js
Last active June 1, 2018 13:33
Psuedo Environment Variables using Expo Release Channels
import { Constants } from 'expo'
const ENV = {
dev: {
apiUrl: 'http://localhost:1337/api'
},
staging: {
apiUrl: 'https://staging.orchard.ai/api'
},
prod: {
@peterpme
peterpme / updateResponse.js
Created December 30, 2017 21:29
React Apollo updateResponse Question
updateUser: (variables) => {
return mutate({
variables,
// when using optimisticResponse and I don't include the values, I get a warning.
optimisticResponse: {
updateUser: {
__typename: 'User',
id: 'xyz',
setting: undefined,

Keybase proof

I hereby claim:

  • I am peterpme on github.
  • I am peterpme (https://keybase.io/peterpme) on keybase.
  • I have a public key ASDd9ipiMIdjkzvqnBaqXLvRHaN2-tVZtgHng-YSVYRv4Ao

To claim this, I am signing this object: