mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/40730 This way of injecting the decorator is safer and more convenient to have the proper types inferred by Flow in the injected function. Changelog: [internal] Reviewed By: NickGerleman Differential Revision: D50011840 fbshipit-source-id: 760812fc407d3e39fc7601d17488e3f2032a7065
27 lines
801 B
JavaScript
27 lines
801 B
JavaScript
/**
|
|
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
*
|
|
* This source code is licensed under the MIT license found in the
|
|
* LICENSE file in the root directory of this source tree.
|
|
*
|
|
* @format
|
|
* @flow strict-local
|
|
*/
|
|
|
|
import type {AbstractImageAndroid, AbstractImageIOS} from './ImageTypes.flow';
|
|
|
|
type ImageComponentDecorator = (AbstractImageAndroid => AbstractImageAndroid) &
|
|
(AbstractImageIOS => AbstractImageIOS);
|
|
|
|
let injectedImageComponentDecorator: ?ImageComponentDecorator;
|
|
|
|
export function unstable_setImageComponentDecorator(
|
|
imageComponentDecorator: ?ImageComponentDecorator,
|
|
): void {
|
|
injectedImageComponentDecorator = imageComponentDecorator;
|
|
}
|
|
|
|
export function unstable_getImageComponentDecorator(): ?ImageComponentDecorator {
|
|
return injectedImageComponentDecorator;
|
|
}
|