Skip to content

Instantly share code, notes, and snippets.

View knowbody's full-sized avatar
🏠
Yolo.

Mateusz Zatorski knowbody

🏠
Yolo.
View GitHub Profile
@knowbody
knowbody / RNfontWeights.js
Created July 14, 2016 13:42
React Native Font Weight Cheatsheet iOS
{ fontWeight: '100' }, // Thin
{ fontWeight: '200' }, // Ultra Light
{ fontWeight: '300' }, // Light
{ fontWeight: '400' }, // Regular
{ fontWeight: '500' }, // Medium
{ fontWeight: '600' }, // Semibold
{ fontWeight: '700' }, // Bold
{ fontWeight: '800' }, // Heavy
{ fontWeight: '900' }, // Black
@knowbody
knowbody / DatabaseInJTable.java
Created March 12, 2013 00:55
Connecting Java with MS Access Database: 1. Click START >>> Control Panel >>> Administrative Tools >>> ODBC Data Sources (32-bit) IMPORTANT: if your Java version is 32-bit you use 32-bit ODBC Data Sources if 64-bit than 64-bit ODBC Data Sources \\\\\ 2. Go to 'System DSN' tab and click 'Add' button and then select the driver Microsoft Access Dri…
import java.awt.BorderLayout;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.ResultSetMetaData;
import java.sql.Statement;
import java.util.Vector;
import javax.swing.JFrame;
import javax.swing.JPanel;
@knowbody
knowbody / Spinner.js
Created April 6, 2017 12:27
Spinner - using styled-components
import React from 'react';
import styled from 'styled-components';
const Spinner = () => (
<StyledSpinner viewBox="0 0 50 50">
<circle
className="path"
cx="25"
cy="25"
r="20"
@knowbody
knowbody / App.js
Last active September 11, 2023 09:31
Check internet connection in React Native app
// quick snippet to check the connection in your RN app
// dispatches an `setIsConnected` action every time the NetInfo changes (on/off network)
componentDidMount() {
const dispatchConnected = isConnected => this.props.dispatch(setIsConnected(isConnected));
NetInfo.isConnected.fetch().then().done(() => {
NetInfo.isConnected.addEventListener('change', dispatchConnected);
});
}
@knowbody
knowbody / ex-navigation.md
Last active July 17, 2023 10:14
My exponent's ex-navigation docs/thoughts

Exponent - ex-navigation

This is for now, for my personal use only, things might not be correctly explained here. For the official docs please check: https://github.com/exponentjs/ex-navigation/blob/master/README.md

Navigation bar configuration

On every screen you can use the built-in navigation bar, you can add a title, left button, right button or change navigation bar’s style. All you need to do is pass appropriate params to navigationBar in the route configuration:

import React, { Component } from 'react';
@knowbody
knowbody / CameraApp.js
Last active December 28, 2020 06:23
Example CameraApp component, allows to take a photo and upload it to Amazon S3 bucket - blog post (https://medium.com/@knowbody/react-native-image-upload-to-s3-bucket-5220941bfea2#.9l2o8nmyf)
import React, { Component } from 'react';
import { AppRegistry, CameraRoll, Dimensions, View, StyleSheet } from 'react-native';
import Camera from 'react-native-camera';
import { Button } from 'react-native-vector-icons/Ionicons';
import { RNS3 } from 'react-native-aws3';
class CameraApp extends Component {
constructor() {
super();
@knowbody
knowbody / circle.yml
Created May 31, 2017 07:59
Zeit now.sh and CircleCI config
machine:
environment:
PATH: "${PATH}:${HOME}/${CIRCLE_PROJECT_REPONAME}/node_modules/.bin"
node:
version: 7.10.0
dependencies:
override:
- yarn
cache_directories:
@knowbody
knowbody / clickOutside.js
Created November 4, 2015 16:10
React onClickOutside
componentDidMount() {
document.body.addEventListener('click', this.handleBodyClick);
}
componentWillUnmount() {
document.body.removeEventListener('click', this.handleBodyClick);
}
handleBodyClick(e) {
const area = this.refs.item.getDOMNode();
@knowbody
knowbody / ProfileBadge.js
Created May 4, 2016 09:36
Profile badge component
import React, { PropTypes } from 'react';
import { View, Text, StyleSheet } from 'react-native';
const colors = [
'salmon', 'tomato', 'gold', 'yellowgreen', 'deepskyblue',
'mediumspringgreen', 'darkturquoise', 'lightcoral', 'teal',
'maroon', 'mediumseagreen', 'peru', 'plum', 'cadetblue',
'darkorchid', 'palevioletred', 'lightgreen', 'limegreen',
'indigo', 'coral', 'chocolate', 'orangered', 'lightskyblue'
];
@knowbody
knowbody / ScrollTabBar.js
Created September 28, 2016 14:17
ScrollTabBar for react-native-tab-view
import React, { Component } from 'react';
import {
Animated,
Dimensions,
StyleSheet,
ScrollView,
TouchableOpacity,
View,
Text,
} from 'react-native';