Skip to content

Instantly share code, notes, and snippets.

{
"compilerOptions": {
"experimentalDecorators": true,
"allowJs": true
}
}
import mobx, { observable, action, computed } from "mobx";
class Store {
@observable todos=[];
@observable selectedStatus="all";
@action('adding todo item')
addTodo(todo){
this.todos.push({
id: this.todos[this.todos.length - 1].id +1,
status: false,
text: todo
import mobx, { observable, action } from "mobx";
class Store {
@observable todos=[];
@observable selectedStatus="all";
@action('adding todo item')
addTodo(todo){
this.todos.push({
id: this.todos[this.todos.length - 1].id +1,
status: false,
text: todo
import mobx, { observable } from "mobx";
class Store {
@observable todos=[];
@observable selectedStatus="all";
}
const todoStore = new Store()
export default todoStore;
@ysfzrn
ysfzrn / app.js
Created June 4, 2017 15:24
Example LayoutAnimation React Native
//import liraries
import React, { Component } from "react";
import { View, Text, StyleSheet, ScrollView,LayoutAnimation, StatusBar } from "react-native";
import FlexTab from "./flexTab";
import Header from './header'
// create a component
class App extends Component {
constructor() {
super();
this.state = {
@ysfzrn
ysfzrn / ListView.jsx
Created March 21, 2017 04:18
React Native ListView
//import liraries
import React, { Component } from "react";
import { View, Text, ListView, StyleSheet } from "react-native";
const rows = [
{ id: 1, text: "row1" },
{ id: 2, text: "row2" },
{ id: 3, text: "row3" },
{ id: 4, text: "row4" },
{ id: 5, text: "row5" },
@ysfzrn
ysfzrn / nginx.conf
Last active March 15, 2017 21:27
react-feathers-socket-bypass
#user nobody;
worker_processes 1;
#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
#pid logs/nginx.pid;
@ysfzrn
ysfzrn / RN-Main.jsx
Created March 12, 2017 01:04
React Native Todo List FlexBox Example
'use strict';
import React, { Component } from 'react';
import { StyleSheet,View, Text,TouchableOpacity,
TextInput, Platform } from 'react-native';
class Main extends Component {
render() {
return (
@ysfzrn
ysfzrn / cb.js
Created March 8, 2017 14:46
callbacketc
Trying to Save Callbacks
analytics.trackPurchase(purchaseData,function(){
tracked=true;
chargeCreditCard();
displayThankyouPage();
}
);
@ysfzrn
ysfzrn / app.js
Created March 8, 2017 14:46
reactnativequicenotes
React Native Quick Notes
-----------------------------------------
<View onLayout={this._handleLayout} />
------------------------------------------------------------
onLayout { nativeEvent : { layout: {x, y, width, height} } }
-This event is fired immediately once the layout has been calculated
-But the new layout may not yet be reflected on the screen at the same time the event is received
(Especially if a layout animation is in progress)