The sidecar pattern is a singlenode pattern made up of two containers. The first is the application container. It con‐ tains the core logic for the application. Without this container, the application would not exist. In addition to the application container, there is a sidecar container. The role of the sidecar is to augment and improve the application container, often without the application container’s knowledge.
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
Verify myself: 16697699bc564ae385a4a0758fd4ea44 http://blockchain-devs.xpo.network # |
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
// Multiple Tap Handler | |
const multipleTapHandler = (func, wait = 200) => { | |
let tapCount = 0 | |
let handler; | |
return function() { | |
//console.log(tapCount) | |
if (tapCount === 0){ | |
tapCount++; | |
func() | |
} |
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 React, { Component } from 'react'; | |
import { TouchableOpacity } from 'react-native'; | |
import PropTypes from 'prop-types'; | |
import multipleTapHandler from 'multipleTapHandler'; | |
class Button extends Component { | |
render() { | |
return ( | |
<TouchableOpacity | |
{...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 React, { Component } from 'react'; | |
import { AppRegistry, TextInput, View } from 'react-native'; | |
import { connect } from 'react-redux'; | |
import * as actions from '../redux/actions'; | |
class CustomTextInput extends Component { | |
onTextChange = text => { | |
this.props.textChanged(text); | |
}; |
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 { createStore, compose, applyMiddleware } from 'redux'; | |
import createSagaMiddleware from 'redux-saga'; | |
import { sagaMonitor } from '../../configs'; | |
import reducers from '../reducers'; // Our Reducers | |
import rootSaga from '../sagas'; // Our Sagas | |
const middleWare = []; | |
// Setup Redux-Saga | |
const sagaMiddleware = createSagaMiddleware({ sagaMonitor }); |
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 Reactotron from 'reactotron-react-native'; | |
import sagaPlugin from 'reactotron-redux-saga'; | |
import apisaucePlugin from 'reactotron-apisauce'; | |
Reactotron.configure({ name: 'GiftCard' }) | |
.useReactNative() | |
.use(apisaucePlugin()) | |
.use(sagaPlugin()); | |
Reactotron.connect(); // Connect with reactotron |
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 { put, take, fork } from 'redux-saga/effects'; | |
import { TEXT_CHANGED, TEXT_CHANGED_SUCCESS } from '../types'; | |
// **************** | |
// WORKERS | |
// **************** | |
function* workerTextChanged(action) { | |
console.log(action); | |
// {type: "text_changed", payload: "-_-"} |
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 { all, fork } from 'redux-saga/effects'; | |
import CustomTextInputSagas from './CustomTextInputSagas'; | |
export default function* rootSaga() { | |
yield all([ | |
fork(CustomTextInputSagas.watcherTextChanged), | |
]); | |
} |
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 { TEXT_CHANGED } from '../types'; | |
export const textChanged = text => { | |
return { | |
type: TEXT_CHANGED, | |
payload: text | |
}; | |
}; |
NewerOlder