Permalink
Browse files

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
  • Loading branch information...
TheSavior authored and facebook-github-bot committed Mar 7, 2018
1 parent 49ffc9f commit a3c07c95effd891c2bd5f3257efe5b24d85862be
@@ -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;
}
@@ -22,7 +22,7 @@ const View = require('View');
import type {RNTesterExample} from './RNTesterList.ios';
import type {PassProps} from './RNTesterStatePersister';
import type {StyleObj} from 'StyleSheetTypes';
import type {DangerouslyImpreciseStyleProp} from 'StyleSheet';
type Props = {
onNavigate: Function,
@@ -31,8 +31,8 @@ type Props = {
APIExamples: Array<RNTesterExample>,
},
persister: PassProps<*>,
searchTextInputStyle: StyleObj,
style?: ?StyleObj,
searchTextInputStyle: DangerouslyImpreciseStyleProp,
style?: ?DangerouslyImpreciseStyleProp,
};
class RowComponent extends React.PureComponent<{
@@ -10,7 +10,7 @@
*/
'use strict';
import type {StyleObj} from 'StyleSheetTypes';
import type {DangerouslyImpreciseStyleProp} from 'StyleSheet';
const ActivityIndicator = require('ActivityIndicator');
const Platform = require('Platform');
@@ -252,7 +252,7 @@ if (Platform.OS === 'ios') {
class Thumb extends React.PureComponent<{|
source?: string | number,
msg?: string,
style?: StyleObj,
style?: DangerouslyImpreciseStyleProp,
|}> {
render() {
const {source} = this.props;

0 comments on commit a3c07c9

Please sign in to comment.