mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-01-12 22:50:10 +08:00
Update typing for YellowBox patterns
Summary: To satisfy Flow, we want to account for RegExp as a valid ignore pattern. Reviewed By: TheSavior Differential Revision: D14303072 fbshipit-source-id: 4988fff5c6c6a12da99027e47216cedcf5a4db5a
This commit is contained in:
committed by
Facebook Github Bot
parent
2c0125995d
commit
d4300cb59b
@@ -18,7 +18,7 @@ export type Registry = Map<Category, $ReadOnlyArray<YellowBoxWarning>>;
|
||||
|
||||
export type Observer = (registry: Registry) => void;
|
||||
|
||||
type IgnorePattern = string | RegExp;
|
||||
export type IgnorePattern = string | RegExp;
|
||||
|
||||
export type Subscription = $ReadOnly<{|
|
||||
unsubscribe: () => void,
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
const React = require('React');
|
||||
|
||||
import type {Category} from 'YellowBoxCategory';
|
||||
import type {Registry, Subscription} from 'YellowBoxRegistry';
|
||||
import type {Registry, Subscription, IgnorePattern} from 'YellowBoxRegistry';
|
||||
|
||||
type Props = $ReadOnly<{||}>;
|
||||
type State = {|
|
||||
@@ -50,7 +50,7 @@ if (__DEV__) {
|
||||
|
||||
// eslint-disable-next-line no-shadow
|
||||
YellowBox = class YellowBox extends React.Component<Props, State> {
|
||||
static ignoreWarnings(patterns: $ReadOnlyArray<string>): void {
|
||||
static ignoreWarnings(patterns: $ReadOnlyArray<IgnorePattern>): void {
|
||||
YellowBoxRegistry.addIgnorePatterns(patterns);
|
||||
}
|
||||
|
||||
@@ -135,7 +135,7 @@ if (__DEV__) {
|
||||
};
|
||||
} else {
|
||||
YellowBox = class extends React.Component<Props> {
|
||||
static ignoreWarnings(patterns: $ReadOnlyArray<string>): void {
|
||||
static ignoreWarnings(patterns: $ReadOnlyArray<IgnorePattern>): void {
|
||||
// Do nothing.
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user