Skip to content

Instantly share code, notes, and snippets.

View iremlopsum's full-sized avatar

Kristjan Vool iremlopsum

View GitHub Profile
import React, { PureComponent } from 'react'
import { View, TextInput, StyleSheet, Platform } from 'react-native';
class ExpandingTextInput extends PureComponent {
constructor(props) {
super(props)
this.state = {}
this.onContentSizeChange = this.onContentSizeChange.bind(this);
}
import React, { PureComponent } from 'react'
import { View, Text, StyleSheet, Dimensions } from 'react-native';
import ExpandingTextInput from 'components/expanding-text-input/ExpandingTextInput';
const { width: ww, height: wh } = Dimensions.get('window');
const VIEW_HEIGHT = Platform.OS === 'android' ? wh - 24 : wh;
const VIEW_WIDTH = ww;
const viewSize = {
width: VIEW_WIDTH,
height: VIEW_HEIGHT,
@iremlopsum
iremlopsum / WaitForUI.js
Last active December 19, 2020 22:24
InteractionManager example
import React, { PureComponent } from 'react';
import { InteractionManager } from 'react-native';
class WaitForUI extends PureComponent {
constructor(props) {
super(props);
this.state = {
interactionsComplete: false,
};
}
@iremlopsum
iremlopsum / hextorgba.js
Created November 21, 2017 12:09
hex to rgba mixin
export default (property, hex, alpha, extraProperties) => {
const isHex = ((hex) => {
return /(^#[0-9A-F]{6}$)|(^#[0-9A-F]{3}$)/i.test(hex)
});
const hexToRGB = ((hex) => {
if (isHex(hex)) {
const shorthandRegex = /^#?([a-f\d])([a-f\d])([a-f\d])$/i;
const fib = (n) => {
if (n == 0) {
return 0;
}
if (n == 1 || n == 2) {
f[n] = 1;
return f[n]
import React from 'react';
import Svg from 'react-native-svg';
import * as Icons from './icons';
const Icon = (props) => {
const {
icon
} = props;
if (!icon) {
import React, { PureComponent } from 'react';
// Import styles
import GeneralStyles from '../styles/GeneralStyles';
import FormElements from '../styles/FormElements';
import SearchScreenStyles from '../styles/SearchScreenStyles';
// Importing components
import CustomIcon from '../components/CustomIcon';
import SearchInput from '../components/SearchInput'
import React, { PureComponent } from 'react';
class App extends PureComponent {
componentWillMount() {
const url = 'api.openweathermap.org/data/2.5/weather?q=München,DE&appid=382aa7ad3501c6d4a564022372982343';
fetch(url).then((res) => {
if (res.status !== 200) {
console.log('Looks like there was a problem. Status Code: ' + res.status);
import React, { Component } from 'react';
import { Line } from 'react-chartjs-2';
import './app.scss';
class App extends Component {
constructor(props) {
super(props);
this.state = {