This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Utils from '../utils'; | |
... | |
export default class TodosContainer extends React.Component { | |
... | |
onAllData = (todos, streamData) => { | |
// merge streaming todos data along with current todos | |
const todosData = Utils.mergeTodos(todos, streamData); | |
// filter data based on "screen": [All | Active | Completed] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class TodoItem extends Component { | |
onTodoItemToggle = (todo, propAction) => { | |
propAction({ | |
...todo, | |
completed: !todo.completed, | |
}); | |
}; | |
render() { | |
const { todo, onUpdate, onDelete } = this.props; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
... | |
import { ScrollView, StyleSheet, StatusBar, FlatList, Text } from 'react-native'; | |
import CONSTANTS from '../constants'; | |
... | |
export default class TodosContainer extends React.Component { | |
... | |
onAllData = (todos, streamData) => { | |
// filter data based on "screen": [All | Active | Completed] | |
const filteredData = this.filterTodosData(todos); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
... | |
import { ReactiveList } from '@appbaseio/reactivesearch-native'; | |
... | |
export default class TodosContainer extends React.Component { | |
render() { | |
return ( | |
<View style={styles.container}> | |
<Header /> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
... | |
import AddTodoButton from './AddTodoButton'; | |
import AddTodo from './AddTodo'; | |
import TodoModel from '../api/todos'; | |
... | |
// will render todos based on the active screen: all, active or completed | |
export default class TodosContainer extends React.Component { | |
state = { | |
addingTodo: false, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class AddTodo extends Component { | |
constructor(props) { | |
super(props); | |
const { title, completed, createdAt } = this.props.todo; | |
this.state = { | |
title, | |
completed, | |
createdAt, | |
}; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Expo from 'expo'; | |
import React from 'react'; | |
import { StatusBar, View, Platform, Text, StyleSheet } from 'react-native'; | |
import { Container, Spinner } from 'native-base'; | |
import { ReactiveBase } from '@appbaseio/reactivesearch-native'; | |
import { appname, type, credentialsWrite, colors } from './utils/constants'; | |
export default class App extends React.Component { | |
state = { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export const appname = 'todomvc-auth'; // Elasticsearch index | |
export const credentialsRead = 'pVPf3rRLj:61fd73c0-3660-44db-8309-77d9d35d64cc'; | |
export const credentialsWrite = 'QiqJNlwfU:41a45e61-f761-44fe-947a-6f47de32ae0a'; | |
export const type = 'todo_reactjs'; // Elasticsearch type | |
export const url = 'https://scalr.api.appbase.io'; // Elasticsearch cluster | |
// Some nice colors I'm using in the app | |
const tintColor = '#2f95dc'; | |
export const colors = { |