Skip to content

Instantly share code, notes, and snippets.

View woshi82's full-sized avatar

Zengyanling woshi82

View GitHub Profile
// react-native webview onMessage and postMessage BUG https://github.com/facebook/react-native/issues/10865
import React, { Component } from 'react';
import {
AppRegistry,
StyleSheet,
Text,
WebView,
ScrollView,
/**
* 该方法仅支持IE8以上
* 网络请求方法
* url:请求地址
* options = {
* catchs: 异常处理,控制台抛出的异常是否自己处理:true 是,false 否 由公共方法统一处理优化显示给用户 默认 false
* credentials: 请求带上cookies,是每次请求保持会话一直
* method: 请求使用的方法,如 GET、POST
* headers: 请求的头信息,形式为 Headers 对象或 ByteString。
* body: 请求的 body 信息:可能是一个 Blob、BufferSource、FormData、URLSearchParams 或者 USVString 对象。注意 GET 或 HEAD 方法的请求不能包含 body 信息。
var webpack = require('webpack')
var webpackDevMiddleware = require('webpack-dev-middleware')
var webpackHotMiddleware = require('webpack-hot-middleware')
var config = require('./webpack.config')
var app = new (require('express'))()
var port = 3000
var compiler = webpack(config)
app.use(webpackDevMiddleware(compiler, { noInfo: true, publicPath: config.output.publicPath }))
/*
* Webpack distribution configuration
*
* This file is set up for serving the distribution version. It will be compiled to dist/ by default
*/
'use strict';
var webpack = require('webpack');
'use strict';
var mountFolder = function (connect, dir) {
return connect.static(require('path').resolve(dir));
};
var webpackDistConfig = require('./webpack.dist.config.js'),
webpackDevConfig = require('./webpack.config.js');
module.exports = function (grunt) {
// var browserifyES6Transpiler = require('browserify-es6-transpiler');
var babelify = require('babelify');
// fis3 模块化开发支持
fis.config.set('settings.preprocessor.browserify', {
browserify: {
debug: true,
transform: [
[
babelify,
@woshi82
woshi82 / .eslintrc
Created December 6, 2016 15:05 — forked from sunnylqm/.eslintrc
eslint for reactnative
{
"extends": "airbnb",
"parser": "babel-eslint",
"env": {
"browser": true,
"node": true,
"mocha": true
},
"rules": {
// Disable for __DEV__, __SERVER__ usage.
'use strict';
export default createReducer(initialState, handlers) {
return function reducer(state = initialState, action) {
if (handlers.hasOwnProperty(action.type)) {
return handlers[action.type](state, action);
} else {
return state;
}
}
@woshi82
woshi82 / CustomStyleSheet.js
Created November 30, 2016 06:19
RN Platform.select()
/**
* @flow
*/
'use strict';
import {StyleSheet, Platform} from 'react-native';
function create(styles: Object): {[name: string]: number} {