Skip to content

Commit

Permalink
RN: Revamp YellowBox for Warnings
Browse files Browse the repository at this point in the history
Reviewed By: vjeux

Differential Revision: D2667624

fb-gh-sync-id: f3c6ed63f3138edd13e7fe283cf877d598018813
  • Loading branch information
yungsters authored and facebook-github-bot-7 committed Nov 20, 2015
1 parent b641d3d commit 8ab5182
Show file tree
Hide file tree
Showing 5 changed files with 361 additions and 404 deletions.
15 changes: 9 additions & 6 deletions Examples/UIExplorer/RCTRootViewIOSExample.js
Expand Up @@ -15,19 +15,20 @@
*/

'use strict';
var React = require('react-native');
var {

const React = require('react-native');
const {
StyleSheet,
Text,
View,
} = React;

var requireNativeComponent = require('requireNativeComponent');
var UpdatePropertiesExampleView = requireNativeComponent('UpdatePropertiesExampleView');
var FlexibleSizeExampleView = requireNativeComponent('FlexibleSizeExampleView');
const requireNativeComponent = require('requireNativeComponent');

class AppPropertiesUpdateExample extends React.Component {
render() {
// Do not require this unless we are actually rendering.
const UpdatePropertiesExampleView = requireNativeComponent('UpdatePropertiesExampleView');
return (
<View style={styles.container}>
<Text style={styles.text}>
Expand All @@ -45,6 +46,8 @@ class AppPropertiesUpdateExample extends React.Component {

class RootViewSizeFlexibilityExample extends React.Component {
render() {
// Do not require this unless we are actually rendering.
const FlexibleSizeExampleView = requireNativeComponent('FlexibleSizeExampleView');
return (
<View style={styles.container}>
<Text style={styles.text}>
Expand All @@ -60,7 +63,7 @@ class RootViewSizeFlexibilityExample extends React.Component {
}
}

var styles = StyleSheet.create({
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: '#F5FCFF',
Expand Down

6 comments on commit 8ab5182

@brentvatne
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like we lost the commit message on this import, any details on what the impetus was / what improvements were made?

@brianreavis
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also: require('sprintf') in this commit does not resolve

@yungsters
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, here is the original commit message.


Revamps the former WarningBox as the new YellowBox component with the following changes:

  • Default to enabled (in __DEV__) with a console.disableYellowBox flag to disable it.
  • Added a console.ignoreYellowBox property to ignore warnings by string suffix.
  • Now handles console.error calls with strings that start with Warning:.
  • Removed logic that persists the list of ignored warnings.
  • Displays only up to four warnings (before it requires scrolling).
  • Minor tweaks and polishes to the user interface.
  • Added support for React Native Android.

@brianreavis Thanks for the report and sorry for the breakage. 6b3a6e5 fixes this.

@pppluto
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how to disable the yellowBox ?? why i release my iOS APP,(schema is release) ,and still have the yellowBox?

@yungsters
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It only appears if DEV is true. You can disable it by setting console.disableYellowBox = true;.

@pppluto
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you mean it doesnt care what Xcode has setted release,it just care how you bundle your package ?

Please sign in to comment.