Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Export YellowBox API #16709

Closed
wants to merge 1 commit into from
Closed

Export YellowBox API #16709

wants to merge 1 commit into from

Conversation

wli
Copy link
Contributor

@wli wli commented Nov 7, 2017

Motivation

Allow end users to access the YellowBox API so that warnings can be properly ignored via the API first introduced in a974c14. Based on that API, you should be able to do the following:

import { YellowBox } from 'react-native';
YellowBox.ignoreWarnings(['Warning: ...']);

However, if you actually try this today, it results in a broken import error.

Test Plan

Verified using an expo instance. First tried without the YellowBox import, observed a failure to import. Then I added the import statement, and observed no warning on my device.

import React from 'react';
import { StyleSheet, Text, View, YellowBox } from 'react-native';


YellowBox.ignoreWarnings(['hey']);


export default class App extends React.Component {
  render() {
    console.warn('hey!');
    return (
      <View style={styles.container}>
        <Text>Open up App.js to start working on your app!</Text>
        <Text>Changes you make will automatically reload.</Text>
        <Text>Shake your phone to open the developer menu.</Text>
      </View>
    );
  }
}

const styles = StyleSheet.create({
  container: {
    flex: 1,
    backgroundColor: '#fff',
    alignItems: 'center',
    justifyContent: 'center',
  },
});

Release Notes

[GENERAL] [ENHANCEMENT] [YellowBox] - Export YellowBox API so warnings can be ignored using a non-deprecated API.

Allow end users to access the YellowBox API so that warnings can be
properly ignored via the API first introduced in
a974c14
@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Nov 7, 2017
@pull-bot
Copy link

pull-bot commented Nov 7, 2017

Warnings
⚠️

📋 Release Notes - This PR may have incorrectly formatted Release Notes.

@facebook-github-bot label Needs more information

Generated by 🚫 dangerJS

@ide
Copy link
Contributor

ide commented Nov 7, 2017

@facebook-github-bot shipit

@facebook-github-bot facebook-github-bot added the Import Started This pull request has been imported. This does not imply the PR has been approved. label Nov 7, 2017
Copy link
Contributor

@facebook-github-bot facebook-github-bot left a comment

Choose a reason for hiding this comment

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

@ide is landing this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

cdlewis pushed a commit to cdlewis/react-native that referenced this pull request Nov 19, 2017
Summary:
Allow end users to access the YellowBox API so that warnings can be properly ignored via the API first introduced in a974c14. Based on that API, you should be able to do the following:

```
import { YellowBox } from 'react-native';
YellowBox.ignoreWarnings(['Warning: ...']);
```

However, if you actually try this today, it results in a broken import error.

Verified using an expo instance. First tried without the YellowBox import, observed a failure to import. Then I added the import statement, and observed no warning on my device.

```
import React from 'react';
import { StyleSheet, Text, View, YellowBox } from 'react-native';

YellowBox.ignoreWarnings(['hey']);

export default class App extends React.Component {
  render() {
    console.warn('hey!');
    return (
      <View style={styles.container}>
        <Text>Open up App.js to start working on your app!</Text>
        <Text>Changes you make will automatically reload.</Text>
        <Text>Shake your phone to open the developer menu.</Text>
      </View>
    );
  }
}

const styles = StyleSheet.create({
  container: {
    flex: 1,
    backgroundColor: '#fff',
    alignItems: 'center',
    justifyContent: 'center',
  },
});
```

[GENERAL] [ENHANCEMENT] [YellowBox] - Export YellowBox API so warnings can be ignored using a non-deprecated API.
Closes facebook#16709

Differential Revision: D6254819

Pulled By: hramos

fbshipit-source-id: ff92f32e4dedfb01f6902f54fabc62eb64468554
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. Import Started This pull request has been imported. This does not imply the PR has been approved.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants