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(
|
||||
asset: PackagerAsset,
|
||||
scale: number,
|
||||
): string | $TEMPORARY$string<'raw'> {
|
||||
): string {
|
||||
if (!drawableFileTypes.has(asset.type)) {
|
||||
return 'raw';
|
||||
}
|
||||
|
@ -29,11 +29,7 @@ describe('Keyboard', () => {
|
||||
describe('scheduling layout animation', () => {
|
||||
const scheduleLayoutAnimation = (
|
||||
duration: null | number,
|
||||
easing:
|
||||
| null
|
||||
| $TEMPORARY$string<'linear'>
|
||||
| $TEMPORARY$string<'some-unknown-animation-type'>
|
||||
| $TEMPORARY$string<'spring'>,
|
||||
easing: null | string,
|
||||
): void =>
|
||||
// $FlowFixMe[incompatible-call]
|
||||
Keyboard.scheduleLayoutAnimation({duration, easing});
|
||||
@ -60,9 +56,7 @@ describe('Keyboard', () => {
|
||||
});
|
||||
|
||||
describe('animation update type', () => {
|
||||
const assertAnimationUpdateType = (
|
||||
type: $TEMPORARY$string<'keyboard'> | $TEMPORARY$string<'linear'>,
|
||||
) =>
|
||||
const assertAnimationUpdateType = (type: string) =>
|
||||
expect(LayoutAnimation.configureNext).toHaveBeenCalledWith(
|
||||
expect.objectContaining({
|
||||
duration: expect.anything(),
|
||||
|
@ -16,16 +16,7 @@ if (global.RN$Bridgeless === true && global.RN$registerCallableModule) {
|
||||
} else {
|
||||
const BatchedBridge = require('../BatchedBridge/BatchedBridge');
|
||||
registerModule = (
|
||||
moduleName:
|
||||
| $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'>,
|
||||
moduleName: string,
|
||||
/* $FlowFixMe[missing-local-annot] The type annotation(s) required by
|
||||
* Flow's LTI update could not be added via codemod */
|
||||
factory,
|
||||
|
@ -260,7 +260,7 @@ type EnableArgs = {
|
||||
};
|
||||
|
||||
class NetworkAgent extends InspectorAgent {
|
||||
static DOMAIN: $TEMPORARY$string<'Network'> = 'Network';
|
||||
static DOMAIN: string = 'Network';
|
||||
|
||||
_sendEvent: EventSender;
|
||||
_interceptor: ?Interceptor;
|
||||
|
@ -59,7 +59,7 @@ function TappableLinks(props: {
|
||||
|
||||
// URLs were detected. Construct array of Text nodes.
|
||||
|
||||
let fragments: Array<React.Node> = [];
|
||||
const fragments: Array<React.Node> = [];
|
||||
let indexCounter = 0;
|
||||
let startIndex = 0;
|
||||
|
||||
@ -115,7 +115,7 @@ function LogBoxMessage(props: Props): React.Node {
|
||||
const elements = [];
|
||||
let length = 0;
|
||||
const createUnderLength = (
|
||||
key: string | $TEMPORARY$string<'-1'>,
|
||||
key: string,
|
||||
message: string,
|
||||
style: void | TextStyleProp,
|
||||
) => {
|
||||
|
@ -26,7 +26,7 @@ function processTransform(
|
||||
): Array<Object> | Array<number> {
|
||||
if (typeof transform === 'string') {
|
||||
const regex = new RegExp(/(\w+)\(([^)]+)\)/g);
|
||||
let transformArray: Array<Object> = [];
|
||||
const transformArray: Array<Object> = [];
|
||||
let matches;
|
||||
|
||||
while ((matches = regex.exec(transform))) {
|
||||
@ -50,23 +50,7 @@ function processTransform(
|
||||
}
|
||||
|
||||
const _getKeyAndValueFromCSSTransform: (
|
||||
key:
|
||||
| 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'>,
|
||||
key: string,
|
||||
args: string,
|
||||
) => {key: string, value?: Array<string | number> | number | string} = (
|
||||
key,
|
||||
@ -169,22 +153,7 @@ function _validateTransforms(transform: Array<Object>): void {
|
||||
}
|
||||
|
||||
function _validateTransform(
|
||||
key:
|
||||
| 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'>,
|
||||
key: string,
|
||||
value: any | number | string,
|
||||
transformation: any,
|
||||
) {
|
||||
|
@ -5539,7 +5539,7 @@ type EnableArgs = {
|
||||
...
|
||||
};
|
||||
declare class NetworkAgent extends InspectorAgent {
|
||||
static DOMAIN: $TEMPORARY$string<\\"Network\\">;
|
||||
static DOMAIN: string;
|
||||
_sendEvent: EventSender;
|
||||
_interceptor: ?Interceptor;
|
||||
enable(EnableArgs): void;
|
||||
|
@ -500,7 +500,7 @@ class CheckboxExample extends React.Component<
|
||||
};
|
||||
|
||||
_onCheckboxPress = () => {
|
||||
let checkboxState: boolean | $TEMPORARY$string<'mixed'> = false;
|
||||
let checkboxState: boolean | string = false;
|
||||
if (this.state.checkboxState === false) {
|
||||
checkboxState = 'mixed';
|
||||
} else if (this.state.checkboxState === 'mixed') {
|
||||
@ -510,7 +510,7 @@ class CheckboxExample extends React.Component<
|
||||
}
|
||||
|
||||
this.setState({
|
||||
checkboxState: checkboxState,
|
||||
checkboxState,
|
||||
});
|
||||
};
|
||||
|
||||
@ -548,7 +548,7 @@ class SwitchExample extends React.Component<
|
||||
const switchState = !this.state.switchState;
|
||||
|
||||
this.setState({
|
||||
switchState: switchState,
|
||||
switchState,
|
||||
});
|
||||
};
|
||||
|
||||
@ -601,7 +601,7 @@ class SelectionExample extends React.Component<
|
||||
if (!isEnabled) {
|
||||
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 ${
|
||||
isSelected ? 'disable' : 'enable'
|
||||
} accessibilityState.selected)`;
|
||||
@ -667,7 +667,7 @@ class ExpandableElementExample extends React.Component<
|
||||
const expandState = !this.state.expandState;
|
||||
|
||||
this.setState({
|
||||
expandState: expandState,
|
||||
expandState,
|
||||
});
|
||||
};
|
||||
|
||||
@ -719,7 +719,7 @@ class NestedCheckBox extends React.Component<
|
||||
}
|
||||
setTimeout(() => {
|
||||
this.setState({
|
||||
checkbox1: checkbox1,
|
||||
checkbox1,
|
||||
checkbox2: checkbox1,
|
||||
checkbox3: checkbox1,
|
||||
});
|
||||
@ -730,7 +730,7 @@ class NestedCheckBox extends React.Component<
|
||||
const checkbox2 = !this.state.checkbox2;
|
||||
|
||||
this.setState({
|
||||
checkbox2: checkbox2,
|
||||
checkbox2,
|
||||
checkbox1:
|
||||
checkbox2 && this.state.checkbox3
|
||||
? true
|
||||
@ -744,7 +744,7 @@ class NestedCheckBox extends React.Component<
|
||||
const checkbox3 = !this.state.checkbox3;
|
||||
|
||||
this.setState({
|
||||
checkbox3: checkbox3,
|
||||
checkbox3,
|
||||
checkbox1:
|
||||
this.state.checkbox2 && checkbox3
|
||||
? true
|
||||
|
Loading…
Reference in New Issue
Block a user