Skip to content

Commit

Permalink
Use .includes instead of .startsWith for checking ignored YellowBox w…
Browse files Browse the repository at this point in the history
…arnings

Summary:
Some warnings don't have a good prefix that can be targeted using .startsWith, e.g. "Module $modulename requires main queue setup". It would be helpful to be able to select this warning using the much more specific middle part of the string ("requires main queue setup since it overrides `constantsToExport`) so I want to change this check from startsWith to includes to enable that.

Changing from .startsWith -> .includes should be completely backward compatible.

Reviewed By: TheSavior

Differential Revision: D7445309

fbshipit-source-id: 2c91dbe5ee3c3aa74be1bca091b20d294e64e853
  • Loading branch information
Dominik Wienand authored and macdoum1 committed Jun 28, 2018
1 parent ec36493 commit 6bc8e39
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion Libraries/ReactNative/YellowBox.js
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ function ensureSymbolicatedWarning(warning: string): void {

function isWarningIgnored(warning: string): boolean {
const isIgnored = IGNORED_WARNINGS.some((ignoredWarning: string) =>
warning.startsWith(ignoredWarning),
warning.includes(ignoredWarning),
);

if (isIgnored) {
Expand Down

0 comments on commit 6bc8e39

Please sign in to comment.