Skip to content

Commit a3c07c9

Browse files
elicwhitefacebook-github-bot
authored andcommitted
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
1 parent 49ffc9f commit a3c07c9

File tree

9 files changed

+20
-19
lines changed

9 files changed

+20
-19
lines changed

Libraries/Components/TabBarIOS/TabBarIOS.ios.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,11 @@ const ViewPropTypes = require('ViewPropTypes');
1818

1919
const requireNativeComponent = require('requireNativeComponent');
2020

21-
import type {StyleObj} from 'StyleSheetTypes';
21+
import type {DangerouslyImpreciseStyleProp} from 'StyleSheet';
2222
import type {ViewProps} from 'ViewPropTypes';
2323

2424
class TabBarIOS extends React.Component<ViewProps & {
25-
style?: StyleObj,
25+
style?: DangerouslyImpreciseStyleProp,
2626
unselectedTintColor?: string,
2727
tintColor?: string,
2828
unselectedItemTintColor?: string,

Libraries/Inspector/ElementProperties.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,11 @@ const flattenStyle = require('flattenStyle');
2323
const mapWithSeparator = require('mapWithSeparator');
2424
const openFileInEditor = require('openFileInEditor');
2525

26-
import type {StyleObj} from 'StyleSheetTypes';
26+
import type {DangerouslyImpreciseStyleProp} from 'StyleSheet';
2727

2828
class ElementProperties extends React.Component<{
2929
hierarchy: Array<$FlowFixMe>,
30-
style?: StyleObj,
30+
style?: DangerouslyImpreciseStyleProp,
3131
source?: {
3232
fileName?: string,
3333
lineNumber?: number,

Libraries/Lists/FlatList.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ const ListView = require('ListView');
1818

1919
const invariant = require('fbjs/lib/invariant');
2020

21-
import type {StyleObj} from 'StyleSheetTypes';
21+
import type {DangerouslyImpreciseStyleProp} from 'StyleSheet';
2222
import type {
2323
ViewabilityConfig,
2424
ViewToken,
@@ -96,7 +96,7 @@ type OptionalProps<ItemT> = {
9696
/**
9797
* Optional custom style for multi-item rows generated when numColumns > 1.
9898
*/
99-
columnWrapperStyle?: StyleObj,
99+
columnWrapperStyle?: DangerouslyImpreciseStyleProp,
100100
/**
101101
* A marker property for telling the list to re-render (since it implements `PureComponent`). If
102102
* any of your `renderItem`, Header, Footer, etc. functions depend on anything outside of the

Libraries/Lists/VirtualizedList.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ const warning = require('fbjs/lib/warning');
3232

3333
const {computeWindowedRenderLimits} = require('VirtualizeUtils');
3434

35-
import type {StyleObj} from 'StyleSheetTypes';
35+
import type {DangerouslyImpreciseStyleProp} from 'StyleSheet';
3636
import type {
3737
ViewabilityConfig,
3838
ViewToken,
@@ -644,7 +644,7 @@ class VirtualizedList extends React.PureComponent<Props, State> {
644644
stickyIndicesFromProps: Set<number>,
645645
first: number,
646646
last: number,
647-
inversionStyle: ?StyleObj,
647+
inversionStyle: ?DangerouslyImpreciseStyleProp,
648648
) {
649649
const {
650650
CellRendererComponent,
@@ -1545,7 +1545,7 @@ class CellRenderer extends React.Component<
15451545
fillRateHelper: FillRateHelper,
15461546
horizontal: ?boolean,
15471547
index: number,
1548-
inversionStyle: ?StyleObj,
1548+
inversionStyle: ?DangerouslyImpreciseStyleProp,
15491549
item: Item,
15501550
onLayout: (event: Object) => void, // This is extracted by ScrollViewStickyHeader
15511551
onUnmount: (cellKey: string) => void,

Libraries/StyleSheet/StyleSheet.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,11 @@ const flatten = require('flattenStyle');
1919
import type {
2020
StyleSheetStyle as _StyleSheetStyle,
2121
Styles as _Styles,
22-
StyleObj,
22+
____StyleObj_Internal,
2323
LayoutStyle
2424
} from 'StyleSheetTypes';
2525

26-
export type DangerouslyImpreciseStyleProp = StyleObj;
26+
export type DangerouslyImpreciseStyleProp = ____StyleObj_Internal;
2727
export type Styles = _Styles;
2828
export type StyleSheetStyle = _StyleSheetStyle;
2929
type StyleSheet<+S: Styles> = $ObjMap<S, (Object) => StyleSheetStyle>;

Libraries/StyleSheet/StyleSheetTypes.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ type GenericStyleProp<+T> =
230230
| ''
231231
| $ReadOnlyArray<GenericStyleProp<T>>;
232232

233-
export type StyleObj = GenericStyleProp<$Shape<Style>>;
233+
export type ____StyleObj_Internal = GenericStyleProp<$Shape<Style>>;
234234

235235
export type ViewStyleProp = GenericStyleProp<$ReadOnly<$Shape<ViewStyle>>>;
236236
export type TextStyleProp = GenericStyleProp<$ReadOnly<$Shape<TextStyle>>>;

Libraries/StyleSheet/flattenStyle.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@
1111

1212
var ReactNativePropRegistry;
1313

14-
import type { StyleObj, Style } from 'StyleSheetTypes';
14+
import type {DangerouslyImpreciseStyleProp} from 'StyleSheet';
15+
import type { Style } from 'StyleSheetTypes';
1516

1617
function getStyle(style) {
1718
if (ReactNativePropRegistry === undefined) {
@@ -23,7 +24,7 @@ function getStyle(style) {
2324
return style;
2425
}
2526

26-
function flattenStyle(style: ?StyleObj): ?Style {
27+
function flattenStyle(style: ?DangerouslyImpreciseStyleProp): ?Style {
2728
if (style == null) {
2829
return undefined;
2930
}

RNTester/js/RNTesterExampleList.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ const View = require('View');
2222

2323
import type {RNTesterExample} from './RNTesterList.ios';
2424
import type {PassProps} from './RNTesterStatePersister';
25-
import type {StyleObj} from 'StyleSheetTypes';
25+
import type {DangerouslyImpreciseStyleProp} from 'StyleSheet';
2626

2727
type Props = {
2828
onNavigate: Function,
@@ -31,8 +31,8 @@ type Props = {
3131
APIExamples: Array<RNTesterExample>,
3232
},
3333
persister: PassProps<*>,
34-
searchTextInputStyle: StyleObj,
35-
style?: ?StyleObj,
34+
searchTextInputStyle: DangerouslyImpreciseStyleProp,
35+
style?: ?DangerouslyImpreciseStyleProp,
3636
};
3737

3838
class RowComponent extends React.PureComponent<{

RNTester/js/ScrollViewExample.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
*/
1111
'use strict';
1212

13-
import type {StyleObj} from 'StyleSheetTypes';
13+
import type {DangerouslyImpreciseStyleProp} from 'StyleSheet';
1414

1515
const ActivityIndicator = require('ActivityIndicator');
1616
const Platform = require('Platform');
@@ -252,7 +252,7 @@ if (Platform.OS === 'ios') {
252252
class Thumb extends React.PureComponent<{|
253253
source?: string | number,
254254
msg?: string,
255-
style?: StyleObj,
255+
style?: DangerouslyImpreciseStyleProp,
256256
|}> {
257257
render() {
258258
const {source} = this.props;

0 commit comments

Comments
 (0)