Skip to content

Commit

Permalink
Deploy 0.217.0 to fbsource (#39610)
Browse files Browse the repository at this point in the history
Summary: Pull Request resolved: #39610

Reviewed By: SamChou19815

Differential Revision: D49522399

fbshipit-source-id: 98dc8ce53a4dea2b68909fda5f92251c6cc91717
  • Loading branch information
pieterv authored and facebook-github-bot committed Sep 23, 2023
1 parent 0f2ecd3 commit 29f62a4
Show file tree
Hide file tree
Showing 24 changed files with 61 additions and 8 deletions.
2 changes: 1 addition & 1 deletion .flowconfig
Original file line number Diff line number Diff line change
Expand Up @@ -77,4 +77,4 @@ untyped-import
untyped-type-import

[version]
^0.216.1
^0.217.0
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@
"eslint-plugin-redundant-undefined": "^0.4.0",
"eslint-plugin-relay": "^1.8.3",
"flow-api-translator": "0.15.0",
"flow-bin": "^0.216.1",
"flow-bin": "^0.217.0",
"glob": "^7.1.1",
"hermes-eslint": "0.15.0",
"inquirer": "^7.1.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ const {verifyPropNotAlreadyDefined} = require('../../parsers-commons');
import type {TypeDeclarationMap, PropAST, ASTNode} from '../../utils';
import type {BuildSchemaFN, Parser} from '../../parser';

// $FlowFixMe[unsupported-variance-annotation]
function getTypeAnnotationForArray<+T>(
name: string,
typeAnnotation: $FlowFixMe,
Expand Down Expand Up @@ -206,6 +207,7 @@ function flattenProperties(
.filter(Boolean);
}

// $FlowFixMe[unsupported-variance-annotation]
function getTypeAnnotation<+T>(
name: string,
annotation: $FlowFixMe | ASTNode,
Expand Down
2 changes: 2 additions & 0 deletions packages/react-native-codegen/src/parsers/parsers-commons.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ function wrapModuleSchema(
};
}

// $FlowFixMe[unsupported-variance-annotation]
function unwrapNullable<+T: NativeModuleTypeAnnotation>(
x: Nullable<T>,
): [T, boolean] {
Expand All @@ -115,6 +116,7 @@ function unwrapNullable<+T: NativeModuleTypeAnnotation>(
return [x, false];
}

// $FlowFixMe[unsupported-variance-annotation]
function wrapNullable<+T: NativeModuleTypeAnnotation>(
nullable: boolean,
typeAnnotation: T,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import * as React from 'react';
* @see https://github.com/facebook/react-native/commit/b8c8562
*/
const FlatListWithEventThrottle = React.forwardRef(
// $FlowFixMe[incompatible-call]
(
props: React.ElementConfig<typeof FlatList>,
ref:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ const AnimatedScrollView: AnimatedComponentType<Props, Instance> =
});

const AnimatedScrollViewWithInvertedRefreshControl = React.forwardRef(
// $FlowFixMe[incompatible-call]
(
props: {
...React.ElementConfig<typeof ScrollView>,
Expand All @@ -76,6 +77,7 @@ const AnimatedScrollViewWithInvertedRefreshControl = React.forwardRef(
const {intermediatePropsForRefreshControl, intermediatePropsForScrollView} =
useMemo(() => {
// $FlowFixMe[underconstrained-implicit-instantiation]
// $FlowFixMe[incompatible-call]
const {outer, inner} = splitLayoutProps(flattenStyle(props.style));
return {
intermediatePropsForRefreshControl: {style: outer},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import * as React from 'react';
* @see https://github.com/facebook/react-native/commit/b8c8562
*/
const SectionListWithEventThrottle = React.forwardRef(
// $FlowFixMe[incompatible-call]
(
props: React.ElementConfig<typeof SectionList>,
ref:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ export default function createAnimatedComponent<TProps: {...}, TInstance>(
// $FlowFixMe[incompatible-call]
props,
);
// $FlowFixMe[incompatible-call]
const ref = useMergeRefs<TInstance | null>(callbackRef, forwardedRef);

// Some components require explicit passthrough values for animation
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1665,6 +1665,7 @@ class ScrollView extends React.Component<Props, State> {
// $FlowFixMe[underconstrained-implicit-instantiation]
const style = flattenStyle(this.props.style);
const childLayoutProps = ['alignItems', 'justifyContent'].filter(
// $FlowFixMe[incompatible-use]
prop => style && style[prop] !== undefined,
);
invariant(
Expand Down Expand Up @@ -1836,6 +1837,7 @@ class ScrollView extends React.Component<Props, State> {
// Note: we should split props.style on the inner and outer props
// however, the ScrollView still needs the baseStyle to be scrollable
// $FlowFixMe[underconstrained-implicit-instantiation]
// $FlowFixMe[incompatible-call]
const {outer, inner} = splitLayoutProps(flattenStyle(props.style));
return React.cloneElement(
refreshControl,
Expand Down Expand Up @@ -1923,6 +1925,7 @@ function Wrapper(props, ref: (mixed => mixed) | {current: mixed, ...}) {
return <ScrollView {...props} scrollViewRef={ref} />;
}
Wrapper.displayName = 'ScrollView';
// $FlowFixMe[incompatible-call]
const ForwardedScrollView = React.forwardRef(Wrapper);

// $FlowFixMe[prop-missing] Add static context to ForwardedScrollView
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ const ScrollViewStickyHeaderWithForwardedRef: React.AbstractComponent<
}, []);
const ref: (React.ElementRef<typeof Animated.View> | null) => void =
// $FlowFixMe[incompatible-type] - Ref is mutated by `callbackRef`.
// $FlowFixMe[incompatible-call]
useMergeRefs<Instance | null>(callbackRef, forwardedRef);

const offset = useMemo(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@ const SwitchWithForwardedRef: React.AbstractComponent<
typeof SwitchNativeComponent | typeof AndroidSwitchNativeComponent,
> | null>(null);

// $FlowFixMe[incompatible-call]
const ref = useMergeRefs(nativeSwitchRef, forwardedRef);

const [native, setNative] = React.useState({value: (null: ?boolean)});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1636,6 +1636,7 @@ const autoCompleteWebToTextContentTypeMap = {
const ExportedForwardRef: React.AbstractComponent<
React.ElementConfig<typeof InternalTextInput>,
TextInputInstance,
// $FlowFixMe[incompatible-call]
> = React.forwardRef(function TextInput(
{
allowFontScaling = true,
Expand All @@ -1658,8 +1659,13 @@ const ExportedForwardRef: React.AbstractComponent<
let style = flattenStyle(restProps.style);

if (style?.verticalAlign != null) {
// $FlowFixMe[prop-missing]
// $FlowFixMe[cannot-write]
style.textAlignVertical =
// $FlowFixMe[invalid-computed-prop]
verticalAlignToTextAlignVerticalMap[style.verticalAlign];
// $FlowFixMe[prop-missing]
// $FlowFixMe[cannot-write]
delete style.verticalAlign;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,7 @@ class TouchableOpacity extends React.Component<Props, State> {

_getChildStyleOpacityWithDefault(): number {
// $FlowFixMe[underconstrained-implicit-instantiation]
// $FlowFixMe[prop-missing]
const opacity = flattenStyle(this.props.style)?.opacity;
return typeof opacity === 'number' ? opacity : 1;
}
Expand Down Expand Up @@ -303,8 +304,10 @@ class TouchableOpacity extends React.Component<Props, State> {
if (
this.props.disabled !== prevProps.disabled ||
// $FlowFixMe[underconstrained-implicit-instantiation]
// $FlowFixMe[prop-missing]
flattenStyle(prevProps.style)?.opacity !==
// $FlowFixMe[underconstrained-implicit-instantiation]
// $FlowFixMe[prop-missing]
flattenStyle(this.props.style)?.opacity
) {
this._opacityInactive(250);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,7 @@ class TouchableWithoutFeedback extends React.Component<Props, State> {
}
}

// $FlowFixMe[incompatible-call]
return React.cloneElement(element, elementProps, ...children);
}

Expand Down
2 changes: 2 additions & 0 deletions packages/react-native/Libraries/Components/View/View.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ const View: React.AbstractComponent<
// $FlowFixMe[underconstrained-implicit-instantiation]
let style = flattenStyle(otherProps.style);

// $FlowFixMe[sketchy-null-mixed]
const newPointerEvents = style?.pointerEvents || pointerEvents;
const collapsableOverride =
ReactNativeFeatureFlags.shouldForceUnflattenForElevation()
Expand Down Expand Up @@ -131,6 +132,7 @@ const View: React.AbstractComponent<
}
nativeID={id ?? nativeID}
style={style}
// $FlowFixMe[incompatible-type]
pointerEvents={newPointerEvents}
ref={forwardedRef}
/>
Expand Down
8 changes: 7 additions & 1 deletion packages/react-native/Libraries/Image/Image.android.js
Original file line number Diff line number Diff line change
Expand Up @@ -197,11 +197,14 @@ const BaseImage = (props: ImagePropsType, forwardedRef) => {
};

const objectFit =
// $FlowFixMe[prop-missing]
style && style.objectFit
? convertObjectFitToResizeMode(style.objectFit)
? // $FlowFixMe[incompatible-call]
convertObjectFitToResizeMode(style.objectFit)
: null;
// $FlowFixMe[prop-missing]
const resizeMode =
// $FlowFixMe[prop-missing]
objectFit || props.resizeMode || (style && style.resizeMode) || 'cover';

return (
Expand All @@ -220,7 +223,9 @@ const BaseImage = (props: ImagePropsType, forwardedRef) => {
if (hasTextAncestor) {
return (
<TextInlineImageNativeComponent
// $FlowFixMe[incompatible-type]
style={style}
// $FlowFixMe[incompatible-type]
resizeMode={resizeMode}
headers={nativeProps.headers}
src={sources}
Expand All @@ -232,6 +237,7 @@ const BaseImage = (props: ImagePropsType, forwardedRef) => {
return (
<ImageViewNativeComponent
{...nativePropsWithAnalytics}
// $FlowFixMe[incompatible-type]
resizeMode={resizeMode}
/>
);
Expand Down
4 changes: 3 additions & 1 deletion packages/react-native/Libraries/Image/Image.ios.js
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,8 @@ const BaseImage = (props: ImagePropsType, forwardedRef) => {
const objectFit =
// $FlowFixMe[prop-missing]
style && style.objectFit
? convertObjectFitToResizeMode(style.objectFit)
? // $FlowFixMe[incompatible-call]
convertObjectFitToResizeMode(style.objectFit)
: null;
const resizeMode =
// $FlowFixMe[prop-missing]
Expand Down Expand Up @@ -178,6 +179,7 @@ const BaseImage = (props: ImagePropsType, forwardedRef) => {
accessibilityLabel={accessibilityLabel ?? props.alt}
ref={forwardedRef}
style={style}
// $FlowFixMe[incompatible-type]
resizeMode={resizeMode}
tintColor={tintColor}
source={sources}
Expand Down
2 changes: 2 additions & 0 deletions packages/react-native/Libraries/Image/ImageBackground.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,9 @@ class ImageBackground extends React.Component<ImageBackgroundProps> {
// So, we have to proxy/reapply these styles explicitly for actual <Image> component.
// This workaround should be removed after implementing proper support of
// intrinsic content size of the <Image>.
// $FlowFixMe[prop-missing]
width: flattenedStyle?.width,
// $FlowFixMe[prop-missing]
height: flattenedStyle?.height,
},
imageStyle,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ module.exports = {
// TODO: Remove when React has migrated to `createAttributePayload` and `diffAttributePayloads`
get flattenStyle(): flattenStyle<DangerouslyImpreciseStyleProp> {
// $FlowFixMe[underconstrained-implicit-instantiation]
// $FlowFixMe[incompatible-return]
return require('../StyleSheet/flattenStyle');
},
get ReactFiberErrorDialog(): ReactFiberErrorDialog {
Expand Down
1 change: 1 addition & 0 deletions packages/react-native/Libraries/StyleSheet/StyleSheet.js
Original file line number Diff line number Diff line change
Expand Up @@ -363,6 +363,7 @@ module.exports = {
/**
* Creates a StyleSheet style reference from the given object.
*/
// $FlowFixMe[unsupported-variance-annotation]
create<+S: ____Styles_Internal>(obj: S): $ReadOnly<S> {
// TODO: This should return S as the return type. But first,
// we need to codemod all the callsites that are typing this
Expand Down
4 changes: 4 additions & 0 deletions packages/react-native/Libraries/StyleSheet/flattenStyle.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import type {DangerouslyImpreciseStyleProp} from './StyleSheet';
import type {____FlattenStyleProp_Internal} from './StyleSheetTypes';

// $FlowFixMe[unsupported-variance-annotation]
function flattenStyle<+TStyleProp: DangerouslyImpreciseStyleProp>(
style: ?TStyleProp,
// $FlowFixMe[underconstrained-implicit-instantiation]
Expand All @@ -30,11 +31,14 @@ function flattenStyle<+TStyleProp: DangerouslyImpreciseStyleProp>(
// $FlowFixMe[underconstrained-implicit-instantiation]
const computedStyle = flattenStyle(style[i]);
if (computedStyle) {
// $FlowFixMe[invalid-in-rhs]
for (const key in computedStyle) {
// $FlowFixMe[incompatible-use]
result[key] = computedStyle[key];
}
}
}
// $FlowFixMe[incompatible-return]
return result;
}

Expand Down
10 changes: 10 additions & 0 deletions packages/react-native/Libraries/Text/Text.js
Original file line number Diff line number Diff line change
Expand Up @@ -214,18 +214,28 @@ const Text: React.AbstractComponent<
style = flattenStyle(style);

if (typeof style?.fontWeight === 'number') {
// $FlowFixMe[prop-missing]
// $FlowFixMe[cannot-write]
style.fontWeight = style?.fontWeight.toString();
}

let _selectable = restProps.selectable;
if (style?.userSelect != null) {
// $FlowFixMe[invalid-computed-prop]
_selectable = userSelectToSelectableMap[style.userSelect];
// $FlowFixMe[prop-missing]
// $FlowFixMe[cannot-write]
delete style.userSelect;
}

if (style?.verticalAlign != null) {
// $FlowFixMe[prop-missing]
// $FlowFixMe[cannot-write]
style.textAlignVertical =
// $FlowFixMe[invalid-computed-prop]
verticalAlignToTextAlignVerticalMap[style.verticalAlign];
// $FlowFixMe[prop-missing]
// $FlowFixMe[cannot-write]
delete style.verticalAlign;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ type Props = {
};

const BaseFlatListExample = React.forwardRef(
// $FlowFixMe[incompatible-call]
(
props: Props,
ref:
Expand Down
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5038,10 +5038,10 @@ flow-api-translator@0.15.0:
hermes-parser "0.15.0"
hermes-transform "0.15.0"

flow-bin@^0.216.1:
version "0.216.1"
resolved "https://registry.yarnpkg.com/flow-bin/-/flow-bin-0.216.1.tgz#c370af830e46645087a2aea4056507cc44acc031"
integrity sha512-mdhkQiSSZ/nyPq/pmk2tdbV3btYTlTYqBT/96nSSTGQmvTWQ0no9XMLZ/SygNafL4PPerfkpwQwprA1M35+9Bg==
flow-bin@^0.217.0:
version "0.217.0"
resolved "https://registry.yarnpkg.com/flow-bin/-/flow-bin-0.217.0.tgz#c255b4d8d815520d396416c2f712ab849d61f467"
integrity sha512-AbbDE6QUpR+jpY9ejNROAk0P5D/2PxJzjU4D5vfmMwtS+QjjPjzfZGuatEJIn2k4PTZ2agbncaCtyHGO0AvG7A==

flow-enums-runtime@^0.0.6:
version "0.0.6"
Expand Down

0 comments on commit 29f62a4

Please sign in to comment.