Skip to content

Commit f214a52

Browse files
Susmita Horrowfacebook-github-bot
authored andcommitted
Revert D76814453: Reduce symbol collisions in the API snapshot
Differential Revision: D76814453 Original commit changeset: fffbf585d63e Original Phabricator Diff: D76814453 fbshipit-source-id: 418ae90fb49c8c05f077bca7e434c039ad49c7ba
1 parent f338db9 commit f214a52

12 files changed

Lines changed: 58 additions & 73 deletions

File tree

packages/react-native/Libraries/Components/Button.js

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -281,12 +281,10 @@ export type ButtonProps = $ReadOnly<{
281281
```
282282
*/
283283

284-
const NativeTouchable:
285-
| typeof TouchableNativeFeedback
286-
| typeof TouchableOpacity =
284+
const Touchable: typeof TouchableNativeFeedback | typeof TouchableOpacity =
287285
Platform.OS === 'android' ? TouchableNativeFeedback : TouchableOpacity;
288286

289-
type ButtonRef = React.ElementRef<typeof NativeTouchable>;
287+
type ButtonRef = React.ElementRef<typeof Touchable>;
290288

291289
const Button: component(
292290
ref?: React.RefSetter<ButtonRef>,
@@ -364,7 +362,7 @@ const Button: component(
364362
: importantForAccessibility;
365363

366364
return (
367-
<NativeTouchable
365+
<Touchable
368366
accessible={accessible}
369367
accessibilityActions={accessibilityActions}
370368
onAccessibilityAction={onAccessibilityAction}
@@ -393,7 +391,7 @@ const Button: component(
393391
{formattedTitle}
394392
</Text>
395393
</View>
396-
</NativeTouchable>
394+
</Touchable>
397395
);
398396
};
399397

packages/react-native/Libraries/Components/SafeAreaView/SafeAreaView.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,12 @@ import * as React from 'react';
2424
* sensor housing area on iPhone X).
2525
* @deprecated Use `react-native-safe-area-context` instead. This component will be removed in a future release.
2626
*/
27-
const SafeAreaView: component(
27+
const exported: component(
2828
ref?: React.RefSetter<React.ElementRef<typeof View>>,
2929
...props: ViewProps
3030
) = Platform.select({
3131
ios: require('./RCTSafeAreaViewNativeComponent').default,
3232
default: View,
3333
});
3434

35-
export default SafeAreaView;
35+
export default exported;

packages/react-native/Libraries/EventEmitter/NativeEventEmitter.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ export type {EventSubscription, EmitterSubscription};
3232
export type NativeEventSubscription = EventSubscription;
3333

3434
// $FlowFixMe[unclear-type] unclear type of events
35-
type UnsafeNativeEventObject = Object;
35+
type UnsafeObject = Object;
3636

3737
/**
3838
* `NativeEventEmitter` is intended for use by Native Modules to emit events to
@@ -46,8 +46,8 @@ type UnsafeNativeEventObject = Object;
4646
*/
4747
export default class NativeEventEmitter<
4848
TEventToArgsMap: $ReadOnly<
49-
Record<string, $ReadOnlyArray<UnsafeNativeEventObject>>,
50-
> = $ReadOnly<Record<string, $ReadOnlyArray<UnsafeNativeEventObject>>>,
49+
Record<string, $ReadOnlyArray<UnsafeObject>>,
50+
> = $ReadOnly<Record<string, $ReadOnlyArray<UnsafeObject>>>,
5151
> implements IEventEmitter<TEventToArgsMap>
5252
{
5353
_nativeModule: ?NativeModule;

packages/react-native/Libraries/LayoutAnimation/LayoutAnimation.js

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ type OnAnimationDidFailCallback = () => void;
4545
let isLayoutAnimationEnabled: boolean =
4646
ReactNativeFeatureFlags.isLayoutAnimationEnabled();
4747

48-
function setLayoutAnimationEnabled(value: boolean) {
48+
function setEnabled(value: boolean) {
4949
isLayoutAnimationEnabled = isLayoutAnimationEnabled;
5050
}
5151

@@ -115,7 +115,7 @@ function configureNext(
115115
}
116116
}
117117

118-
function createLayoutAnimation(
118+
function create(
119119
duration: number,
120120
type?: LayoutAnimationType,
121121
property?: LayoutAnimationProperty,
@@ -129,16 +129,12 @@ function createLayoutAnimation(
129129
}
130130

131131
const Presets = {
132-
easeInEaseOut: (createLayoutAnimation(
132+
easeInEaseOut: (create(
133133
300,
134134
'easeInEaseOut',
135135
'opacity',
136136
): LayoutAnimationConfig),
137-
linear: (createLayoutAnimation(
138-
500,
139-
'linear',
140-
'opacity',
141-
): LayoutAnimationConfig),
137+
linear: (create(500, 'linear', 'opacity'): LayoutAnimationConfig),
142138
spring: ({
143139
duration: 700,
144140
create: {
@@ -184,7 +180,7 @@ const LayoutAnimation = {
184180
/**
185181
* Helper for creating a config for `configureNext`.
186182
*/
187-
create: createLayoutAnimation,
183+
create,
188184
Types: Object.freeze({
189185
spring: 'spring',
190186
linear: 'linear',
@@ -212,7 +208,7 @@ const LayoutAnimation = {
212208
spring: (configureNext.bind(null, Presets.spring): (
213209
onAnimationDidEnd?: OnAnimationDidEndCallback,
214210
) => void),
215-
setEnabled: setLayoutAnimationEnabled,
211+
setEnabled,
216212
};
217213

218214
export default LayoutAnimation;

packages/react-native/Libraries/Lists/FlatList.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ import type {
1515
ListRenderItemInfo,
1616
ViewabilityConfigCallbackPair,
1717
ViewToken,
18-
VirtualizedListProps,
1918
} from '@react-native/virtualized-lists';
2019

2120
import * as ReactNativeFeatureFlags from '../../src/private/featureflags/ReactNativeFeatureFlags';

packages/react-native/Libraries/PermissionsAndroid/PermissionsAndroid.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ const PERMISSIONS = Object.freeze({
130130
*
131131
* See https://reactnative.dev/docs/permissionsandroid
132132
*/
133-
class PermissionsAndroidImpl {
133+
class PermissionsAndroid {
134134
PERMISSIONS: PermissionsType = PERMISSIONS;
135135
RESULTS: $ReadOnly<{
136136
DENIED: 'denied',
@@ -297,6 +297,5 @@ class PermissionsAndroidImpl {
297297
}
298298
}
299299

300-
const PermissionsAndroidInstance: PermissionsAndroidImpl =
301-
new PermissionsAndroidImpl();
300+
const PermissionsAndroidInstance: PermissionsAndroid = new PermissionsAndroid();
302301
export default PermissionsAndroidInstance;

packages/react-native/Libraries/ReactNative/AppRegistry.flow.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ import type {RootTag} from '../Types/RootTagTypes';
1313
import type {IPerformanceLogger} from '../Utilities/createPerformanceLogger';
1414
import type {DisplayModeType} from './DisplayMode';
1515

16-
type HeadlessTask = (taskData: any) => Promise<void>;
17-
export type TaskProvider = () => HeadlessTask;
16+
type Task = (taskData: any) => Promise<void>;
17+
export type TaskProvider = () => Task;
1818

1919
export type ComponentProvider = () => React.ComponentType<any>;
2020
export type ComponentProviderInstrumentationHook = (

packages/react-native/Libraries/Utilities/NativeDeviceInfo.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,6 @@
99
*/
1010

1111
export * from '../../src/private/specs_DEPRECATED/modules/NativeDeviceInfo';
12-
export {default} from '../../src/private/specs_DEPRECATED/modules/NativeDeviceInfo';
12+
import NativeDeviceInfo from '../../src/private/specs_DEPRECATED/modules/NativeDeviceInfo';
13+
14+
export default NativeDeviceInfo;

packages/react-native/Libraries/__tests__/__snapshots__/public-api-test.js.snap

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1535,10 +1535,10 @@ exports[`public API should not change unintentionally Libraries/Components/Butto
15351535
accessibilityHint?: ?string,
15361536
accessibilityLanguage?: ?Stringish,
15371537
}>;
1538-
declare const NativeTouchable:
1538+
declare const Touchable:
15391539
| typeof TouchableNativeFeedback
15401540
| typeof TouchableOpacity;
1541-
type ButtonRef = React.ElementRef<typeof NativeTouchable>;
1541+
type ButtonRef = React.ElementRef<typeof Touchable>;
15421542
declare const Button: component(
15431543
ref?: React.RefSetter<ButtonRef>,
15441544
...props: ButtonProps
@@ -1928,11 +1928,11 @@ export { default } from \\"../../../src/private/specs_DEPRECATED/components/RCTS
19281928
`;
19291929

19301930
exports[`public API should not change unintentionally Libraries/Components/SafeAreaView/SafeAreaView.js 1`] = `
1931-
"declare const SafeAreaView: component(
1931+
"declare const exported: component(
19321932
ref?: React.RefSetter<React.ElementRef<typeof View>>,
19331933
...props: ViewProps
19341934
);
1935-
declare export default typeof SafeAreaView;
1935+
declare export default typeof exported;
19361936
"
19371937
`;
19381938

@@ -4175,11 +4175,11 @@ exports[`public API should not change unintentionally Libraries/EventEmitter/Nat
41754175
type EmitterSubscription = EventSubscription;
41764176
export type { EventSubscription, EmitterSubscription };
41774177
export type NativeEventSubscription = EventSubscription;
4178-
type UnsafeNativeEventObject = Object;
4178+
type UnsafeObject = Object;
41794179
declare export default class NativeEventEmitter<
41804180
TEventToArgsMap: $ReadOnly<
4181-
Record<string, $ReadOnlyArray<UnsafeNativeEventObject>>,
4182-
> = $ReadOnly<Record<string, $ReadOnlyArray<UnsafeNativeEventObject>>>,
4181+
Record<string, $ReadOnlyArray<UnsafeObject>>,
4182+
> = $ReadOnly<Record<string, $ReadOnlyArray<UnsafeObject>>>,
41834183
> implements IEventEmitter<TEventToArgsMap>
41844184
{
41854185
constructor(nativeModule?: ?NativeModule): void;
@@ -4855,13 +4855,13 @@ export type LayoutAnimationProperties = $ReadOnly<{
48554855
}>;
48564856
type OnAnimationDidEndCallback = () => void;
48574857
type OnAnimationDidFailCallback = () => void;
4858-
declare function setLayoutAnimationEnabled(value: boolean): void;
4858+
declare function setEnabled(value: boolean): void;
48594859
declare function configureNext(
48604860
config: LayoutAnimationConfig,
48614861
onAnimationDidEnd?: OnAnimationDidEndCallback,
48624862
onAnimationDidFail?: OnAnimationDidFailCallback
48634863
): void;
4864-
declare function createLayoutAnimation(
4864+
declare function create(
48654865
duration: number,
48664866
type?: LayoutAnimationType,
48674867
property?: LayoutAnimationProperty
@@ -4873,15 +4873,15 @@ declare const Presets: {
48734873
};
48744874
declare const LayoutAnimation: {
48754875
configureNext: typeof configureNext,
4876-
create: typeof createLayoutAnimation,
4876+
create: typeof create,
48774877
Types: LayoutAnimationTypes,
48784878
Properties: LayoutAnimationProperties,
48794879
checkConfig(...args: Array<mixed>): void,
48804880
Presets: typeof Presets,
48814881
easeInEaseOut: (onAnimationDidEnd?: OnAnimationDidEndCallback) => void,
48824882
linear: (onAnimationDidEnd?: OnAnimationDidEndCallback) => void,
48834883
spring: (onAnimationDidEnd?: OnAnimationDidEndCallback) => void,
4884-
setEnabled: typeof setLayoutAnimationEnabled,
4884+
setEnabled: typeof setEnabled,
48854885
};
48864886
declare export default typeof LayoutAnimation;
48874887
"
@@ -6141,7 +6141,7 @@ type PermissionsType = $ReadOnly<{
61416141
}>;
61426142
export type PermissionStatus = \\"granted\\" | \\"denied\\" | \\"never_ask_again\\";
61436143
export type Permission = $Values<PermissionsType>;
6144-
declare class PermissionsAndroidImpl {
6144+
declare class PermissionsAndroid {
61456145
PERMISSIONS: PermissionsType;
61466146
RESULTS: $ReadOnly<{
61476147
DENIED: \\"denied\\",
@@ -6162,7 +6162,7 @@ declare class PermissionsAndroidImpl {
61626162
permissions: Array<Permission>
61636163
): Promise<{ [permission: Permission]: PermissionStatus, ... }>;
61646164
}
6165-
declare const PermissionsAndroidInstance: PermissionsAndroidImpl;
6165+
declare const PermissionsAndroidInstance: PermissionsAndroid;
61666166
declare export default typeof PermissionsAndroidInstance;
61676167
"
61686168
`;
@@ -6428,8 +6428,8 @@ declare export default typeof AppContainer;
64286428
`;
64296429

64306430
exports[`public API should not change unintentionally Libraries/ReactNative/AppRegistry.flow.js 1`] = `
6431-
"type HeadlessTask = (taskData: any) => Promise<void>;
6432-
export type TaskProvider = () => HeadlessTask;
6431+
"type Task = (taskData: any) => Promise<void>;
6432+
export type TaskProvider = () => Task;
64336433
export type ComponentProvider = () => React.ComponentType<any>;
64346434
export type ComponentProviderInstrumentationHook = (
64356435
component_: ComponentProvider,
@@ -8359,7 +8359,7 @@ declare export default typeof NativeDevLoadingView;
83598359

83608360
exports[`public API should not change unintentionally Libraries/Utilities/NativeDeviceInfo.js 1`] = `
83618361
"export * from \\"../../src/private/specs_DEPRECATED/modules/NativeDeviceInfo\\";
8362-
export { default } from \\"../../src/private/specs_DEPRECATED/modules/NativeDeviceInfo\\";
8362+
declare export default typeof NativeDeviceInfo;
83638363
"
83648364
`;
83658365

@@ -8955,12 +8955,12 @@ declare export default ErrorUtils;
89558955
`;
89568956

89578957
exports[`public API should not change unintentionally Libraries/vendor/emitter/EventEmitter.js 1`] = `
8958-
"type UnsafeEventObject = Object;
8958+
"type UnsafeObject = Object;
89598959
export interface EventSubscription {
89608960
remove(): void;
89618961
}
89628962
export interface IEventEmitter<
8963-
TEventToArgsMap: $ReadOnly<Record<string, $ReadOnlyArray<UnsafeEventObject>>>,
8963+
TEventToArgsMap: $ReadOnly<Record<string, $ReadOnlyArray<UnsafeObject>>>,
89648964
> {
89658965
addListener<TEvent: $Keys<TEventToArgsMap>>(
89668966
eventType: TEvent,
@@ -8976,8 +8976,8 @@ export interface IEventEmitter<
89768976
}
89778977
declare export default class EventEmitter<
89788978
TEventToArgsMap: $ReadOnly<
8979-
Record<string, $ReadOnlyArray<UnsafeEventObject>>,
8980-
> = $ReadOnly<Record<string, $ReadOnlyArray<UnsafeEventObject>>>,
8979+
Record<string, $ReadOnlyArray<UnsafeObject>>,
8980+
> = $ReadOnly<Record<string, $ReadOnlyArray<UnsafeObject>>>,
89818981
> implements IEventEmitter<TEventToArgsMap>
89828982
{
89838983
constructor(): void;

packages/react-native/Libraries/vendor/emitter/EventEmitter.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,14 @@
99
*/
1010

1111
// $FlowFixMe[unclear-type] unclear type of events
12-
type UnsafeEventObject = Object;
12+
type UnsafeObject = Object;
1313

1414
export interface EventSubscription {
1515
remove(): void;
1616
}
1717

1818
export interface IEventEmitter<
19-
TEventToArgsMap: $ReadOnly<Record<string, $ReadOnlyArray<UnsafeEventObject>>>,
19+
TEventToArgsMap: $ReadOnly<Record<string, $ReadOnlyArray<UnsafeObject>>>,
2020
> {
2121
addListener<TEvent: $Keys<TEventToArgsMap>>(
2222
eventType: TEvent,
@@ -41,7 +41,7 @@ interface Registration<TArgs> {
4141
}
4242

4343
type Registry<
44-
TEventToArgsMap: $ReadOnly<Record<string, $ReadOnlyArray<UnsafeEventObject>>>,
44+
TEventToArgsMap: $ReadOnly<Record<string, $ReadOnlyArray<UnsafeObject>>>,
4545
> = {
4646
[K in keyof TEventToArgsMap]: Set<Registration<TEventToArgsMap[K]>>,
4747
};
@@ -68,8 +68,8 @@ type Registry<
6868
*/
6969
export default class EventEmitter<
7070
TEventToArgsMap: $ReadOnly<
71-
Record<string, $ReadOnlyArray<UnsafeEventObject>>,
72-
> = $ReadOnly<Record<string, $ReadOnlyArray<UnsafeEventObject>>>,
71+
Record<string, $ReadOnlyArray<UnsafeObject>>,
72+
> = $ReadOnly<Record<string, $ReadOnlyArray<UnsafeObject>>>,
7373
> implements IEventEmitter<TEventToArgsMap>
7474
{
7575
#registry: Registry<TEventToArgsMap>;
@@ -157,7 +157,7 @@ export default class EventEmitter<
157157
}
158158

159159
function allocate<
160-
TEventToArgsMap: $ReadOnly<Record<string, $ReadOnlyArray<UnsafeEventObject>>>,
160+
TEventToArgsMap: $ReadOnly<Record<string, $ReadOnlyArray<UnsafeObject>>>,
161161
TEvent: $Keys<TEventToArgsMap>,
162162
TEventArgs: TEventToArgsMap[TEvent],
163163
>(

0 commit comments

Comments
 (0)