Skip to content

Instantly share code, notes, and snippets.

@kiok46
kiok46 / bridge.md
Last active February 16, 2022 08:15
Bridge React-Native and JS

Content of the Gist is from a talk by Peggy Rayzis at Chain React 2017: Chain React 2017: Breaking Down Bridging in React Native by Peggy Rayzis


In order for a native code to talk to JS you would need a bridge.

  • You need to integrate a third-party SDK.
  • High perfomance is crutial
  • You are building a brownfiel app
  • You need access to a platform to a platform API. (Camera, Gyroscope etc.), You will need to use a opensource library or create a bridge.
@kiok46
kiok46 / Action_creaters_and_reducers.md
Last active May 10, 2021 23:17
Action Creator and reducers details and flow

Action Creators and Reducers.

why action creators? We want to minimize the responsibilities of anyone of our components, We want to make a component as simple and as dumb as possible, so all our compenent is going to do is show the UI. whenever our Component is going to do some logical work we would call the action creator.


Component -> renders the internal components -> need to do some action, let's say handle a button click
@kiok46
kiok46 / AsyncStorage.md
Created June 15, 2017 15:04
How to setup Async storage and store boolean(true/false) values.

AsyncStorage

Store information in local machine (Mobile).

import { AsyncStorage } from 'react-native';

import {
	AUTOCOMPLETE_SETTING,
	QUACK_ON_REFRESH_SETTING,
@kiok46
kiok46 / redux_setup.md
Last active February 15, 2021 01:02
Redux, store, actions and reducers setup along with explanation.

Redux Setup

Implementation of redux inside any react.js or react-native application,

  • we will create an instance of the redux store.
  • We are going to create a provider tag from react redux library
  • Then render that provider tag passing in the store as a prop, then any child component to this provider tag will have access to this store through the context system inside of react.
  • import { Provider } from ‘react-redux’; // In main.js
  • to create a store create one in a separate folder.
@kiok46
kiok46 / Designing_Distributed_Systems.md
Last active January 23, 2020 14:52
Designing Distributed Systems

The sidecar pattern

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.

Adding HTTPS to a Legacy Service

@kiok46
kiok46 / xpo
Created May 20, 2019 21:57
Verify myself: 16697699bc564ae385a4a0758fd4ea44 http://blockchain-devs.xpo.network #
Verify myself: 16697699bc564ae385a4a0758fd4ea44 http://blockchain-devs.xpo.network #
import multipleTapHandler from 'multipleTapHandler';
// Tap Event
const onTap = () => {
console.log("onTapEvent called.")
}
// Actual user Tap.
tap = multipleTapHandler(() => {onTap()})
// Multiple Tap Handler
const multipleTapHandler = (func, wait = 200) => {
let tapCount = 0
let handler;
return function() {
//console.log(tapCount)
if (tapCount === 0){
tapCount++;
func()
}
@kiok46
kiok46 / MultiTapHandlerWithReactExample.js
Created June 10, 2018 12:31
Preventing React-Navigation Multiple Screen Instances
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}