Skip to content

Instantly share code, notes, and snippets.

View mjstelly's full-sized avatar
🚅
React Native Developer

bulletproofapps™ mjstelly

🚅
React Native Developer
  • bulletproofapps™
  • Tulsa, OK
  • 14:09 (UTC -05:00)
View GitHub Profile
@mjstelly
mjstelly / App.tsx
Last active March 18, 2021 19:03
implement react-navigation with typescript
import React from 'react';
import { createAppContainer } from 'react-navigation';
import { NavigationContainer } from "@react-navigation/native";
import { createStackNavigator } from '@react-navigation/stack';
import ColorScreen from './src/screens/ColorScreen';
import ComponentsScreen from './src/screens/ComponentsScreen';
import CounterScreen from './src/screens/CounterScreen';
import HomeScreen from './src/screens/HomeScreen';
import ImageScreen from './src/screens/ImageScreen';
@mjstelly
mjstelly / SquareScreen.js
Created March 8, 2021 15:38
Debugging state errors
import React, { useReducer } from 'react';
import { Text, View, StyleSheet } from 'react-native';
import ColorCounter from '../components/ColorCounter';
const COLOR_INCREMENT = 15;
const reducer = (state, action) => {
//state === {red: number, green: number, blue: number}
//action === {colorToChange: red || green || blue, amount: 15 || -15}
@mjstelly
mjstelly / test.js
Created July 5, 2020 17:36
redux action fails
//calling module
import { setTab } from "../../../shared/store/actions/navAction";
<Tab
label={translate.tabAll}
selected={tab === 1}
onPress={() => {
setTab(1); //no console response when selected
}}
/>
@mjstelly
mjstelly / App.js
Last active May 29, 2020 16:03
Updated working RealmDB example
import React from 'react';
import {View, Text, StyleSheet, Button, Alert} from 'react-native';
import Realm from 'realm';
const styles = StyleSheet.create({
container: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
},
welcome: {
/*
@module /components/AddReservation
@description Allow a user to book a reservation
List all props here -------
@param description
@param title
---------------------------
@mjstelly
mjstelly / app.js
Last active March 4, 2019 13:24
Apollo Boost - My react native app.js
import React, { Component } from 'react'
import AppNavigator from './AppNavigator'
import { ApolloProvider, graphql } from 'react-apollo'
import { ApolloClient, HttpLink, InMemoryCache } from 'apollo-boost'
const client = new ApolloClient({
link: new HttpLink({
uri:
'https://your-graphql-endpoint'
}),