Skip to content

Commit 114098d

Browse files
lunaleapsfacebook-github-bot
authored andcommitted
Back out "feat: mapped layout props for view component"
Summary: Changelog: [Internal] Original commit changeset: 870b9b58a740 Original Phabricator Diff: D41108750 (facebook@cf37479) Reviewed By: necolas, makovkastar Differential Revision: D41145105 fbshipit-source-id: 8e525284d4d6d152fbcf053ec353d40dda3ee8d2
1 parent 394486e commit 114098d

File tree

10 files changed

+25
-254
lines changed

10 files changed

+25
-254
lines changed

Libraries/Components/TextInput/TextInput.js

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ import type {TextInputType} from './TextInput.flow';
1919

2020
import usePressability from '../../Pressability/usePressability';
2121
import flattenStyle from '../../StyleSheet/flattenStyle';
22-
import processLayoutProps from '../../StyleSheet/processStyles';
2322
import StyleSheet, {
2423
type ColorValue,
2524
type TextStyleProp,
@@ -1407,14 +1406,11 @@ function InternalTextInput(props: Props): React.Node {
14071406
? RCTMultilineTextInputView
14081407
: RCTSinglelineTextInputView;
14091408

1410-
let style =
1409+
const style =
14111410
props.multiline === true
1412-
? [styles.multilineInput, props.style]
1411+
? StyleSheet.flatten([styles.multilineInput, props.style])
14131412
: props.style;
14141413

1415-
style = flattenStyle(style);
1416-
style = processLayoutProps(style);
1417-
14181414
const useOnChangeSync =
14191415
(props.unstable_onChangeSync || props.unstable_onChangeTextSync) &&
14201416
!(props.onChange || props.onChangeText);
@@ -1446,9 +1442,7 @@ function InternalTextInput(props: Props): React.Node {
14461442
/>
14471443
);
14481444
} else if (Platform.OS === 'android') {
1449-
let style = flattenStyle(props.style);
1450-
style = processLayoutProps(style);
1451-
1445+
const style = [props.style];
14521446
const autoCapitalize = props.autoCapitalize || 'sentences';
14531447
const _accessibilityLabelledBy =
14541448
props?.['aria-labelledby'] ?? props?.accessibilityLabelledBy;

Libraries/Components/TextInput/__tests__/__snapshots__/TextInput-test.js.snap

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ exports[`TextInput tests should render as expected: should deep render when mock
3232
onStartShouldSetResponder={[Function]}
3333
rejectResponderTermination={true}
3434
selection={null}
35-
style={Object {}}
3635
submitBehavior="blurAndSubmit"
3736
text=""
3837
underlineColorAndroid="transparent"
@@ -71,7 +70,6 @@ exports[`TextInput tests should render as expected: should deep render when not
7170
onStartShouldSetResponder={[Function]}
7271
rejectResponderTermination={true}
7372
selection={null}
74-
style={Object {}}
7573
submitBehavior="blurAndSubmit"
7674
text=""
7775
underlineColorAndroid="transparent"

Libraries/Components/View/View.js

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
import type {ViewProps} from './ViewPropTypes';
1212

1313
import flattenStyle from '../../StyleSheet/flattenStyle';
14-
import processLayoutProps from '../../StyleSheet/processStyles';
1514
import TextAncestor from '../../Text/TextAncestor';
1615
import {getAccessibilityRoleFromRole} from '../../Utilities/AcessibilityMapping';
1716
import ViewNativeComponent from './ViewNativeComponent';
@@ -58,6 +57,7 @@ const View: React.AbstractComponent<
5857
nativeID,
5958
pointerEvents,
6059
role,
60+
style,
6161
tabIndex,
6262
...otherProps
6363
}: ViewProps,
@@ -81,10 +81,8 @@ const View: React.AbstractComponent<
8181
text: ariaValueText ?? accessibilityValue?.text,
8282
};
8383

84-
let style = flattenStyle(otherProps.style);
85-
style = processLayoutProps(style);
86-
87-
const newPointerEvents = style?.pointerEvents || pointerEvents;
84+
const flattenedStyle = flattenStyle(style);
85+
const newPointerEvents = flattenedStyle?.pointerEvents || pointerEvents;
8886

8987
return (
9088
<TextAncestor.Provider value={false}>

Libraries/Image/Image.android.js

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ import type {ImageAndroid} from './Image.flow';
1313
import type {ImageProps as ImagePropsType} from './ImageProps';
1414

1515
import flattenStyle from '../StyleSheet/flattenStyle';
16-
import processLayoutProps from '../StyleSheet/processStyles';
1716
import StyleSheet from '../StyleSheet/StyleSheet';
1817
import TextAncestor from '../Text/TextAncestor';
1918
import ImageAnalyticsTagContext from './ImageAnalyticsTagContext';
@@ -166,9 +165,6 @@ const BaseImage = (props: ImagePropsType, forwardedRef) => {
166165
}
167166

168167
const {height, width, ...restProps} = props;
169-
170-
style = processLayoutProps(style);
171-
172168
const {onLoadStart, onLoad, onLoadEnd, onError} = props;
173169
const nativeProps = {
174170
...restProps,

Libraries/Image/Image.ios.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ import type {ImageIOS} from './Image.flow';
1414
import type {ImageProps as ImagePropsType} from './ImageProps';
1515

1616
import flattenStyle from '../StyleSheet/flattenStyle';
17-
import processLayoutProps from '../StyleSheet/processStyles';
1817
import StyleSheet from '../StyleSheet/StyleSheet';
1918
import ImageAnalyticsTagContext from './ImageAnalyticsTagContext';
2019
import ImageInjection from './ImageInjection';
@@ -138,8 +137,6 @@ const BaseImage = (props: ImagePropsType, forwardedRef) => {
138137
// $FlowFixMe[prop-missing]
139138
const tintColor = props.tintColor || style.tintColor;
140139

141-
style = processLayoutProps(style);
142-
143140
if (props.children != null) {
144141
throw new Error(
145142
'The <Image> component cannot contain children. If you want to render content on top of the image, consider using the <ImageBackground> component or absolute positioning.',

Libraries/StyleSheet/StyleSheetTypes.d.ts

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -69,15 +69,9 @@ export interface FlexStyle {
6969
| undefined;
7070
left?: number | string | undefined;
7171
margin?: number | string | undefined;
72-
marginBlock?: number | string | undefined;
73-
marginBlockEnd?: number | string | undefined;
74-
marginBlockStart?: number | string | undefined;
7572
marginBottom?: number | string | undefined;
7673
marginEnd?: number | string | undefined;
7774
marginHorizontal?: number | string | undefined;
78-
marginInline?: number | string | undefined;
79-
marginInlineEnd?: number | string | undefined;
80-
marginInlineStart?: number | string | undefined;
8175
marginLeft?: number | string | undefined;
8276
marginRight?: number | string | undefined;
8377
marginStart?: number | string | undefined;
@@ -90,14 +84,8 @@ export interface FlexStyle {
9084
overflow?: 'visible' | 'hidden' | 'scroll' | undefined;
9185
padding?: number | string | undefined;
9286
paddingBottom?: number | string | undefined;
93-
paddingBlock?: number | string | undefined;
94-
paddingBlockEnd?: number | string | undefined;
95-
paddingBlockStart?: number | string | undefined;
9687
paddingEnd?: number | string | undefined;
9788
paddingHorizontal?: number | string | undefined;
98-
paddingInline?: number | string | undefined;
99-
paddingInlineEnd?: number | string | undefined;
100-
paddingInlineStart?: number | string | undefined;
10189
paddingLeft?: number | string | undefined;
10290
paddingRight?: number | string | undefined;
10391
paddingStart?: number | string | undefined;

Libraries/StyleSheet/StyleSheetTypes.js

Lines changed: 0 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -179,23 +179,6 @@ type ____LayoutStyle_Internal = $ReadOnly<{
179179
*/
180180
margin?: DimensionValue,
181181

182-
/** Setting `marginBlock` has the same effect as setting both
183-
* `marginTop` and `marginBottom`.
184-
*/
185-
marginBlock?: DimensionValue,
186-
187-
/** `marginBlockEnd` works like `margin-bottom` in CSS.
188-
* See https://developer.mozilla.org/en-US/docs/Web/CSS/margin-bottom
189-
* for more details.
190-
*/
191-
marginBlockEnd?: DimensionValue,
192-
193-
/** `marginBlockStart` works like `margin-top` in CSS.
194-
* See https://developer.mozilla.org/en-US/docs/Web/CSS/margin-top
195-
* for more details.
196-
*/
197-
marginBlockStart?: DimensionValue,
198-
199182
/** `marginBottom` works like `margin-bottom` in CSS.
200183
* See https://developer.mozilla.org/en-US/docs/Web/CSS/margin-bottom
201184
* for more details.
@@ -213,23 +196,6 @@ type ____LayoutStyle_Internal = $ReadOnly<{
213196
*/
214197
marginHorizontal?: DimensionValue,
215198

216-
/** Setting `marginInline` has the same effect as setting
217-
* both `marginLeft` and `marginRight`.
218-
*/
219-
marginInline?: DimensionValue,
220-
221-
/**
222-
* When direction is `ltr`, `marginInlineEnd` is equivalent to `marginRight`.
223-
* When direction is `rtl`, `marginInlineEnd` is equivalent to `marginLeft`.
224-
*/
225-
marginInlineEnd?: DimensionValue,
226-
227-
/**
228-
* When direction is `ltr`, `marginInlineStart` is equivalent to `marginLeft`.
229-
* When direction is `rtl`, `marginInlineStart` is equivalent to `marginRight`.
230-
*/
231-
marginInlineStart?: DimensionValue,
232-
233199
/** `marginLeft` works like `margin-left` in CSS.
234200
* See https://developer.mozilla.org/en-US/docs/Web/CSS/margin-left
235201
* for more details.
@@ -266,23 +232,6 @@ type ____LayoutStyle_Internal = $ReadOnly<{
266232
*/
267233
padding?: DimensionValue,
268234

269-
/** Setting `paddingBlock` is like setting both of
270-
* `paddingTop` and `paddingBottom`.
271-
*/
272-
paddingBlock?: DimensionValue,
273-
274-
/** `paddingBlockEnd` works like `padding-bottom` in CSS.
275-
* See https://developer.mozilla.org/en-US/docs/Web/CSS/padding-bottom
276-
* for more details.
277-
*/
278-
paddingBlockEnd?: DimensionValue,
279-
280-
/** `paddingBlockStart` works like `padding-top` in CSS.
281-
* See https://developer.mozilla.org/en-US/docs/Web/CSS/padding-top
282-
* for more details.
283-
*/
284-
paddingBlockStart?: DimensionValue,
285-
286235
/** `paddingBottom` works like `padding-bottom` in CSS.
287236
* See https://developer.mozilla.org/en-US/docs/Web/CSS/padding-bottom
288237
* for more details.
@@ -300,23 +249,6 @@ type ____LayoutStyle_Internal = $ReadOnly<{
300249
*/
301250
paddingHorizontal?: DimensionValue,
302251

303-
/** Setting `paddingInline` is like setting both of
304-
* `paddingLeft` and `paddingRight`.
305-
*/
306-
paddingInline?: DimensionValue,
307-
308-
/**
309-
* When direction is `ltr`, `paddingInlineEnd` is equivalent to `paddingRight`.
310-
* When direction is `rtl`, `paddingInlineEnd` is equivalent to `paddingLeft`.
311-
*/
312-
paddingInlineEnd?: DimensionValue,
313-
314-
/**
315-
* When direction is `ltr`, `paddingInlineStart` is equivalent to `paddingLeft`.
316-
* When direction is `rtl`, `paddingInlineStart` is equivalent to `paddingRight`.
317-
*/
318-
paddingInlineStart?: DimensionValue,
319-
320252
/** `paddingLeft` works like `padding-left` in CSS.
321253
* See https://developer.mozilla.org/en-US/docs/Web/CSS/padding-left
322254
* for more details.

Libraries/StyleSheet/__tests__/processStyles-test.js

Lines changed: 0 additions & 83 deletions
This file was deleted.

Libraries/StyleSheet/processStyles.js

Lines changed: 0 additions & 45 deletions
This file was deleted.

0 commit comments

Comments
 (0)