@office-iss/react-native-win32 0.0.0-canary.288 → 0.0.0-canary.289

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (59) hide show
  1. package/.flowconfig +3 -2
  2. package/CHANGELOG.json +22 -1
  3. package/CHANGELOG.md +16 -7
  4. package/Libraries/Alert/Alert.d.ts +4 -1
  5. package/Libraries/Alert/Alert.js +3 -0
  6. package/Libraries/Animated/Easing.js +13 -15
  7. package/Libraries/Animated/createAnimatedComponent.js +24 -12
  8. package/Libraries/Animated/nodes/AnimatedNode.js +2 -1
  9. package/Libraries/Animated/nodes/AnimatedProps.js +18 -1
  10. package/Libraries/Animated/nodes/AnimatedValue.js +6 -2
  11. package/Libraries/Blob/URL.js +23 -10
  12. package/Libraries/Components/TextInput/Tests/TextInputTest.d.ts +2 -1
  13. package/Libraries/Components/TextInput/Tests/TextInputTest.js.map +1 -1
  14. package/Libraries/Components/TextInput/TextInput.d.ts +6 -0
  15. package/Libraries/Components/TextInput/TextInput.flow.js +36 -3
  16. package/Libraries/Components/TextInput/TextInput.js +101 -110
  17. package/Libraries/Components/TextInput/TextInput.win32.js +102 -111
  18. package/Libraries/Components/Touchable/Tests/TouchableWin32Test.d.ts +2 -1
  19. package/Libraries/Components/Touchable/Tests/TouchableWin32Test.js.map +1 -1
  20. package/Libraries/Core/ReactNativeVersion.js +2 -2
  21. package/Libraries/Image/Tests/ImageWin32Test.d.ts +2 -1
  22. package/Libraries/Image/Tests/ImageWin32Test.js.map +1 -1
  23. package/Libraries/Interaction/TaskQueue.js +1 -0
  24. package/Libraries/Modal/Modal.js +30 -4
  25. package/Libraries/ReactNative/AppRegistry.flow.js +49 -0
  26. package/Libraries/ReactNative/AppRegistry.js +2 -322
  27. package/Libraries/ReactNative/AppRegistry.js.flow +23 -0
  28. package/Libraries/ReactNative/AppRegistryImpl.js +316 -0
  29. package/Libraries/ReactNative/ReactFabricPublicInstance/ReactFabricPublicInstance.js +1 -4
  30. package/Libraries/StyleSheet/PlatformColorValueTypesIOS.js +6 -0
  31. package/Libraries/StyleSheet/StyleSheet.js +5 -197
  32. package/Libraries/StyleSheet/StyleSheet.js.flow +166 -0
  33. package/Libraries/StyleSheet/{StyleSheet.win32.js → StyleSheetExports.js} +2 -151
  34. package/Libraries/StyleSheet/StyleSheetExports.js.flow +110 -0
  35. package/Libraries/StyleSheet/StyleSheetTypes.js +42 -18
  36. package/Libraries/Types/CodegenTypesNamespace.d.ts +45 -0
  37. package/Libraries/{Modal/ModalInjection.js → Types/CodegenTypesNamespace.js} +4 -5
  38. package/Libraries/Utilities/codegenNativeCommands.d.ts +18 -0
  39. package/Libraries/Utilities/codegenNativeComponent.d.ts +26 -0
  40. package/Libraries/vendor/emitter/EventEmitter.js +6 -2
  41. package/flow/global.js +1 -0
  42. package/flow/jest.js +4 -2
  43. package/index.js +47 -43
  44. package/index.win32.js +60 -55
  45. package/overrides.json +8 -16
  46. package/package.json +14 -14
  47. package/src/private/animated/NativeAnimatedHelper.js +18 -7
  48. package/src/private/animated/NativeAnimatedHelper.win32.js +18 -7
  49. package/src/private/animated/createAnimatedPropsHook.js +34 -15
  50. package/src/private/featureflags/ReactNativeFeatureFlags.js +14 -31
  51. package/src/private/featureflags/ReactNativeFeatureFlagsBase.js +9 -1
  52. package/src/private/featureflags/specs/NativeReactNativeFeatureFlags.js +2 -3
  53. package/src/private/webapis/dom/nodes/ReadOnlyNode.js +5 -18
  54. package/src/private/webapis/dom/nodes/internals/NodeInternals.js +6 -0
  55. package/src/types/third_party/event-target-shim.d.ts +392 -0
  56. package/src-win/Libraries/Components/TextInput/Tests/TextInputTest.tsx +7 -7
  57. package/src-win/Libraries/Components/Touchable/Tests/TouchableWin32Test.tsx +3 -3
  58. package/src-win/Libraries/Image/Tests/ImageWin32Test.tsx +1 -1
  59. package/types/index.d.ts +4 -0
@@ -0,0 +1,316 @@
1
+ /**
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ *
7
+ * @flow
8
+ * @format
9
+ */
10
+
11
+ import type {RootTag} from '../Types/RootTagTypes';
12
+ import type {
13
+ AppConfig,
14
+ AppParameters,
15
+ ComponentProvider,
16
+ ComponentProviderInstrumentationHook,
17
+ Registry,
18
+ RootViewStyleProvider,
19
+ Runnable,
20
+ Runnables,
21
+ TaskProvider,
22
+ WrapperComponentProvider,
23
+ } from './AppRegistry.flow';
24
+
25
+ import BugReporting from '../BugReporting/BugReporting';
26
+ import createPerformanceLogger from '../Utilities/createPerformanceLogger';
27
+ import infoLog from '../Utilities/infoLog';
28
+ import SceneTracker from '../Utilities/SceneTracker';
29
+ import {coerceDisplayMode} from './DisplayMode';
30
+ import HeadlessJsTaskError from './HeadlessJsTaskError';
31
+ import NativeHeadlessJsTaskSupport from './NativeHeadlessJsTaskSupport';
32
+ import renderApplication from './renderApplication';
33
+ import {unmountComponentAtNodeAndRemoveContainer} from './RendererProxy';
34
+ import invariant from 'invariant';
35
+
36
+ type TaskCanceller = () => void;
37
+ type TaskCancelProvider = () => TaskCanceller;
38
+
39
+ const runnables: Runnables = {};
40
+ let runCount = 1;
41
+ const sections: Runnables = {};
42
+ const taskProviders: Map<string, TaskProvider> = new Map();
43
+ const taskCancelProviders: Map<string, TaskCancelProvider> = new Map();
44
+ let componentProviderInstrumentationHook: ComponentProviderInstrumentationHook =
45
+ (component: ComponentProvider) => component();
46
+
47
+ let wrapperComponentProvider: ?WrapperComponentProvider;
48
+ let rootViewStyleProvider: ?RootViewStyleProvider;
49
+
50
+ export function setWrapperComponentProvider(
51
+ provider: WrapperComponentProvider,
52
+ ) {
53
+ wrapperComponentProvider = provider;
54
+ }
55
+
56
+ export function setRootViewStyleProvider(provider: RootViewStyleProvider) {
57
+ rootViewStyleProvider = provider;
58
+ }
59
+
60
+ export function registerConfig(config: Array<AppConfig>): void {
61
+ config.forEach(appConfig => {
62
+ if (appConfig.run) {
63
+ registerRunnable(appConfig.appKey, appConfig.run);
64
+ } else {
65
+ invariant(
66
+ appConfig.component != null,
67
+ 'AppRegistry.registerConfig(...): Every config is expected to set ' +
68
+ 'either `run` or `component`, but `%s` has neither.',
69
+ appConfig.appKey,
70
+ );
71
+ registerComponent(
72
+ appConfig.appKey,
73
+ appConfig.component,
74
+ appConfig.section,
75
+ );
76
+ }
77
+ });
78
+ }
79
+
80
+ /**
81
+ * Registers an app's root component.
82
+ *
83
+ * See https://reactnative.dev/docs/appregistry#registercomponent
84
+ */
85
+ export function registerComponent(
86
+ appKey: string,
87
+ componentProvider: ComponentProvider,
88
+ section?: boolean,
89
+ ): string {
90
+ const scopedPerformanceLogger = createPerformanceLogger();
91
+ runnables[appKey] = (appParameters, displayMode) => {
92
+ renderApplication(
93
+ componentProviderInstrumentationHook(
94
+ componentProvider,
95
+ scopedPerformanceLogger,
96
+ ),
97
+ appParameters.initialProps,
98
+ appParameters.rootTag,
99
+ wrapperComponentProvider && wrapperComponentProvider(appParameters),
100
+ rootViewStyleProvider && rootViewStyleProvider(appParameters),
101
+ appParameters.fabric,
102
+ scopedPerformanceLogger,
103
+ appKey === 'LogBox', // is logbox
104
+ appKey,
105
+ displayMode,
106
+ );
107
+ };
108
+ if (section) {
109
+ sections[appKey] = runnables[appKey];
110
+ }
111
+ return appKey;
112
+ }
113
+
114
+ export function registerRunnable(appKey: string, run: Runnable): string {
115
+ runnables[appKey] = run;
116
+ return appKey;
117
+ }
118
+
119
+ export function registerSection(
120
+ appKey: string,
121
+ component: ComponentProvider,
122
+ ): void {
123
+ registerComponent(appKey, component, true);
124
+ }
125
+
126
+ export function getAppKeys(): $ReadOnlyArray<string> {
127
+ return Object.keys(runnables);
128
+ }
129
+
130
+ export function getSectionKeys(): $ReadOnlyArray<string> {
131
+ return Object.keys(sections);
132
+ }
133
+
134
+ export function getSections(): Runnables {
135
+ return {
136
+ ...sections,
137
+ };
138
+ }
139
+
140
+ export function getRunnable(appKey: string): ?Runnable {
141
+ return runnables[appKey];
142
+ }
143
+
144
+ export function getRegistry(): Registry {
145
+ return {
146
+ sections: getSectionKeys(),
147
+ runnables: {...runnables},
148
+ };
149
+ }
150
+
151
+ export function setComponentProviderInstrumentationHook(
152
+ hook: ComponentProviderInstrumentationHook,
153
+ ) {
154
+ componentProviderInstrumentationHook = hook;
155
+ }
156
+
157
+ /**
158
+ * Loads the JavaScript bundle and runs the app.
159
+ *
160
+ * See https://reactnative.dev/docs/appregistry#runapplication
161
+ */
162
+ export function runApplication(
163
+ appKey: string,
164
+ appParameters: AppParameters,
165
+ displayMode?: number,
166
+ ): void {
167
+ if (appKey !== 'LogBox') {
168
+ const logParams = __DEV__ ? ` with ${JSON.stringify(appParameters)}` : '';
169
+ const msg = `Running "${appKey}"${logParams}`;
170
+ infoLog(msg);
171
+ BugReporting.addSource(
172
+ 'AppRegistry.runApplication' + runCount++,
173
+ () => msg,
174
+ );
175
+ }
176
+ invariant(
177
+ runnables[appKey],
178
+ `"${appKey}" has not been registered. This can happen if:\n` +
179
+ '* Metro (the local dev server) is run from the wrong folder. ' +
180
+ 'Check if Metro is running, stop it and restart it in the current project.\n' +
181
+ "* A module failed to load due to an error and `AppRegistry.registerComponent` wasn't called.",
182
+ );
183
+
184
+ SceneTracker.setActiveScene({name: appKey});
185
+ runnables[appKey](appParameters, coerceDisplayMode(displayMode));
186
+ }
187
+
188
+ /**
189
+ * Update initial props for a surface that's already rendered
190
+ */
191
+ export function setSurfaceProps(
192
+ appKey: string,
193
+ appParameters: Object,
194
+ displayMode?: number,
195
+ ): void {
196
+ if (appKey !== 'LogBox') {
197
+ const msg =
198
+ 'Updating props for Surface "' +
199
+ appKey +
200
+ '" with ' +
201
+ JSON.stringify(appParameters);
202
+ infoLog(msg);
203
+ BugReporting.addSource(
204
+ 'AppRegistry.setSurfaceProps' + runCount++,
205
+ () => msg,
206
+ );
207
+ }
208
+ invariant(
209
+ runnables[appKey],
210
+ `"${appKey}" has not been registered. This can happen if:\n` +
211
+ '* Metro (the local dev server) is run from the wrong folder. ' +
212
+ 'Check if Metro is running, stop it and restart it in the current project.\n' +
213
+ "* A module failed to load due to an error and `AppRegistry.registerComponent` wasn't called.",
214
+ );
215
+
216
+ runnables[appKey](appParameters, coerceDisplayMode(displayMode));
217
+ }
218
+
219
+ /**
220
+ * Stops an application when a view should be destroyed.
221
+ *
222
+ * See https://reactnative.dev/docs/appregistry#unmountapplicationcomponentatroottag
223
+ */
224
+ export function unmountApplicationComponentAtRootTag(rootTag: RootTag): void {
225
+ unmountComponentAtNodeAndRemoveContainer(rootTag);
226
+ }
227
+
228
+ /**
229
+ * Register a headless task. A headless task is a bit of code that runs without a UI.
230
+ *
231
+ * See https://reactnative.dev/docs/appregistry#registerheadlesstask
232
+ */
233
+ export function registerHeadlessTask(
234
+ taskKey: string,
235
+ taskProvider: TaskProvider,
236
+ ): void {
237
+ // $FlowFixMe[object-this-reference]
238
+ registerCancellableHeadlessTask(taskKey, taskProvider, () => () => {
239
+ /* Cancel is no-op */
240
+ });
241
+ }
242
+
243
+ /**
244
+ * Register a cancellable headless task. A headless task is a bit of code that runs without a UI.
245
+ *
246
+ * See https://reactnative.dev/docs/appregistry#registercancellableheadlesstask
247
+ */
248
+ export function registerCancellableHeadlessTask(
249
+ taskKey: string,
250
+ taskProvider: TaskProvider,
251
+ taskCancelProvider: TaskCancelProvider,
252
+ ): void {
253
+ if (taskProviders.has(taskKey)) {
254
+ console.warn(
255
+ `registerHeadlessTask or registerCancellableHeadlessTask called multiple times for same key '${taskKey}'`,
256
+ );
257
+ }
258
+ taskProviders.set(taskKey, taskProvider);
259
+ taskCancelProviders.set(taskKey, taskCancelProvider);
260
+ }
261
+
262
+ /**
263
+ * Only called from native code. Starts a headless task.
264
+ *
265
+ * See https://reactnative.dev/docs/appregistry#startheadlesstask
266
+ */
267
+ export function startHeadlessTask(
268
+ taskId: number,
269
+ taskKey: string,
270
+ data: any,
271
+ ): void {
272
+ const taskProvider = taskProviders.get(taskKey);
273
+ if (!taskProvider) {
274
+ console.warn(`No task registered for key ${taskKey}`);
275
+ if (NativeHeadlessJsTaskSupport) {
276
+ NativeHeadlessJsTaskSupport.notifyTaskFinished(taskId);
277
+ }
278
+ return;
279
+ }
280
+ taskProvider()(data)
281
+ .then(() => {
282
+ if (NativeHeadlessJsTaskSupport) {
283
+ NativeHeadlessJsTaskSupport.notifyTaskFinished(taskId);
284
+ }
285
+ })
286
+ .catch(reason => {
287
+ console.error(reason);
288
+
289
+ if (
290
+ NativeHeadlessJsTaskSupport &&
291
+ reason instanceof HeadlessJsTaskError
292
+ ) {
293
+ // $FlowFixMe[unused-promise]
294
+ NativeHeadlessJsTaskSupport.notifyTaskRetry(taskId).then(
295
+ retryPosted => {
296
+ if (!retryPosted) {
297
+ NativeHeadlessJsTaskSupport.notifyTaskFinished(taskId);
298
+ }
299
+ },
300
+ );
301
+ }
302
+ });
303
+ }
304
+
305
+ /**
306
+ * Only called from native code. Cancels a headless task.
307
+ *
308
+ * See https://reactnative.dev/docs/appregistry#cancelheadlesstask
309
+ */
310
+ export function cancelHeadlessTask(taskId: number, taskKey: string): void {
311
+ const taskCancelProvider = taskCancelProviders.get(taskKey);
312
+ if (!taskCancelProvider) {
313
+ throw new Error(`No task canceller registered for key '${taskKey}'`);
314
+ }
315
+ taskCancelProvider()();
316
+ }
@@ -71,10 +71,7 @@ function getReadOnlyTextClass(): Class<ReadOnlyTextT> {
71
71
  }
72
72
 
73
73
  export function createPublicRootInstance(rootTag: RootTag): PublicRootInstance {
74
- if (
75
- ReactNativeFeatureFlags.enableAccessToHostTreeInFabric() &&
76
- ReactNativeFeatureFlags.enableDOMDocumentAPI()
77
- ) {
74
+ if (ReactNativeFeatureFlags.enableAccessToHostTreeInFabric()) {
78
75
  const ReactNativeDocumentModule = getReactNativeDocumentModule();
79
76
 
80
77
  // $FlowExpectedError[incompatible-return]
@@ -17,6 +17,12 @@ export type DynamicColorIOSTuple = {
17
17
  highContrastDark?: ColorValue,
18
18
  };
19
19
 
20
+ /**
21
+ * Specify color to display depending on the current system appearance settings
22
+ *
23
+ * @param tuple Colors you want to use for "light mode" and "dark mode"
24
+ * @platform ios
25
+ */
20
26
  export const DynamicColorIOS = (tuple: DynamicColorIOSTuple): ColorValue => {
21
27
  throw new Error('DynamicColorIOS is not available on this platform.');
22
28
  };
@@ -10,25 +10,21 @@
10
10
 
11
11
  'use strict';
12
12
 
13
+ import typeof * as StyleSheetExports from './StyleSheetExports';
13
14
  import type {
14
15
  ____ColorValue_Internal,
15
16
  ____DangerouslyImpreciseStyle_Internal,
16
17
  ____DangerouslyImpreciseStyleProp_Internal,
17
18
  ____ImageStyle_Internal,
18
19
  ____ImageStyleProp_Internal,
19
- ____Styles_Internal,
20
20
  ____TextStyle_Internal,
21
21
  ____TextStyleProp_Internal,
22
22
  ____ViewStyle_Internal,
23
23
  ____ViewStyleProp_Internal,
24
24
  } from './StyleSheetTypes';
25
-
26
- import composeStyles from '../../src/private/styles/composeStyles';
27
- import flatten from './flattenStyle';
28
-
29
- const ReactNativeStyleAttributes =
30
- require('../Components/View/ReactNativeStyleAttributes').default;
31
- const PixelRatio = require('../Utilities/PixelRatio').default;
25
+ const StyleSheet: StyleSheetExports = (
26
+ require('./StyleSheetExports') as $FlowFixMe
27
+ ).default;
32
28
 
33
29
  export type {NativeColorValue} from './StyleSheetTypes';
34
30
 
@@ -166,192 +162,4 @@ export type ImageStyle = ____ImageStyle_Internal;
166
162
  */
167
163
  export type DangerouslyImpreciseStyle = ____DangerouslyImpreciseStyle_Internal;
168
164
 
169
- let hairlineWidth: number = PixelRatio.roundToNearestPixel(0.4);
170
- if (hairlineWidth === 0) {
171
- hairlineWidth = 1 / PixelRatio.get();
172
- }
173
-
174
- const absoluteFill: {
175
- +bottom: 0,
176
- +left: 0,
177
- +position: 'absolute',
178
- +right: 0,
179
- +top: 0,
180
- } = {
181
- position: 'absolute',
182
- left: 0,
183
- right: 0,
184
- top: 0,
185
- bottom: 0,
186
- };
187
- if (__DEV__) {
188
- Object.freeze(absoluteFill);
189
- }
190
-
191
- /**
192
- * A StyleSheet is an abstraction similar to CSS StyleSheets
193
- *
194
- * Create a new StyleSheet:
195
- *
196
- * ```
197
- * const styles = StyleSheet.create({
198
- * container: {
199
- * borderRadius: 4,
200
- * borderWidth: 0.5,
201
- * borderColor: '#d6d7da',
202
- * },
203
- * title: {
204
- * fontSize: 19,
205
- * fontWeight: 'bold',
206
- * },
207
- * activeTitle: {
208
- * color: 'red',
209
- * },
210
- * });
211
- * ```
212
- *
213
- * Use a StyleSheet:
214
- *
215
- * ```
216
- * <View style={styles.container}>
217
- * <Text style={[styles.title, this.props.isActive && styles.activeTitle]} />
218
- * </View>
219
- * ```
220
- *
221
- * Code quality:
222
- *
223
- * - By moving styles away from the render function, you're making the code
224
- * easier to understand.
225
- * - Naming the styles is a good way to add meaning to the low level components
226
- * in the render function, and encourage reuse.
227
- * - In most IDEs, using `StyleSheet.create()` will offer static type checking
228
- * and suggestions to help you write valid styles.
229
- *
230
- */
231
- export default {
232
- /**
233
- * This is defined as the width of a thin line on the platform. It can be
234
- * used as the thickness of a border or division between two elements.
235
- * Example:
236
- * ```
237
- * {
238
- * borderBottomColor: '#bbb',
239
- * borderBottomWidth: StyleSheet.hairlineWidth
240
- * }
241
- * ```
242
- *
243
- * This constant will always be a round number of pixels (so a line defined
244
- * by it look crisp) and will try to match the standard width of a thin line
245
- * on the underlying platform. However, you should not rely on it being a
246
- * constant size, because on different platforms and screen densities its
247
- * value may be calculated differently.
248
- *
249
- * A line with hairline width may not be visible if your simulator is downscaled.
250
- */
251
- hairlineWidth,
252
-
253
- /**
254
- * A very common pattern is to create overlays with position absolute and zero positioning,
255
- * so `absoluteFill` can be used for convenience and to reduce duplication of these repeated
256
- * styles.
257
- */
258
- absoluteFill: (absoluteFill: any), // TODO: This should be updated after we fix downstream Flow sites.
259
-
260
- /**
261
- * Sometimes you may want `absoluteFill` but with a couple tweaks - `absoluteFillObject` can be
262
- * used to create a customized entry in a `StyleSheet`, e.g.:
263
- *
264
- * const styles = StyleSheet.create({
265
- * wrapper: {
266
- * ...StyleSheet.absoluteFillObject,
267
- * top: 10,
268
- * backgroundColor: 'transparent',
269
- * },
270
- * });
271
- */
272
- absoluteFillObject: absoluteFill,
273
-
274
- /**
275
- * Combines two styles such that `style2` will override any styles in `style1`.
276
- * If either style is falsy, the other one is returned without allocating an
277
- * array, saving allocations and maintaining reference equality for
278
- * PureComponent checks.
279
- */
280
- compose: composeStyles,
281
-
282
- /**
283
- * Flattens an array of style objects, into one aggregated style object.
284
- *
285
- * Example:
286
- * ```
287
- * const styles = StyleSheet.create({
288
- * listItem: {
289
- * flex: 1,
290
- * fontSize: 16,
291
- * color: 'white'
292
- * },
293
- * selectedListItem: {
294
- * color: 'green'
295
- * }
296
- * });
297
- *
298
- * StyleSheet.flatten([styles.listItem, styles.selectedListItem])
299
- * // returns { flex: 1, fontSize: 16, color: 'green' }
300
- * ```
301
- */
302
- flatten,
303
-
304
- /**
305
- * WARNING: EXPERIMENTAL. Breaking changes will probably happen a lot and will
306
- * not be reliably announced. The whole thing might be deleted, who knows? Use
307
- * at your own risk.
308
- *
309
- * Sets a function to use to pre-process a style property value. This is used
310
- * internally to process color and transform values. You should not use this
311
- * unless you really know what you are doing and have exhausted other options.
312
- */
313
- setStyleAttributePreprocessor(
314
- property: string,
315
- process: (nextProp: mixed) => mixed,
316
- ) {
317
- let value;
318
-
319
- if (ReactNativeStyleAttributes[property] === true) {
320
- value = {process};
321
- } else if (typeof ReactNativeStyleAttributes[property] === 'object') {
322
- value = {...ReactNativeStyleAttributes[property], process};
323
- } else {
324
- console.error(`${property} is not a valid style attribute`);
325
- return;
326
- }
327
-
328
- if (
329
- __DEV__ &&
330
- typeof value.process === 'function' &&
331
- typeof ReactNativeStyleAttributes[property]?.process === 'function' &&
332
- value.process !== ReactNativeStyleAttributes[property]?.process
333
- ) {
334
- console.warn(`Overwriting ${property} style attribute preprocessor`);
335
- }
336
-
337
- ReactNativeStyleAttributes[property] = value;
338
- },
339
-
340
- /**
341
- * An identity function for creating style sheets.
342
- */
343
- // $FlowFixMe[unsupported-variance-annotation]
344
- create<+S: ____Styles_Internal>(obj: S): $ReadOnly<S> {
345
- // TODO: This should return S as the return type. But first,
346
- // we need to codemod all the callsites that are typing this
347
- // return value as a number (even though it was opaque).
348
- if (__DEV__) {
349
- for (const key in obj) {
350
- if (obj[key]) {
351
- Object.freeze(obj[key]);
352
- }
353
- }
354
- }
355
- return obj;
356
- },
357
- };
165
+ export default StyleSheet;