mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-04-24 04:16:00 +08:00
StyleObj -> DangerouslyImpreciseStyleProp
Summary:
Migrating everything to import from StyleSheet instead of StyleSheetTypes.
Search and replaced
```
import type {StyleObj} from 'StyleSheetTypes';
```
to
```
import type {DangerouslyImpreciseStyleProp} from 'StyleSheet';
```
and then replacing `StyleObj` with `DangerouslyImpreciseStyleProp` and fixing up the remaining flow errors by hand.
Reviewed By: yungsters
Differential Revision: D7184077
fbshipit-source-id: b8dabb9d48038b5a997ab715687300bad57aa9d4
This commit is contained in:
committed by
Facebook Github Bot
parent
49ffc9fada
commit
a3c07c95ef
@@ -18,11 +18,11 @@ const ViewPropTypes = require('ViewPropTypes');
|
||||
|
||||
const requireNativeComponent = require('requireNativeComponent');
|
||||
|
||||
import type {StyleObj} from 'StyleSheetTypes';
|
||||
import type {DangerouslyImpreciseStyleProp} from 'StyleSheet';
|
||||
import type {ViewProps} from 'ViewPropTypes';
|
||||
|
||||
class TabBarIOS extends React.Component<ViewProps & {
|
||||
style?: StyleObj,
|
||||
style?: DangerouslyImpreciseStyleProp,
|
||||
unselectedTintColor?: string,
|
||||
tintColor?: string,
|
||||
unselectedItemTintColor?: string,
|
||||
|
||||
@@ -23,11 +23,11 @@ const flattenStyle = require('flattenStyle');
|
||||
const mapWithSeparator = require('mapWithSeparator');
|
||||
const openFileInEditor = require('openFileInEditor');
|
||||
|
||||
import type {StyleObj} from 'StyleSheetTypes';
|
||||
import type {DangerouslyImpreciseStyleProp} from 'StyleSheet';
|
||||
|
||||
class ElementProperties extends React.Component<{
|
||||
hierarchy: Array<$FlowFixMe>,
|
||||
style?: StyleObj,
|
||||
style?: DangerouslyImpreciseStyleProp,
|
||||
source?: {
|
||||
fileName?: string,
|
||||
lineNumber?: number,
|
||||
|
||||
@@ -18,7 +18,7 @@ const ListView = require('ListView');
|
||||
|
||||
const invariant = require('fbjs/lib/invariant');
|
||||
|
||||
import type {StyleObj} from 'StyleSheetTypes';
|
||||
import type {DangerouslyImpreciseStyleProp} from 'StyleSheet';
|
||||
import type {
|
||||
ViewabilityConfig,
|
||||
ViewToken,
|
||||
@@ -96,7 +96,7 @@ type OptionalProps<ItemT> = {
|
||||
/**
|
||||
* Optional custom style for multi-item rows generated when numColumns > 1.
|
||||
*/
|
||||
columnWrapperStyle?: StyleObj,
|
||||
columnWrapperStyle?: DangerouslyImpreciseStyleProp,
|
||||
/**
|
||||
* A marker property for telling the list to re-render (since it implements `PureComponent`). If
|
||||
* any of your `renderItem`, Header, Footer, etc. functions depend on anything outside of the
|
||||
|
||||
@@ -32,7 +32,7 @@ const warning = require('fbjs/lib/warning');
|
||||
|
||||
const {computeWindowedRenderLimits} = require('VirtualizeUtils');
|
||||
|
||||
import type {StyleObj} from 'StyleSheetTypes';
|
||||
import type {DangerouslyImpreciseStyleProp} from 'StyleSheet';
|
||||
import type {
|
||||
ViewabilityConfig,
|
||||
ViewToken,
|
||||
@@ -644,7 +644,7 @@ class VirtualizedList extends React.PureComponent<Props, State> {
|
||||
stickyIndicesFromProps: Set<number>,
|
||||
first: number,
|
||||
last: number,
|
||||
inversionStyle: ?StyleObj,
|
||||
inversionStyle: ?DangerouslyImpreciseStyleProp,
|
||||
) {
|
||||
const {
|
||||
CellRendererComponent,
|
||||
@@ -1545,7 +1545,7 @@ class CellRenderer extends React.Component<
|
||||
fillRateHelper: FillRateHelper,
|
||||
horizontal: ?boolean,
|
||||
index: number,
|
||||
inversionStyle: ?StyleObj,
|
||||
inversionStyle: ?DangerouslyImpreciseStyleProp,
|
||||
item: Item,
|
||||
onLayout: (event: Object) => void, // This is extracted by ScrollViewStickyHeader
|
||||
onUnmount: (cellKey: string) => void,
|
||||
|
||||
@@ -19,11 +19,11 @@ const flatten = require('flattenStyle');
|
||||
import type {
|
||||
StyleSheetStyle as _StyleSheetStyle,
|
||||
Styles as _Styles,
|
||||
StyleObj,
|
||||
____StyleObj_Internal,
|
||||
LayoutStyle
|
||||
} from 'StyleSheetTypes';
|
||||
|
||||
export type DangerouslyImpreciseStyleProp = StyleObj;
|
||||
export type DangerouslyImpreciseStyleProp = ____StyleObj_Internal;
|
||||
export type Styles = _Styles;
|
||||
export type StyleSheetStyle = _StyleSheetStyle;
|
||||
type StyleSheet<+S: Styles> = $ObjMap<S, (Object) => StyleSheetStyle>;
|
||||
|
||||
@@ -230,7 +230,7 @@ type GenericStyleProp<+T> =
|
||||
| ''
|
||||
| $ReadOnlyArray<GenericStyleProp<T>>;
|
||||
|
||||
export type StyleObj = GenericStyleProp<$Shape<Style>>;
|
||||
export type ____StyleObj_Internal = GenericStyleProp<$Shape<Style>>;
|
||||
|
||||
export type ViewStyleProp = GenericStyleProp<$ReadOnly<$Shape<ViewStyle>>>;
|
||||
export type TextStyleProp = GenericStyleProp<$ReadOnly<$Shape<TextStyle>>>;
|
||||
|
||||
@@ -11,7 +11,8 @@
|
||||
|
||||
var ReactNativePropRegistry;
|
||||
|
||||
import type { StyleObj, Style } from 'StyleSheetTypes';
|
||||
import type {DangerouslyImpreciseStyleProp} from 'StyleSheet';
|
||||
import type { Style } from 'StyleSheetTypes';
|
||||
|
||||
function getStyle(style) {
|
||||
if (ReactNativePropRegistry === undefined) {
|
||||
@@ -23,7 +24,7 @@ function getStyle(style) {
|
||||
return style;
|
||||
}
|
||||
|
||||
function flattenStyle(style: ?StyleObj): ?Style {
|
||||
function flattenStyle(style: ?DangerouslyImpreciseStyleProp): ?Style {
|
||||
if (style == null) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user