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:
Eli White 2018-03-07 13:12:51 -08:00 committed by Facebook Github Bot
parent 49ffc9fada
commit a3c07c95ef
9 changed files with 20 additions and 19 deletions

View File

@ -18,11 +18,11 @@ const ViewPropTypes = require('ViewPropTypes');
const requireNativeComponent = require('requireNativeComponent'); const requireNativeComponent = require('requireNativeComponent');
import type {StyleObj} from 'StyleSheetTypes'; import type {DangerouslyImpreciseStyleProp} from 'StyleSheet';
import type {ViewProps} from 'ViewPropTypes'; import type {ViewProps} from 'ViewPropTypes';
class TabBarIOS extends React.Component<ViewProps & { class TabBarIOS extends React.Component<ViewProps & {
style?: StyleObj, style?: DangerouslyImpreciseStyleProp,
unselectedTintColor?: string, unselectedTintColor?: string,
tintColor?: string, tintColor?: string,
unselectedItemTintColor?: string, unselectedItemTintColor?: string,

View File

@ -23,11 +23,11 @@ const flattenStyle = require('flattenStyle');
const mapWithSeparator = require('mapWithSeparator'); const mapWithSeparator = require('mapWithSeparator');
const openFileInEditor = require('openFileInEditor'); const openFileInEditor = require('openFileInEditor');
import type {StyleObj} from 'StyleSheetTypes'; import type {DangerouslyImpreciseStyleProp} from 'StyleSheet';
class ElementProperties extends React.Component<{ class ElementProperties extends React.Component<{
hierarchy: Array<$FlowFixMe>, hierarchy: Array<$FlowFixMe>,
style?: StyleObj, style?: DangerouslyImpreciseStyleProp,
source?: { source?: {
fileName?: string, fileName?: string,
lineNumber?: number, lineNumber?: number,

View File

@ -18,7 +18,7 @@ const ListView = require('ListView');
const invariant = require('fbjs/lib/invariant'); const invariant = require('fbjs/lib/invariant');
import type {StyleObj} from 'StyleSheetTypes'; import type {DangerouslyImpreciseStyleProp} from 'StyleSheet';
import type { import type {
ViewabilityConfig, ViewabilityConfig,
ViewToken, ViewToken,
@ -96,7 +96,7 @@ type OptionalProps<ItemT> = {
/** /**
* Optional custom style for multi-item rows generated when numColumns > 1. * 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 * 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 * any of your `renderItem`, Header, Footer, etc. functions depend on anything outside of the

View File

@ -32,7 +32,7 @@ const warning = require('fbjs/lib/warning');
const {computeWindowedRenderLimits} = require('VirtualizeUtils'); const {computeWindowedRenderLimits} = require('VirtualizeUtils');
import type {StyleObj} from 'StyleSheetTypes'; import type {DangerouslyImpreciseStyleProp} from 'StyleSheet';
import type { import type {
ViewabilityConfig, ViewabilityConfig,
ViewToken, ViewToken,
@ -644,7 +644,7 @@ class VirtualizedList extends React.PureComponent<Props, State> {
stickyIndicesFromProps: Set<number>, stickyIndicesFromProps: Set<number>,
first: number, first: number,
last: number, last: number,
inversionStyle: ?StyleObj, inversionStyle: ?DangerouslyImpreciseStyleProp,
) { ) {
const { const {
CellRendererComponent, CellRendererComponent,
@ -1545,7 +1545,7 @@ class CellRenderer extends React.Component<
fillRateHelper: FillRateHelper, fillRateHelper: FillRateHelper,
horizontal: ?boolean, horizontal: ?boolean,
index: number, index: number,
inversionStyle: ?StyleObj, inversionStyle: ?DangerouslyImpreciseStyleProp,
item: Item, item: Item,
onLayout: (event: Object) => void, // This is extracted by ScrollViewStickyHeader onLayout: (event: Object) => void, // This is extracted by ScrollViewStickyHeader
onUnmount: (cellKey: string) => void, onUnmount: (cellKey: string) => void,

View File

@ -19,11 +19,11 @@ const flatten = require('flattenStyle');
import type { import type {
StyleSheetStyle as _StyleSheetStyle, StyleSheetStyle as _StyleSheetStyle,
Styles as _Styles, Styles as _Styles,
StyleObj, ____StyleObj_Internal,
LayoutStyle LayoutStyle
} from 'StyleSheetTypes'; } from 'StyleSheetTypes';
export type DangerouslyImpreciseStyleProp = StyleObj; export type DangerouslyImpreciseStyleProp = ____StyleObj_Internal;
export type Styles = _Styles; export type Styles = _Styles;
export type StyleSheetStyle = _StyleSheetStyle; export type StyleSheetStyle = _StyleSheetStyle;
type StyleSheet<+S: Styles> = $ObjMap<S, (Object) => StyleSheetStyle>; type StyleSheet<+S: Styles> = $ObjMap<S, (Object) => StyleSheetStyle>;

View File

@ -230,7 +230,7 @@ type GenericStyleProp<+T> =
| '' | ''
| $ReadOnlyArray<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 ViewStyleProp = GenericStyleProp<$ReadOnly<$Shape<ViewStyle>>>;
export type TextStyleProp = GenericStyleProp<$ReadOnly<$Shape<TextStyle>>>; export type TextStyleProp = GenericStyleProp<$ReadOnly<$Shape<TextStyle>>>;

View File

@ -11,7 +11,8 @@
var ReactNativePropRegistry; var ReactNativePropRegistry;
import type { StyleObj, Style } from 'StyleSheetTypes'; import type {DangerouslyImpreciseStyleProp} from 'StyleSheet';
import type { Style } from 'StyleSheetTypes';
function getStyle(style) { function getStyle(style) {
if (ReactNativePropRegistry === undefined) { if (ReactNativePropRegistry === undefined) {
@ -23,7 +24,7 @@ function getStyle(style) {
return style; return style;
} }
function flattenStyle(style: ?StyleObj): ?Style { function flattenStyle(style: ?DangerouslyImpreciseStyleProp): ?Style {
if (style == null) { if (style == null) {
return undefined; return undefined;
} }

View File

@ -22,7 +22,7 @@ const View = require('View');
import type {RNTesterExample} from './RNTesterList.ios'; import type {RNTesterExample} from './RNTesterList.ios';
import type {PassProps} from './RNTesterStatePersister'; import type {PassProps} from './RNTesterStatePersister';
import type {StyleObj} from 'StyleSheetTypes'; import type {DangerouslyImpreciseStyleProp} from 'StyleSheet';
type Props = { type Props = {
onNavigate: Function, onNavigate: Function,
@ -31,8 +31,8 @@ type Props = {
APIExamples: Array<RNTesterExample>, APIExamples: Array<RNTesterExample>,
}, },
persister: PassProps<*>, persister: PassProps<*>,
searchTextInputStyle: StyleObj, searchTextInputStyle: DangerouslyImpreciseStyleProp,
style?: ?StyleObj, style?: ?DangerouslyImpreciseStyleProp,
}; };
class RowComponent extends React.PureComponent<{ class RowComponent extends React.PureComponent<{

View File

@ -10,7 +10,7 @@
*/ */
'use strict'; 'use strict';
import type {StyleObj} from 'StyleSheetTypes'; import type {DangerouslyImpreciseStyleProp} from 'StyleSheet';
const ActivityIndicator = require('ActivityIndicator'); const ActivityIndicator = require('ActivityIndicator');
const Platform = require('Platform'); const Platform = require('Platform');
@ -252,7 +252,7 @@ if (Platform.OS === 'ios') {
class Thumb extends React.PureComponent<{| class Thumb extends React.PureComponent<{|
source?: string | number, source?: string | number,
msg?: string, msg?: string,
style?: StyleObj, style?: DangerouslyImpreciseStyleProp,
|}> { |}> {
render() { render() {
const {source} = this.props; const {source} = this.props;