Log React warnings internally, fix warnings in Android tests
Reviewed By: @javache Differential Revision: D2517993 fb-gh-sync-id: c91a42a0abe4037b72c4497a5dc8b52a922fbf98
This commit is contained in:
parent
a7b23df510
commit
ab6f375c66
|
@ -138,6 +138,7 @@ exports.examples = [
|
|||
var examples = autoCapitalizeTypes.map((type) => {
|
||||
return (
|
||||
<TextInput
|
||||
key={type}
|
||||
autoCapitalize={type}
|
||||
placeholder={'autoCapitalize: ' + type}
|
||||
style={styles.singleLine}
|
||||
|
@ -177,6 +178,7 @@ exports.examples = [
|
|||
var examples = keyboardTypes.map((type) => {
|
||||
return (
|
||||
<TextInput
|
||||
key={type}
|
||||
keyboardType={type}
|
||||
placeholder={'keyboardType: ' + type}
|
||||
style={styles.singleLine}
|
||||
|
|
|
@ -21,6 +21,13 @@ var ReactPropTypes = require('ReactPropTypes');
|
|||
var requireNativeComponent = require('requireNativeComponent');
|
||||
var resolveAssetSource = require('resolveAssetSource');
|
||||
|
||||
var optionalImageSource = ReactPropTypes.oneOfType([
|
||||
Image.propTypes.source,
|
||||
// Image.propTypes.source is required but we want it to be optional, so we OR
|
||||
// it with a nullable propType.
|
||||
ReactPropTypes.oneOf([])
|
||||
]);
|
||||
|
||||
/**
|
||||
* React component that wraps the Android-only [`Toolbar` widget][0]. A Toolbar can display a logo,
|
||||
* navigation icon (e.g. hamburger menu), a title & subtitle and a list of actions. The title and
|
||||
|
@ -75,18 +82,18 @@ var ToolbarAndroid = React.createClass({
|
|||
*/
|
||||
actions: ReactPropTypes.arrayOf(ReactPropTypes.shape({
|
||||
title: ReactPropTypes.string.isRequired,
|
||||
icon: Image.propTypes.source,
|
||||
icon: optionalImageSource,
|
||||
show: ReactPropTypes.oneOf(['always', 'ifRoom', 'never']),
|
||||
showWithText: ReactPropTypes.bool
|
||||
})),
|
||||
/**
|
||||
* Sets the toolbar logo.
|
||||
*/
|
||||
logo: Image.propTypes.source,
|
||||
logo: optionalImageSource,
|
||||
/**
|
||||
* Sets the navigation icon.
|
||||
*/
|
||||
navIcon: Image.propTypes.source,
|
||||
navIcon: optionalImageSource,
|
||||
/**
|
||||
* Callback that is called when an action is selected. The only argument that is passeed to the
|
||||
* callback is the position of the action in the actions array.
|
||||
|
|
|
@ -58,14 +58,18 @@ var ImageViewAttributes = merge(ReactNativeViewAttributes.UIView, {
|
|||
|
||||
var Image = React.createClass({
|
||||
propTypes: {
|
||||
source: PropTypes.shape({
|
||||
/**
|
||||
* A string representing the resource identifier for the image, which
|
||||
* `uri` is a string representing the resource identifier for the image, which
|
||||
* could be an http address, a local file path, or the name of a static image
|
||||
* resource (which should be wrapped in the `ix` function).
|
||||
* resource (which should be wrapped in the `require('image!name')` function).
|
||||
*/
|
||||
source: PropTypes.oneOfType([
|
||||
PropTypes.shape({
|
||||
uri: PropTypes.string,
|
||||
}).isRequired,
|
||||
}),
|
||||
// Opaque type returned by require('./image.jpg')
|
||||
PropTypes.number,
|
||||
]).isRequired,
|
||||
style: StyleSheetPropType(ImageStylePropTypes),
|
||||
/**
|
||||
* Used to locate this view in end-to-end tests.
|
||||
|
|
|
@ -11,9 +11,11 @@
|
|||
*/
|
||||
'use strict';
|
||||
|
||||
var Platform = require('Platform');
|
||||
var React = require('React');
|
||||
var StyleSheet = require('StyleSheet');
|
||||
var { TestModule } = require('NativeModules');
|
||||
var View = require('View');
|
||||
|
||||
var requireNativeComponent = require('requireNativeComponent');
|
||||
|
||||
|
@ -49,6 +51,8 @@ var style = StyleSheet.create({
|
|||
},
|
||||
});
|
||||
|
||||
var RCTSnapshot = requireNativeComponent('RCTSnapshot', SnapshotView);
|
||||
var RCTSnapshot = Platform.OS === 'ios' ?
|
||||
requireNativeComponent('RCTSnapshot', SnapshotView) :
|
||||
View;
|
||||
|
||||
module.exports = SnapshotView;
|
||||
|
|
Loading…
Reference in New Issue