Skip to content

Instantly share code, notes, and snippets.

View brentvatne's full-sized avatar
😶‍🌫️
☕️⚛️🏃‍♂️🐶🎸

Brent Vatne brentvatne

😶‍🌫️
☕️⚛️🏃‍♂️🐶🎸
View GitHub Profile
/**
* @providesModule IncrementalListView
*/
'use strict';
var InteractionManager = require('InteractionManager');
var LayoutAnimation = require('LayoutAnimation');
var ListViewDataSource = require('ListViewDataSource');
var RCTScrollViewManager = require('NativeModules').ScrollViewManager;
var React = require('React');

NavigationExperimental notes

Containers

RootNavigationContainer

  • You pass the reducer to this, it actually ultimately receives all navigation calls via onNavigate, which is mostly equivalent to Redux dispatch. It setState and persisting state. it is like the redux "store"
/**
* Sample React Native App
* https://github.com/facebook/react-native
*/
import React, { Component } from 'react';
import {
AppRegistry,
StyleSheet,
Text,
/**
* @providesModule AuthenticationScreen
* @flow
*/
export default class AuthenticationScreen extends React.Component {
render() {
// vvv typo on styles.container, but Flow doesn't care
return (
<View style={styles.continer} />
╭─ ~/universe/apps/rnplay flow
node_modules/react-native/Libraries/StyleSheet/StyleSheet.js:135
135: for (var key in obj) {
^^^ T. This type is incompatible with
135: for (var key in obj) {
^ iteration expected on object
node_modules/react-native/Libraries/StyleSheet/StyleSheet.js:137
137: result[key] = ReactNativePropRegistry.register(obj[key]);
^^^^^^^^ access of computed property/element. Computed property/element cannot be accessed on
setTimeout(function() {
postMessage('hello there');
}, 500);
onmessage = function(e) {
console.log('Message received from main script');
var workerResult = 'Result: ' + (e.data[0] * e.data[1]);
console.log('Posting message back to main script');
postMessage(workerResult);
}
@brentvatne
brentvatne / Effect.js
Last active April 13, 2017 00:12
redux-saga alternative with async/await?
/**
* @providesModule Effects
* @flow
*/
import { Linking } from 'react-native';
import AppDataApi from 'AppDataApi';
import Actions from 'Actions';
import ActionTypes from 'ActionTypes';
module.exports = ({ url, iosManifest, config }) => {
const { webhookUrl } = config;
const slack = require('slack-notify')(webhookUrl);
return new Promise((resolve, reject) => {
slack.send(
{
icon_url: iosManifest.iconUrl,
text: `${iosManifest.name} v${iosManifest.version} published to ${url}`,
unfurl_links: 0,
{
"description": "Other exp.json fields go here, removed to make it easy to read.",
"hooks": {
"postPublish": [
{
"file": "expo-postpublish-slack-notify",
"config": {
"webhookUrl": "https://hooks.slack.com/put-your-stuff-here"
}
}