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:
Ben Alpert 2015-10-09 09:31:51 -07:00 committed by facebook-github-bot-4
parent a7b23df510
commit ab6f375c66
4 changed files with 29 additions and 12 deletions

View File

@ -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}

View File

@ -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.

View File

@ -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
* 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).
*/
uri: PropTypes.string,
}).isRequired,
/**
* `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 `require('image!name')` function).
*/
source: PropTypes.oneOfType([
PropTypes.shape({
uri: PropTypes.string,
}),
// Opaque type returned by require('./image.jpg')
PropTypes.number,
]).isRequired,
style: StyleSheetPropType(ImageStylePropTypes),
/**
* Used to locate this view in end-to-end tests.

View File

@ -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;