mirror of
https://github.com/facebook/react-native.git
synced 2024-11-21 12:39:27 +00:00
replace '$TEMPORARY$string<>' with 'string' (#46876)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46876
* Used codemods of [this commit](3a8982d631
)
* `js1 flow-runner codemod flow/replaceTempStringWithString`
* `js1 flow-runner codemod flow/simplifyUnionsOfString`
Changelog: [internal]
Reviewed By: SamChou19815
Differential Revision: D63991775
fbshipit-source-id: 5b9d1fdf045405230ca2b0969357ae92479692b5
This commit is contained in:
parent
bed5323374
commit
40a4feb681
@ -55,7 +55,7 @@ const drawableFileTypes = new Set([
|
|||||||
function getAndroidResourceFolderName(
|
function getAndroidResourceFolderName(
|
||||||
asset: PackagerAsset,
|
asset: PackagerAsset,
|
||||||
scale: number,
|
scale: number,
|
||||||
): string | $TEMPORARY$string<'raw'> {
|
): string {
|
||||||
if (!drawableFileTypes.has(asset.type)) {
|
if (!drawableFileTypes.has(asset.type)) {
|
||||||
return 'raw';
|
return 'raw';
|
||||||
}
|
}
|
||||||
|
@ -29,11 +29,7 @@ describe('Keyboard', () => {
|
|||||||
describe('scheduling layout animation', () => {
|
describe('scheduling layout animation', () => {
|
||||||
const scheduleLayoutAnimation = (
|
const scheduleLayoutAnimation = (
|
||||||
duration: null | number,
|
duration: null | number,
|
||||||
easing:
|
easing: null | string,
|
||||||
| null
|
|
||||||
| $TEMPORARY$string<'linear'>
|
|
||||||
| $TEMPORARY$string<'some-unknown-animation-type'>
|
|
||||||
| $TEMPORARY$string<'spring'>,
|
|
||||||
): void =>
|
): void =>
|
||||||
// $FlowFixMe[incompatible-call]
|
// $FlowFixMe[incompatible-call]
|
||||||
Keyboard.scheduleLayoutAnimation({duration, easing});
|
Keyboard.scheduleLayoutAnimation({duration, easing});
|
||||||
@ -60,9 +56,7 @@ describe('Keyboard', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
describe('animation update type', () => {
|
describe('animation update type', () => {
|
||||||
const assertAnimationUpdateType = (
|
const assertAnimationUpdateType = (type: string) =>
|
||||||
type: $TEMPORARY$string<'keyboard'> | $TEMPORARY$string<'linear'>,
|
|
||||||
) =>
|
|
||||||
expect(LayoutAnimation.configureNext).toHaveBeenCalledWith(
|
expect(LayoutAnimation.configureNext).toHaveBeenCalledWith(
|
||||||
expect.objectContaining({
|
expect.objectContaining({
|
||||||
duration: expect.anything(),
|
duration: expect.anything(),
|
||||||
|
@ -16,16 +16,7 @@ if (global.RN$Bridgeless === true && global.RN$registerCallableModule) {
|
|||||||
} else {
|
} else {
|
||||||
const BatchedBridge = require('../BatchedBridge/BatchedBridge');
|
const BatchedBridge = require('../BatchedBridge/BatchedBridge');
|
||||||
registerModule = (
|
registerModule = (
|
||||||
moduleName:
|
moduleName: string,
|
||||||
| $TEMPORARY$string<'GlobalPerformanceLogger'>
|
|
||||||
| $TEMPORARY$string<'HMRClient'>
|
|
||||||
| $TEMPORARY$string<'HeapCapture'>
|
|
||||||
| $TEMPORARY$string<'JSTimers'>
|
|
||||||
| $TEMPORARY$string<'RCTDeviceEventEmitter'>
|
|
||||||
| $TEMPORARY$string<'RCTLog'>
|
|
||||||
| $TEMPORARY$string<'RCTNativeAppEventEmitter'>
|
|
||||||
| $TEMPORARY$string<'SamplingProfiler'>
|
|
||||||
| $TEMPORARY$string<'Systrace'>,
|
|
||||||
/* $FlowFixMe[missing-local-annot] The type annotation(s) required by
|
/* $FlowFixMe[missing-local-annot] The type annotation(s) required by
|
||||||
* Flow's LTI update could not be added via codemod */
|
* Flow's LTI update could not be added via codemod */
|
||||||
factory,
|
factory,
|
||||||
|
@ -260,7 +260,7 @@ type EnableArgs = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
class NetworkAgent extends InspectorAgent {
|
class NetworkAgent extends InspectorAgent {
|
||||||
static DOMAIN: $TEMPORARY$string<'Network'> = 'Network';
|
static DOMAIN: string = 'Network';
|
||||||
|
|
||||||
_sendEvent: EventSender;
|
_sendEvent: EventSender;
|
||||||
_interceptor: ?Interceptor;
|
_interceptor: ?Interceptor;
|
||||||
|
@ -59,7 +59,7 @@ function TappableLinks(props: {
|
|||||||
|
|
||||||
// URLs were detected. Construct array of Text nodes.
|
// URLs were detected. Construct array of Text nodes.
|
||||||
|
|
||||||
let fragments: Array<React.Node> = [];
|
const fragments: Array<React.Node> = [];
|
||||||
let indexCounter = 0;
|
let indexCounter = 0;
|
||||||
let startIndex = 0;
|
let startIndex = 0;
|
||||||
|
|
||||||
@ -115,7 +115,7 @@ function LogBoxMessage(props: Props): React.Node {
|
|||||||
const elements = [];
|
const elements = [];
|
||||||
let length = 0;
|
let length = 0;
|
||||||
const createUnderLength = (
|
const createUnderLength = (
|
||||||
key: string | $TEMPORARY$string<'-1'>,
|
key: string,
|
||||||
message: string,
|
message: string,
|
||||||
style: void | TextStyleProp,
|
style: void | TextStyleProp,
|
||||||
) => {
|
) => {
|
||||||
|
@ -26,7 +26,7 @@ function processTransform(
|
|||||||
): Array<Object> | Array<number> {
|
): Array<Object> | Array<number> {
|
||||||
if (typeof transform === 'string') {
|
if (typeof transform === 'string') {
|
||||||
const regex = new RegExp(/(\w+)\(([^)]+)\)/g);
|
const regex = new RegExp(/(\w+)\(([^)]+)\)/g);
|
||||||
let transformArray: Array<Object> = [];
|
const transformArray: Array<Object> = [];
|
||||||
let matches;
|
let matches;
|
||||||
|
|
||||||
while ((matches = regex.exec(transform))) {
|
while ((matches = regex.exec(transform))) {
|
||||||
@ -50,23 +50,7 @@ function processTransform(
|
|||||||
}
|
}
|
||||||
|
|
||||||
const _getKeyAndValueFromCSSTransform: (
|
const _getKeyAndValueFromCSSTransform: (
|
||||||
key:
|
key: string,
|
||||||
| string
|
|
||||||
| $TEMPORARY$string<'matrix'>
|
|
||||||
| $TEMPORARY$string<'perspective'>
|
|
||||||
| $TEMPORARY$string<'rotate'>
|
|
||||||
| $TEMPORARY$string<'rotateX'>
|
|
||||||
| $TEMPORARY$string<'rotateY'>
|
|
||||||
| $TEMPORARY$string<'rotateZ'>
|
|
||||||
| $TEMPORARY$string<'scale'>
|
|
||||||
| $TEMPORARY$string<'scaleX'>
|
|
||||||
| $TEMPORARY$string<'scaleY'>
|
|
||||||
| $TEMPORARY$string<'skewX'>
|
|
||||||
| $TEMPORARY$string<'skewY'>
|
|
||||||
| $TEMPORARY$string<'translate'>
|
|
||||||
| $TEMPORARY$string<'translate3d'>
|
|
||||||
| $TEMPORARY$string<'translateX'>
|
|
||||||
| $TEMPORARY$string<'translateY'>,
|
|
||||||
args: string,
|
args: string,
|
||||||
) => {key: string, value?: Array<string | number> | number | string} = (
|
) => {key: string, value?: Array<string | number> | number | string} = (
|
||||||
key,
|
key,
|
||||||
@ -169,22 +153,7 @@ function _validateTransforms(transform: Array<Object>): void {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function _validateTransform(
|
function _validateTransform(
|
||||||
key:
|
key: string,
|
||||||
| string
|
|
||||||
| $TEMPORARY$string<'matrix'>
|
|
||||||
| $TEMPORARY$string<'perspective'>
|
|
||||||
| $TEMPORARY$string<'rotate'>
|
|
||||||
| $TEMPORARY$string<'rotateX'>
|
|
||||||
| $TEMPORARY$string<'rotateY'>
|
|
||||||
| $TEMPORARY$string<'rotateZ'>
|
|
||||||
| $TEMPORARY$string<'scale'>
|
|
||||||
| $TEMPORARY$string<'scaleX'>
|
|
||||||
| $TEMPORARY$string<'scaleY'>
|
|
||||||
| $TEMPORARY$string<'skewX'>
|
|
||||||
| $TEMPORARY$string<'skewY'>
|
|
||||||
| $TEMPORARY$string<'translate'>
|
|
||||||
| $TEMPORARY$string<'translateX'>
|
|
||||||
| $TEMPORARY$string<'translateY'>,
|
|
||||||
value: any | number | string,
|
value: any | number | string,
|
||||||
transformation: any,
|
transformation: any,
|
||||||
) {
|
) {
|
||||||
|
@ -5539,7 +5539,7 @@ type EnableArgs = {
|
|||||||
...
|
...
|
||||||
};
|
};
|
||||||
declare class NetworkAgent extends InspectorAgent {
|
declare class NetworkAgent extends InspectorAgent {
|
||||||
static DOMAIN: $TEMPORARY$string<\\"Network\\">;
|
static DOMAIN: string;
|
||||||
_sendEvent: EventSender;
|
_sendEvent: EventSender;
|
||||||
_interceptor: ?Interceptor;
|
_interceptor: ?Interceptor;
|
||||||
enable(EnableArgs): void;
|
enable(EnableArgs): void;
|
||||||
|
@ -500,7 +500,7 @@ class CheckboxExample extends React.Component<
|
|||||||
};
|
};
|
||||||
|
|
||||||
_onCheckboxPress = () => {
|
_onCheckboxPress = () => {
|
||||||
let checkboxState: boolean | $TEMPORARY$string<'mixed'> = false;
|
let checkboxState: boolean | string = false;
|
||||||
if (this.state.checkboxState === false) {
|
if (this.state.checkboxState === false) {
|
||||||
checkboxState = 'mixed';
|
checkboxState = 'mixed';
|
||||||
} else if (this.state.checkboxState === 'mixed') {
|
} else if (this.state.checkboxState === 'mixed') {
|
||||||
@ -510,7 +510,7 @@ class CheckboxExample extends React.Component<
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.setState({
|
this.setState({
|
||||||
checkboxState: checkboxState,
|
checkboxState,
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -548,7 +548,7 @@ class SwitchExample extends React.Component<
|
|||||||
const switchState = !this.state.switchState;
|
const switchState = !this.state.switchState;
|
||||||
|
|
||||||
this.setState({
|
this.setState({
|
||||||
switchState: switchState,
|
switchState,
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -601,7 +601,7 @@ class SelectionExample extends React.Component<
|
|||||||
if (!isEnabled) {
|
if (!isEnabled) {
|
||||||
accessibilityHint = 'use the button on the right to enable selection';
|
accessibilityHint = 'use the button on the right to enable selection';
|
||||||
}
|
}
|
||||||
let buttonTitle = isEnabled ? 'Disable selection' : 'Enable selection';
|
const buttonTitle = isEnabled ? 'Disable selection' : 'Enable selection';
|
||||||
const touchableHint = ` (touching the TouchableOpacity will ${
|
const touchableHint = ` (touching the TouchableOpacity will ${
|
||||||
isSelected ? 'disable' : 'enable'
|
isSelected ? 'disable' : 'enable'
|
||||||
} accessibilityState.selected)`;
|
} accessibilityState.selected)`;
|
||||||
@ -667,7 +667,7 @@ class ExpandableElementExample extends React.Component<
|
|||||||
const expandState = !this.state.expandState;
|
const expandState = !this.state.expandState;
|
||||||
|
|
||||||
this.setState({
|
this.setState({
|
||||||
expandState: expandState,
|
expandState,
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -719,7 +719,7 @@ class NestedCheckBox extends React.Component<
|
|||||||
}
|
}
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
this.setState({
|
this.setState({
|
||||||
checkbox1: checkbox1,
|
checkbox1,
|
||||||
checkbox2: checkbox1,
|
checkbox2: checkbox1,
|
||||||
checkbox3: checkbox1,
|
checkbox3: checkbox1,
|
||||||
});
|
});
|
||||||
@ -730,7 +730,7 @@ class NestedCheckBox extends React.Component<
|
|||||||
const checkbox2 = !this.state.checkbox2;
|
const checkbox2 = !this.state.checkbox2;
|
||||||
|
|
||||||
this.setState({
|
this.setState({
|
||||||
checkbox2: checkbox2,
|
checkbox2,
|
||||||
checkbox1:
|
checkbox1:
|
||||||
checkbox2 && this.state.checkbox3
|
checkbox2 && this.state.checkbox3
|
||||||
? true
|
? true
|
||||||
@ -744,7 +744,7 @@ class NestedCheckBox extends React.Component<
|
|||||||
const checkbox3 = !this.state.checkbox3;
|
const checkbox3 = !this.state.checkbox3;
|
||||||
|
|
||||||
this.setState({
|
this.setState({
|
||||||
checkbox3: checkbox3,
|
checkbox3,
|
||||||
checkbox1:
|
checkbox1:
|
||||||
this.state.checkbox2 && checkbox3
|
this.state.checkbox2 && checkbox3
|
||||||
? true
|
? true
|
||||||
|
Loading…
Reference in New Issue
Block a user