Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace $FlowFixMe in BorderBox #48593

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 26 additions & 14 deletions packages/react-native/Libraries/Inspector/BorderBox.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,23 +10,35 @@

'use strict';

import type {ViewStyleProp} from '../StyleSheet/StyleSheet';

import React from 'react';

const View = require('../Components/View/View');
const React = require('react');

class BorderBox extends React.Component<$FlowFixMeProps> {
render(): $FlowFixMe | React.Node {
const box = this.props.box;
if (!box) {
return this.props.children;
}
const style = {
borderTopWidth: box.top,
borderBottomWidth: box.bottom,
borderLeftWidth: box.left,
borderRightWidth: box.right,
};
return <View style={[style, this.props.style]}>{this.props.children}</View>;
type Props = $ReadOnly<{
children: React.Node,
box?: ?$ReadOnly<{
top: number,
right: number,
bottom: number,
left: number,
...
}>,
style?: ViewStyleProp,
}>;

function BorderBox({children, box, style}: Props): React.Node {
if (!box) {
return children;
}
const borderStyle = {
borderTopWidth: box.top,
borderBottomWidth: box.bottom,
borderLeftWidth: box.left,
borderRightWidth: box.right,
};
return <View style={[borderStyle, style]}>{children}</View>;
}

module.exports = BorderBox;
Original file line number Diff line number Diff line change
Expand Up @@ -5150,10 +5150,18 @@ declare module.exports: resolveAssetSource;
`;

exports[`public API should not change unintentionally Libraries/Inspector/BorderBox.js 1`] = `
"declare const React: $FlowFixMe;
declare class BorderBox extends React.Component<$FlowFixMeProps> {
render(): $FlowFixMe | React.Node;
}
"type Props = $ReadOnly<{
children: React.Node,
box?: ?$ReadOnly<{
top: number,
right: number,
bottom: number,
left: number,
...
}>,
style?: ViewStyleProp,
}>;
declare function BorderBox(Props): React.Node;
declare module.exports: BorderBox;
"
`;
Expand Down
Loading