@react-native-ohos/react-native-unistyles
Version:
Level up your React Native StyleSheet
28 lines (24 loc) • 1.01 kB
text/typescript
/*
* Copyright (c) 2025 Huawei Device Co., Ltd. All rights reserved
* Use of this source code is governed by a MIT license that can be
* found in the LICENSE file.
*/
import { RNPackage, TurboModulesFactory, DescriptorWrapperFactoryByDescriptorType, DescriptorWrapperFactoryByDescriptorTypeCtx } from '@rnoh/react-native-openharmony/ts';
import type { TurboModule, TurboModuleContext } from '@rnoh/react-native-openharmony/ts';
import { RNUnistylesTurboModule } from './RNUnistylesTurboModule';
class RNUnistylesTurboModuleFactory extends TurboModulesFactory {
createTurboModule(name: string): TurboModule | null {
if (this.hasTurboModule(name)) {
return new RNUnistylesTurboModule(this.ctx);
}
return null;
}
hasTurboModule(name: string): boolean {
return name === "Unistyles";
}
}
export class RNUnistylesPackage extends RNPackage {
createTurboModulesFactory(ctx: TurboModuleContext): TurboModulesFactory {
return new RNUnistylesTurboModuleFactory(ctx);
}
}