Skip to content

Instantly share code, notes, and snippets.

Avatar

Jim jneuendorf

  • emma blossom
  • Berlin, Germany
View GitHub Profile
@jneuendorf
jneuendorf / app-icons.js
Created Jun 4, 2018
Load vector icons as sourceMap in React Native
View app-icons.js
// Define all your icons once,
// load them once,
// and use everywhere
import Ionicons from 'react-native-vector-icons/Ionicons';
import FontAwesome from 'react-native-vector-icons/FontAwesome';
// define your suffixes by yourself..
// here we use active, big, small, very-big..
const replaceSuffixPattern = /--(active|big|small|very-big)/g;
@jneuendorf
jneuendorf / ConvertibleReactComponent.js
Last active Aug 21, 2017
A React component that can more easily be converted between a functional and class component than a React.Component during development
View ConvertibleReactComponent.js
class ConvertibleComponent extends React.Component {
render() {
return this[this.constructor.name](this.props);
}
}
// Lets say you have a component whose final code you aren't certain about yet.
// 1. as functional component:
function MyComponent(props) {
You can’t perform that action at this time.