Skip to content

Instantly share code, notes, and snippets.

@shawn-kb
shawn-kb / pressure.js
Created March 26, 2019 16:31
highcharts gauge attempt
import React from "react";
import { StyleSheet, Text, TextInput, Button, WebView, View, Platform } from "react-native";
import { Icon } from "react-native-elements";
import { NavigationActions, StackActions } from "react-navigation";
import ChartView from "react-native-highcharts";
import { ScreenOrientation } from "expo";
import PivotCircle from "../../components/PivotCircle";
@shawn-kb
shawn-kb / navigator.js
Created November 21, 2018 22:24
nesting drawer in tab nav
// in my MainTabNavigator
import RainMapScreen from '../screens/RainMapScreen';
import GroupMessageHistoryScreen from '../screens/GroupMessageHistoryScreen';
import GroupDrawer from './GroupDrawer'
export default createBottomTabNavigator(
{
GroupDrawer: {
screen: GroupDrawer,
@shawn-kb
shawn-kb / mysql.log
Created November 15, 2018 17:44
problem with join cluster
2018-11-15 11:42:22 140571112892160 [Note] WSREP: Quorum results:
version = 4,
component = PRIMARY,
conf_id = 69,
@shawn-kb
shawn-kb / async_function_in_objection.js
Created October 3, 2018 19:17
problem with async / await in objection
async function tryByMonitor(sensorObject, monitor){
const sensorQuery = sensorObject.query()
.select('*')
.where('monitor', monitor)
.limit(1)
.then(function (queryResult){
if (! queryResult.length ) return null
console.log(queryResult[0].monitor + " from function");
return queryResult[0];
})
@shawn-kb
shawn-kb / flatlist.js
Created August 3, 2018 19:54
call content from a function
render() {
if(stores.systemStore.preferToScroll == true){
return(
<View>
{this._renderRegisterDeviceModal}
<FlatList
data={stores.databaseStore.sites.slice()}
keyExtractor={ (item, index) => item.id}
key = {( stores.systemStore.preferToScroll ) ? 1 : 0}
numColumns={1}
@shawn-kb
shawn-kb / controlScreen.js
Created August 1, 2018 20:17
weird text and modal problem
<Modal
isVisible={this.state.confirmModalVisible}
backdropColor={'orange'}
backdropOpacity={1}
animationType={'slide'}
>
<View >
<Text> {this.state.activeCommandText} </Text>
<View style={styles.row} >
@shawn-kb
shawn-kb / SiteDrawer.js
Created March 6, 2018 22:11
problem with site drawer
import React from 'react';
import { NavigationActions, DrawerNavigator } from 'react-navigation';
import RootNavigation from './RootNavigation';
import { Text } from 'react-native';
import { Icon, Button } from 'react-native-elements';
import SiteDetailsScreen from '../screens/SiteDetailsScreen';
import SiteHistoryScreen from '../screens/SiteHistoryScreen';
import SiteMessageHistoryScreen from '../screens/SiteMessageHistoryScreen';
@shawn-kb
shawn-kb / SiteTabNavigator.js
Created February 23, 2018 22:14
how its called
class HomeIconComponent extends React.Component {
handleNavigation = () => {
const { navigation, focused } = this.props
if (!focused){
navigation.navigate("Home")
}else if (navigation.state.index == 0){
if (navigation.state.routes[navigation.state.index].index != 0){
navigation.goBack(null)
@shawn-kb
shawn-kb / rootstacknavigator.js
Created February 23, 2018 21:40
root navigator
import {AppLoading, Notifications } from 'expo';
import React from 'react';
import { StackNavigator, NavigateActions} from 'react-navigation';
// importing login here instead of in MainTabNavigator.js because it should never go into the tabNav
import LoginScreen from '../screens/LoginScreen';
import MainTabNavigator from './MainTabNavigator';
import SiteTabNavigator from './SiteTabNavigator';
import registerForPushNotificationsAsync from '../api/registerForPushNotificationsAsync';
@shawn-kb
shawn-kb / SiteTabNavigator.js
Created February 23, 2018 17:13
navigating back or popping the stack
function backToSummary(){
console.log("running back to summary")
const resetAction = NavigationActions.reset({
index: 0,
actions: [NavigationActions.navigate({routeName: 'Main'})]
})
this.props.navigation.dispatch(resetAction);
}
/*