Skip to content

Commit

Permalink
fix: Fix namespace
Browse files Browse the repository at this point in the history
  • Loading branch information
mrousavy committed Jan 15, 2025
1 parent 661199d commit cf1b8db
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 39 deletions.
41 changes: 21 additions & 20 deletions packages/nitrogen/src/views/swift/SwiftHybridViewManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,42 +12,43 @@ export function createSwiftHybridViewManager(
): SourceFile[] {
const cppFiles = createViewComponentShadowNodeFiles(spec)
const namespace = NitroConfig.getCxxNamespace('c++', 'views')
const { component, descriptorClassName } = getViewComponentNames(spec)
const { component, descriptorClassName, propsClassName } =
getViewComponentNames(spec)

const mmFile = `
${createFileMetadataString(`${component}.mm`)}
#if REACT_NATIVE_VERSION >= 78
#import "${component}.hpp"
#import <react/renderer/componentregistry/ComponentDescriptorProvider.h>
#import <React/RCTViewComponentView.h>
#import <React/RCTComponentViewFactory.h>
#import <React/UIView+ComponentViewProtocol.h>
#import <UIKit/UIKit.h>
namespace ${namespace} {
using namespace facebook;
@interface ${component}: RCTViewComponentView
@end
@interface ${component}: RCTViewComponentView
@end
@implementation ${component}
+ (void) load {
[super load];
// TODO: Register it!
}
+ (ComponentDescriptorProvider)componentDescriptorProvider {
return concreteComponentDescriptorProvider<${descriptorClassName}>();
}
@implementation ${component}
+ (void) load {
[super load];
// TODO: Register it!
}
- (void)updateProps:(const facebook::react::Props::Shared&)props
oldProps:(const facebook::react::Props::Shared&)oldProps {
// TODO: const auto& newViewProps = *std::static_pointer_cast<CustomViewProps const>(props);
+ (react::ComponentDescriptorProvider)componentDescriptorProvider {
return react::concreteComponentDescriptorProvider<${namespace}::${descriptorClassName}>();
}
[super updateProps:props oldProps:oldProps];
}
@end
- (void)updateProps:(const facebook::react::Props::Shared&)props
oldProps:(const facebook::react::Props::Shared&)oldProps {
// TODO: const auto& newViewProps = *std::static_pointer_cast<${namespace}::${propsClassName} const>(props);
} // namespace ${namespace}
[super updateProps:props oldProps:oldProps];
}
@end
#endif
`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,33 +8,33 @@
#if REACT_NATIVE_VERSION >= 78

#import "TestViewComponent.hpp"
#import <react/renderer/componentregistry/ComponentDescriptorProvider.h>
#import <React/RCTViewComponentView.h>
#import <React/RCTComponentViewFactory.h>
#import <React/UIView+ComponentViewProtocol.h>
#import <UIKit/UIKit.h>

namespace margelo::nitro::image::views {
using namespace facebook;

@interface TestViewComponent: RCTViewComponentView
@end
@interface TestViewComponent: RCTViewComponentView
@end

@implementation TestViewComponent
+ (void) load {
[super load];
// TODO: Register it!
}
@implementation TestViewComponent
+ (void) load {
[super load];
// TODO: Register it!
}

+ (ComponentDescriptorProvider)componentDescriptorProvider {
return concreteComponentDescriptorProvider<HybridTestViewComponentDescriptor>();
}
+ (react::ComponentDescriptorProvider)componentDescriptorProvider {
return react::concreteComponentDescriptorProvider<margelo::nitro::image::views::HybridTestViewComponentDescriptor>();
}

- (void)updateProps:(const facebook::react::Props::Shared&)props
oldProps:(const facebook::react::Props::Shared&)oldProps {
// TODO: const auto& newViewProps = *std::static_pointer_cast<CustomViewProps const>(props);
- (void)updateProps:(const facebook::react::Props::Shared&)props
oldProps:(const facebook::react::Props::Shared&)oldProps {
// TODO: const auto& newViewProps = *std::static_pointer_cast<margelo::nitro::image::views::HybridTestViewProps const>(props);

[super updateProps:props oldProps:oldProps];
}
@end

} // namespace margelo::nitro::image::views
[super updateProps:props oldProps:oldProps];
}
@end

#endif
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
#ifndef NitroDefines_h
#define NitroDefines_h

#undef REACT_NATIVE_VERSION
#define REACT_NATIVE_VERSION 78

// Sets the version of the native Nitro core library
#define NITRO_VERSION "0.21.0"

Expand Down

0 comments on commit cf1b8db

Please sign in to comment.