Skip to content

Commit

Permalink
fix: Fix name and get view
Browse files Browse the repository at this point in the history
  • Loading branch information
mrousavy committed Jan 15, 2025
1 parent 8de491c commit ed79295
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 6 deletions.
2 changes: 1 addition & 1 deletion packages/nitrogen/src/views/ViewComponentShadowNode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ namespace ${namespace} {
/**
* The name of the actual native View.
*/
extern const char ${nameVariable}[] = "${name.HybridT}";
extern const char ${nameVariable}[] = "${name.T}";
/**
* Props for the "${spec.name}" View.
Expand Down
5 changes: 3 additions & 2 deletions packages/nitrogen/src/views/swift/SwiftHybridViewManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,15 +72,16 @@ using namespace ${namespace}::views;
if (self = [super init]) {
std::shared_ptr<${HybridTSpec}> hybridView = ${getHybridObjectConstructorCall(spec.name)}
_hybridView = std::dynamic_pointer_cast<${HybridTSpecSwift}>(hybridView);
[self updateView];
}
return self;
}
- (UIView*) contentView {
- (void) updateView {
${swiftNamespace}::${HybridTSpecCxx} swiftPart = _hybridView->getSwiftPart();
void* viewUnsafe = swiftPart.getView();
UIView* view = (__bridge_transfer UIView*) viewUnsafe;
return view;
[self setContentView:view];
}
- (void) updateProps:(const react::Props::Shared&)props
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,15 +45,16 @@ - (instancetype) init {
if (self = [super init]) {
std::shared_ptr<HybridTestViewSpec> hybridView = NitroImage::NitroImageAutolinking::createTestView();
_hybridView = std::dynamic_pointer_cast<HybridTestViewSpecSwift>(hybridView);
[self updateView];
}
return self;
}

- (UIView*) contentView {
- (void) updateView {
NitroImage::HybridTestViewSpec_cxx swiftPart = _hybridView->getSwiftPart();
void* viewUnsafe = swiftPart.getView();
UIView* view = (__bridge_transfer UIView*) viewUnsafe;
return view;
[self setContentView:view];
}

- (void) updateProps:(const react::Props::Shared&)props
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ namespace margelo::nitro::image::views {
/**
* The name of the actual native View.
*/
extern const char HybridTestViewComponentName[] = "HybridTestView";
extern const char HybridTestViewComponentName[] = "TestView";

/**
* Props for the "TestView" View.
Expand Down

0 comments on commit ed79295

Please sign in to comment.