mirror of
https://github.com/status-im/react-native.git
synced 2025-02-05 22:23:37 +00:00
Merge pull request #2443 from mkonicek/Updates_Wed_26_Aug
Updates from Wed 26 Aug
This commit is contained in:
commit
57adecc36e
@ -0,0 +1,46 @@
|
||||
/**
|
||||
* Copyright (c) 2015-present, Facebook, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under the BSD-style license found in the
|
||||
* LICENSE file in the root directory of this source tree. An additional grant
|
||||
* of patent rights can be found in the PATENTS file in the same directory.
|
||||
*
|
||||
* @providesModule TouchableNativeFeedback
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
var React = require('React');
|
||||
var StyleSheet = require('StyleSheet');
|
||||
var Text = require('Text');
|
||||
var View = require('View');
|
||||
|
||||
var DummyTouchableNativeFeedback = React.createClass({
|
||||
render: function() {
|
||||
return (
|
||||
<View style={[styles.container, this.props.style]}>
|
||||
<Text style={styles.info}>TouchableNativeFeedback is not supported on this platform!</Text>
|
||||
</View>
|
||||
);
|
||||
},
|
||||
});
|
||||
|
||||
var styles = StyleSheet.create({
|
||||
container: {
|
||||
height: 100,
|
||||
width: 300,
|
||||
backgroundColor: '#ffbcbc',
|
||||
borderWidth: 1,
|
||||
borderColor: 'red',
|
||||
alignItems: 'center',
|
||||
justifyContent: 'center',
|
||||
margin: 10,
|
||||
},
|
||||
info: {
|
||||
color: '#333333',
|
||||
margin: 20,
|
||||
}
|
||||
});
|
||||
|
||||
module.exports = DummyTouchableNativeFeedback;
|
@ -267,6 +267,10 @@ var View = React.createClass({
|
||||
shouldRasterizeIOS: PropTypes.bool,
|
||||
|
||||
/**
|
||||
* Views that are only used to layout their children or otherwise don't draw
|
||||
* anything may be automatically removed from the native hierarchy as an
|
||||
* optimization. Set this property to `false` to disable this optimization and
|
||||
* ensure that this View exists in the native view hierarchy.
|
||||
* @platform android
|
||||
*/
|
||||
collapsable: PropTypes.bool,
|
||||
|
@ -24,6 +24,7 @@ ReactNativeViewAttributes.UIView = {
|
||||
accessibilityTraits: true,
|
||||
importantForAccessibility: true,
|
||||
testID: true,
|
||||
renderToHardwareTextureAndroid: true,
|
||||
shouldRasterizeIOS: true,
|
||||
onLayout: true,
|
||||
onAccessibilityTap: true,
|
||||
|
@ -1,17 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Copyright (c) 2015-present, Facebook, Inc.
|
||||
# All rights reserved.
|
||||
#
|
||||
# This source code is licensed under the BSD-style license found in the
|
||||
# LICENSE file in the root directory of this source tree. An additional grant
|
||||
# of patent rights can be found in the PATENTS file in the same directory.
|
||||
|
||||
# Set terminal title
|
||||
echo -en "\033]0;React Packager\a"
|
||||
clear
|
||||
|
||||
THIS_DIR=$(dirname "$0")
|
||||
$THIS_DIR/packager.sh --platform android --port 8082
|
||||
echo "Process terminated. Press <enter> to close the window"
|
||||
read
|
@ -48,11 +48,6 @@ var options = parseCommandLine([{
|
||||
command: 'assetRoots',
|
||||
type: 'string',
|
||||
description: 'specify the root directories of app assets'
|
||||
}, {
|
||||
command: 'platform',
|
||||
type: 'string',
|
||||
default: 'ios',
|
||||
description: 'Specify the platform-specific blacklist (ios, android, web).'
|
||||
}, {
|
||||
command: 'skipflow',
|
||||
description: 'Disable flow checks'
|
||||
@ -229,7 +224,7 @@ function getAppMiddleware(options) {
|
||||
return ReactPackager.middleware({
|
||||
nonPersistent: options.nonPersistent,
|
||||
projectRoots: options.projectRoots,
|
||||
blacklistRE: blacklist(options.platform),
|
||||
blacklistRE: blacklist(),
|
||||
cacheVersion: '2',
|
||||
transformModulePath: transformerPath,
|
||||
assetRoots: options.assetRoots,
|
||||
|
30
packager/react-packager/index.js
vendored
30
packager/react-packager/index.js
vendored
@ -60,35 +60,7 @@ exports.createClientFor = function(options) {
|
||||
return SocketInterface.getOrCreateSocketFor(options);
|
||||
};
|
||||
|
||||
process.on('message', function(m) {
|
||||
if (m && m.type && m.type === 'createSocketServer') {
|
||||
console.log('server got ipc message', m);
|
||||
var options = m.data.options;
|
||||
|
||||
// regexp doesn't naturally serialize to json.
|
||||
options.blacklistRE = new RegExp(options.blacklistRE.source);
|
||||
|
||||
SocketInterface.createSocketServer(
|
||||
m.data.sockPath,
|
||||
m.data.options
|
||||
).then(
|
||||
function() {
|
||||
console.log('succesfully created server', m);
|
||||
process.send({ type: 'createdServer' });
|
||||
},
|
||||
function(error) {
|
||||
console.log('error creating server', error.code);
|
||||
if (error.code === 'EADDRINUSE') {
|
||||
// Server already listening, this may happen if multiple
|
||||
// clients where started in quick succussion (buck).
|
||||
process.send({ type: 'createdServer' });
|
||||
} else {
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
).done();
|
||||
}
|
||||
});
|
||||
SocketInterface.listenOnServerMessages();
|
||||
|
||||
function useGracefulFs() {
|
||||
var fs = require('fs');
|
||||
|
@ -23,7 +23,7 @@ const readFile = Promise.denodeify(fs.readFile);
|
||||
const MAX_CALLS_PER_WORKER = 600;
|
||||
|
||||
// Worker will timeout if one of the callers timeout.
|
||||
const DEFAULT_MAX_CALL_TIME = 30000;
|
||||
const DEFAULT_MAX_CALL_TIME = 60000;
|
||||
|
||||
const validateOpts = declareOpts({
|
||||
projectRoots: {
|
||||
|
@ -73,15 +73,15 @@ class SocketClient {
|
||||
const resolver = this._resolvers[message.id];
|
||||
if (!resolver) {
|
||||
throw new Error(
|
||||
'Unrecognized message id (message already resolved or never existed'
|
||||
'Unrecognized message id (' + message.id + ') ' +
|
||||
'message already resolved or never existed.'
|
||||
);
|
||||
}
|
||||
|
||||
delete this._resolvers[message.id];
|
||||
|
||||
if (message.type === 'error') {
|
||||
// TODO convert to an error
|
||||
resolver.reject(message.data);
|
||||
resolver.reject(new Error(message.data));
|
||||
} else {
|
||||
resolver.resolve(message.data);
|
||||
}
|
||||
|
@ -54,13 +54,13 @@ class SocketServer {
|
||||
|
||||
const bunser = new bser.BunserBuf();
|
||||
sock.on('data', (buf) => bunser.append(buf));
|
||||
|
||||
bunser.on('value', (m) => this._handleMessage(sock, m));
|
||||
}
|
||||
|
||||
_handleMessage(sock, m) {
|
||||
if (!m || !m.id || !m.data) {
|
||||
console.error('SocketServer recieved a malformed message: %j', m);
|
||||
return;
|
||||
}
|
||||
|
||||
debug('got request', m);
|
||||
@ -119,9 +119,38 @@ class SocketServer {
|
||||
this._dieEventually();
|
||||
}, MAX_IDLE_TIME);
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = SocketServer;
|
||||
static listenOnServerIPCMessages() {
|
||||
process.on('message', (message) => {
|
||||
if (!(message && message.type && message.type === 'createSocketServer')) {
|
||||
return;
|
||||
}
|
||||
|
||||
debug('server got ipc message', message);
|
||||
|
||||
const {options, sockPath} = message.data;
|
||||
// regexp doesn't naturally serialize to json.
|
||||
options.blacklistRE = new RegExp(options.blacklistRE.source);
|
||||
|
||||
new SocketServer(sockPath, options).onReady().then(
|
||||
() => {
|
||||
debug('succesfully created server');
|
||||
process.send({ type: 'createdServer' });
|
||||
},
|
||||
error => {
|
||||
debug('error creating server', error.code);
|
||||
if (error.code === 'EADDRINUSE') {
|
||||
// Server already listening, this may happen if multiple
|
||||
// clients where started in quick succussion (buck).
|
||||
process.send({ type: 'createdServer' });
|
||||
} else {
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
).done();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// TODO move this to bser code.
|
||||
function toJSON(object) {
|
||||
@ -139,3 +168,5 @@ function toJSON(object) {
|
||||
|
||||
return object;
|
||||
}
|
||||
|
||||
module.exports = SocketServer;
|
||||
|
@ -107,6 +107,6 @@ describe('SocketClient', () => {
|
||||
data: 'some error'
|
||||
});
|
||||
|
||||
return promise.catch(m => expect(m).toBe('some error'));
|
||||
return promise.catch(m => expect(m.message).toBe('some error'));
|
||||
});
|
||||
});
|
||||
|
@ -72,16 +72,4 @@ describe('SocketInterface', () => {
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('createSocketServer', () => {
|
||||
pit('creates a server', () => {
|
||||
require('../SocketServer').mockImpl((sockPath, options) => {
|
||||
expect(sockPath).toBe('/socket');
|
||||
expect(options).toEqual({ projectRoots: ['/root'] });
|
||||
return { onReady: () => Promise.resolve() };
|
||||
});
|
||||
|
||||
return SocketInterface.createSocketServer('/socket', { projectRoots: ['/root'] });
|
||||
});
|
||||
});
|
||||
});
|
||||
|
@ -18,7 +18,7 @@ const path = require('path');
|
||||
const tmpdir = require('os').tmpdir();
|
||||
const {spawn} = require('child_process');
|
||||
|
||||
const CREATE_SERVER_TIMEOUT = 10000;
|
||||
const CREATE_SERVER_TIMEOUT = 30000;
|
||||
|
||||
const SocketInterface = {
|
||||
getOrCreateSocketFor(options) {
|
||||
@ -72,7 +72,7 @@ const SocketInterface = {
|
||||
}
|
||||
);
|
||||
|
||||
child.unref();
|
||||
child.unref();
|
||||
|
||||
child.on('message', m => {
|
||||
if (m && m.type && m.type === 'createdServer') {
|
||||
@ -94,9 +94,10 @@ const SocketInterface = {
|
||||
});
|
||||
},
|
||||
|
||||
createSocketServer(sockPath, options) {
|
||||
return new SocketServer(sockPath, options).onReady();
|
||||
listenOnServerMessages() {
|
||||
return SocketServer.listenOnServerIPCMessages();
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
module.exports = SocketInterface;
|
||||
|
Loading…
x
Reference in New Issue
Block a user