Skip to content

Instantly share code, notes, and snippets.

View itelo's full-sized avatar
🎯
Focusing

itelo itelo

🎯
Focusing
View GitHub Profile
@itelo
itelo / init.ts
Last active April 22, 2020 17:04
async function starting() {
print.info(`creating a react project`)
}
module.exports = {
name: 'init',
alias: ['init'],
run: async (toolbox: GluegunToolbox) => {
/**
* initing global/local variables
@itelo
itelo / machine.js
Created April 4, 2020 22:10
Generated by XState Viz: https://xstate.js.org/viz
Machine({
id: 'authentication',
initial: 'unauthorized',
context: {
user: null,
error: null,
},
states: {
unauthorized: {
on: {
@itelo
itelo / machine.js
Created April 11, 2020 23:43
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
// - XState (all XState exports)
module.exports = {
presets: ['module:metro-react-native-babel-preset'],
plugins: [
[
require.resolve('babel-plugin-module-resolver'),
{
alias: {
'@mycooluilib/assets': './src/assets',
'@mycooluilib/components': './src/components',
'@mycooluilib/utils': './src/utils',
import React from 'react';
import {
StyleSheet,
TouchableOpacity,
Text,
TouchableOpacityProps,
} from 'react-native';
const styles = StyleSheet.create({
button: {
import React from 'react';
import {storiesOf} from '@storybook/react-native';
import Button from './Button';
storiesOf('Button', module)
.add('default button', () => <Button>Hello Storybook</Button>)
.add('button with prop color = red', () => (
<Button color="red">Hello Storybook</Button>
));
import {AppRegistry} from 'react-native';
import {getStorybookUI, configure} from '@storybook/react-native';
import {loadStories} from './storyLoader';
import './rn-addons';
// import stories
configure(() => {
loadStories();
}, module);
import React from 'react';
import {render} from 'react-native-testing-library';
import Button from './Button';
describe('<Button />', () => {
it('testing color default', () => {
const view = render(<Button>Hello Testing Library</Button>);
expect(view.toJSON()?.props.style.backgroundColor).toBe('blue');
});
{
"extends": "./tsconfig.json",
"compilerOptions": {
"jsx": "react", /* Specify JSX code generation: 'preserve', 'react-native', or 'react'. */
"declaration": true, /* Generates corresponding '.d.ts' file. */
"sourceMap": true, /* Generates corresponding '.map' file. */
"outDir": "./build", /* Redirect output structure to the directory. */
"noEmit": false, /* Do not emit outputs. */
"skipLibCheck": true
/**
* @format
*/
import {AppRegistry} from 'react-native';
import App from './storybook';
import {name as appName} from './app.json';
AppRegistry.registerComponent(appName, () => App);