react-native-list 1.0.1 → 2.0.0-alpha.1
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.
- package/README.md +188 -32
- package/ReactNativeList.podspec +39 -0
- package/android/CMakeLists.txt +48 -0
- package/android/build.gradle +151 -0
- package/android/fix-prefab.gradle +51 -0
- package/android/gradle.properties +5 -0
- package/android/src/main/AndroidManifest.xml +2 -0
- package/android/src/main/cpp/JHybridUiListModule.cpp +192 -0
- package/android/src/main/cpp/JHybridUiListModule.h +50 -0
- package/android/src/main/cpp/cpp-adapter.cpp +12 -0
- package/android/src/main/java/com/hannojg/reactnativelist/ReactNativeListPackage.kt +27 -0
- package/android/src/main/java/com/margelo/nitro/reactnativelist/HybridNativeListDataSource.kt +146 -0
- package/android/src/main/java/com/margelo/nitro/reactnativelist/HybridNativeListLayout.kt +86 -0
- package/android/src/main/java/com/margelo/nitro/reactnativelist/HybridUiListModule.kt +116 -0
- package/android/src/main/java/com/margelo/nitro/reactnativelist/HybridUiListView.kt +410 -0
- package/android/src/main/java/com/margelo/nitro/reactnativelist/HybridViewHolder.kt +9 -0
- package/android/src/main/java/com/margelo/nitro/reactnativelist/NativeListAdapter.kt +217 -0
- package/ios/DataSource/HybridNativeListDataSource.swift +213 -0
- package/ios/HybridObjects/HybridUiListModule.swift +49 -0
- package/ios/HybridObjects/HybridViewHolder.swift +16 -0
- package/ios/Layout/HybridNativeListLayout.swift +128 -0
- package/ios/Utils/ErrorUtils.h +26 -0
- package/ios/Utils/HybridIOSWorkletsModuleProxyHolder.swift +10 -0
- package/ios/Utils/SurfaceHelper.h +20 -0
- package/ios/Utils/SurfaceHelper.mm +144 -0
- package/ios/Utils/SurfacePresenterRegistry.h +17 -0
- package/ios/Utils/SurfacePresenterRegistry.m +31 -0
- package/ios/Utils/TurboModuleInstaller.h +18 -0
- package/ios/Utils/TurboModuleInstaller.mm +267 -0
- package/ios/Views/HostCell.swift +216 -0
- package/ios/Views/HybridUiListView.swift +695 -0
- package/metro/RendererProxyThreadSwitch.js +66 -0
- package/metro-config.d.ts +1 -0
- package/metro-config.js +52 -0
- package/nitro.json +47 -0
- package/nitrogen/generated/.gitattributes +1 -0
- package/nitrogen/generated/android/ReactNativeList+autolinking.cmake +99 -0
- package/nitrogen/generated/android/ReactNativeList+autolinking.gradle +27 -0
- package/nitrogen/generated/android/ReactNativeListOnLoad.cpp +156 -0
- package/nitrogen/generated/android/ReactNativeListOnLoad.hpp +34 -0
- package/nitrogen/generated/android/c++/JFunc_bool_NativeListItem_NativeListItem.hpp +83 -0
- package/nitrogen/generated/android/c++/JFunc_bool_double_NativeListItem_double.hpp +83 -0
- package/nitrogen/generated/android/c++/JFunc_double_std__string.hpp +78 -0
- package/nitrogen/generated/android/c++/JHybridIOSWorkletsModuleProxyHolderSpec.cpp +49 -0
- package/nitrogen/generated/android/c++/JHybridIOSWorkletsModuleProxyHolderSpec.hpp +63 -0
- package/nitrogen/generated/android/c++/JHybridNativeLinearListLayoutSpec.cpp +63 -0
- package/nitrogen/generated/android/c++/JHybridNativeLinearListLayoutSpec.hpp +65 -0
- package/nitrogen/generated/android/c++/JHybridNativeListDataSourceSpec.cpp +101 -0
- package/nitrogen/generated/android/c++/JHybridNativeListDataSourceSpec.hpp +70 -0
- package/nitrogen/generated/android/c++/JHybridNativeListLayoutSpec.cpp +49 -0
- package/nitrogen/generated/android/c++/JHybridNativeListLayoutSpec.hpp +63 -0
- package/nitrogen/generated/android/c++/JHybridUiListModuleSpec.cpp +65 -0
- package/nitrogen/generated/android/c++/JHybridUiListModuleSpec.hpp +64 -0
- package/nitrogen/generated/android/c++/JHybridUiListViewSpec.cpp +92 -0
- package/nitrogen/generated/android/c++/JHybridUiListViewSpec.hpp +67 -0
- package/nitrogen/generated/android/c++/JHybridViewHolderSpec.cpp +49 -0
- package/nitrogen/generated/android/c++/JHybridViewHolderSpec.hpp +63 -0
- package/nitrogen/generated/android/c++/JNativeItemSizeEstimate.hpp +61 -0
- package/nitrogen/generated/android/c++/JNativeLinearListLayoutConfig.hpp +81 -0
- package/nitrogen/generated/android/c++/JNativeLinearListLayoutIOSConfig.hpp +59 -0
- package/nitrogen/generated/android/c++/JNativeListItem.hpp +76 -0
- package/nitrogen/generated/android/c++/JVariant_NullType_HybridIOSWorkletsModuleProxyHolderSpec.cpp +26 -0
- package/nitrogen/generated/android/c++/JVariant_NullType_HybridIOSWorkletsModuleProxyHolderSpec.hpp +72 -0
- package/nitrogen/generated/android/c++/views/JHybridUiListViewStateUpdater.cpp +53 -0
- package/nitrogen/generated/android/c++/views/JHybridUiListViewStateUpdater.hpp +49 -0
- package/nitrogen/generated/android/c++/views/JHybridViewHolderStateUpdater.cpp +53 -0
- package/nitrogen/generated/android/c++/views/JHybridViewHolderStateUpdater.hpp +49 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/reactnativelist/Func_bool_NativeListItem_NativeListItem.kt +80 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/reactnativelist/Func_bool_double_NativeListItem_double.kt +80 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/reactnativelist/Func_double_std__string.kt +80 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/reactnativelist/HybridIOSWorkletsModuleProxyHolderSpec.kt +52 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/reactnativelist/HybridNativeLinearListLayoutSpec.kt +54 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/reactnativelist/HybridNativeListDataSourceSpec.kt +87 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/reactnativelist/HybridNativeListLayoutSpec.kt +52 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/reactnativelist/HybridUiListModuleSpec.kt +59 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/reactnativelist/HybridUiListViewSpec.kt +76 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/reactnativelist/HybridViewHolderSpec.kt +53 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/reactnativelist/NativeItemSizeEstimate.kt +56 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/reactnativelist/NativeLinearListLayoutConfig.kt +76 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/reactnativelist/NativeLinearListLayoutIOSConfig.kt +51 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/reactnativelist/NativeListItem.kt +71 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/reactnativelist/ReactNativeListOnLoad.kt +35 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/reactnativelist/Variant_NullType_HybridIOSWorkletsModuleProxyHolderSpec.kt +62 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/reactnativelist/views/HybridUiListViewManager.kt +80 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/reactnativelist/views/HybridUiListViewStateUpdater.kt +23 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/reactnativelist/views/HybridViewHolderManager.kt +80 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/reactnativelist/views/HybridViewHolderStateUpdater.kt +23 -0
- package/nitrogen/generated/ios/ReactNativeList+autolinking.rb +62 -0
- package/nitrogen/generated/ios/ReactNativeList-Swift-Cxx-Bridge.cpp +162 -0
- package/nitrogen/generated/ios/ReactNativeList-Swift-Cxx-Bridge.hpp +368 -0
- package/nitrogen/generated/ios/ReactNativeList-Swift-Cxx-Umbrella.hpp +92 -0
- package/nitrogen/generated/ios/ReactNativeListAutolinking.mm +83 -0
- package/nitrogen/generated/ios/ReactNativeListAutolinking.swift +86 -0
- package/nitrogen/generated/ios/c++/HybridIOSWorkletsModuleProxyHolderSpecSwift.cpp +11 -0
- package/nitrogen/generated/ios/c++/HybridIOSWorkletsModuleProxyHolderSpecSwift.hpp +75 -0
- package/nitrogen/generated/ios/c++/HybridNativeLinearListLayoutSpecSwift.cpp +11 -0
- package/nitrogen/generated/ios/c++/HybridNativeLinearListLayoutSpecSwift.hpp +92 -0
- package/nitrogen/generated/ios/c++/HybridNativeListDataSourceSpecSwift.cpp +11 -0
- package/nitrogen/generated/ios/c++/HybridNativeListDataSourceSpecSwift.hpp +132 -0
- package/nitrogen/generated/ios/c++/HybridNativeListLayoutSpecSwift.cpp +11 -0
- package/nitrogen/generated/ios/c++/HybridNativeListLayoutSpecSwift.hpp +75 -0
- package/nitrogen/generated/ios/c++/HybridUiListModuleSpecSwift.cpp +11 -0
- package/nitrogen/generated/ios/c++/HybridUiListModuleSpecSwift.hpp +93 -0
- package/nitrogen/generated/ios/c++/HybridUiListViewSpecSwift.cpp +11 -0
- package/nitrogen/generated/ios/c++/HybridUiListViewSpecSwift.hpp +121 -0
- package/nitrogen/generated/ios/c++/HybridViewHolderSpecSwift.cpp +11 -0
- package/nitrogen/generated/ios/c++/HybridViewHolderSpecSwift.hpp +75 -0
- package/nitrogen/generated/ios/c++/views/HybridUiListViewComponent.mm +118 -0
- package/nitrogen/generated/ios/c++/views/HybridViewHolderComponent.mm +118 -0
- package/nitrogen/generated/ios/swift/Func_bool_NativeListItem_NativeListItem.swift +47 -0
- package/nitrogen/generated/ios/swift/Func_bool_double_NativeListItem_double.swift +47 -0
- package/nitrogen/generated/ios/swift/Func_double_std__string.swift +47 -0
- package/nitrogen/generated/ios/swift/HybridIOSWorkletsModuleProxyHolderSpec.swift +55 -0
- package/nitrogen/generated/ios/swift/HybridIOSWorkletsModuleProxyHolderSpec_cxx.swift +128 -0
- package/nitrogen/generated/ios/swift/HybridNativeLinearListLayoutSpec.swift +55 -0
- package/nitrogen/generated/ios/swift/HybridNativeLinearListLayoutSpec_cxx.swift +140 -0
- package/nitrogen/generated/ios/swift/HybridNativeListDataSourceSpec.swift +62 -0
- package/nitrogen/generated/ios/swift/HybridNativeListDataSourceSpec_cxx.swift +222 -0
- package/nitrogen/generated/ios/swift/HybridNativeListLayoutSpec.swift +55 -0
- package/nitrogen/generated/ios/swift/HybridNativeListLayoutSpec_cxx.swift +128 -0
- package/nitrogen/generated/ios/swift/HybridUiListModuleSpec.swift +56 -0
- package/nitrogen/generated/ios/swift/HybridUiListModuleSpec_cxx.swift +175 -0
- package/nitrogen/generated/ios/swift/HybridUiListViewSpec.swift +59 -0
- package/nitrogen/generated/ios/swift/HybridUiListViewSpec_cxx.swift +227 -0
- package/nitrogen/generated/ios/swift/HybridViewHolderSpec.swift +55 -0
- package/nitrogen/generated/ios/swift/HybridViewHolderSpec_cxx.swift +147 -0
- package/nitrogen/generated/ios/swift/NativeItemSizeEstimate.swift +60 -0
- package/nitrogen/generated/ios/swift/NativeLinearListLayoutConfig.swift +60 -0
- package/nitrogen/generated/ios/swift/NativeLinearListLayoutIOSConfig.swift +35 -0
- package/nitrogen/generated/ios/swift/NativeListItem.swift +75 -0
- package/nitrogen/generated/ios/swift/Variant_NullType__any_HybridIOSWorkletsModuleProxyHolderSpec_.swift +30 -0
- package/nitrogen/generated/shared/c++/HybridIOSWorkletsModuleProxyHolderSpec.cpp +21 -0
- package/nitrogen/generated/shared/c++/HybridIOSWorkletsModuleProxyHolderSpec.hpp +62 -0
- package/nitrogen/generated/shared/c++/HybridNativeLinearListLayoutSpec.cpp +22 -0
- package/nitrogen/generated/shared/c++/HybridNativeLinearListLayoutSpec.hpp +67 -0
- package/nitrogen/generated/shared/c++/HybridNativeListDataSourceSpec.cpp +28 -0
- package/nitrogen/generated/shared/c++/HybridNativeListDataSourceSpec.hpp +72 -0
- package/nitrogen/generated/shared/c++/HybridNativeListLayoutSpec.cpp +21 -0
- package/nitrogen/generated/shared/c++/HybridNativeListLayoutSpec.hpp +62 -0
- package/nitrogen/generated/shared/c++/HybridUiListModuleSpec.cpp +22 -0
- package/nitrogen/generated/shared/c++/HybridUiListModuleSpec.hpp +68 -0
- package/nitrogen/generated/shared/c++/HybridUiListViewSpec.cpp +25 -0
- package/nitrogen/generated/shared/c++/HybridUiListViewSpec.hpp +79 -0
- package/nitrogen/generated/shared/c++/HybridUiManagerHelperSpec.cpp +23 -0
- package/nitrogen/generated/shared/c++/HybridUiManagerHelperSpec.hpp +65 -0
- package/nitrogen/generated/shared/c++/HybridViewHolderSpec.cpp +21 -0
- package/nitrogen/generated/shared/c++/HybridViewHolderSpec.hpp +62 -0
- package/nitrogen/generated/shared/c++/NativeItemSizeEstimate.hpp +87 -0
- package/nitrogen/generated/shared/c++/NativeLinearListLayoutConfig.hpp +105 -0
- package/nitrogen/generated/shared/c++/NativeLinearListLayoutIOSConfig.hpp +85 -0
- package/nitrogen/generated/shared/c++/NativeListItem.hpp +101 -0
- package/nitrogen/generated/shared/c++/views/HybridUiListViewComponent.cpp +72 -0
- package/nitrogen/generated/shared/c++/views/HybridUiListViewComponent.hpp +109 -0
- package/nitrogen/generated/shared/c++/views/HybridViewHolderComponent.cpp +72 -0
- package/nitrogen/generated/shared/c++/views/HybridViewHolderComponent.hpp +109 -0
- package/nitrogen/generated/shared/json/UiListViewConfig.json +9 -0
- package/nitrogen/generated/shared/json/ViewHolderConfig.json +9 -0
- package/package.json +152 -5
- package/react-native.config.js +16 -0
- package/src/ListDataSource.ts +232 -0
- package/src/ListLayout.ts +95 -0
- package/src/UiListModule.ts +5 -0
- package/src/hooks/useChangeEffect.ts +50 -0
- package/src/index.tsx +49 -0
- package/src/privateGlobals.ts +20 -0
- package/src/renderer/fabric/RenderHelper.ts +29 -0
- package/src/renderer/fabric/UiManagerHelper.ts +5 -0
- package/src/renderer/react/ReactFabricMirror.bundle.js +1984 -0
- package/src/renderer/react/ReactFabricMirror.ts +766 -0
- package/src/renderer/react/ReactFabricRenderer.ts +11 -0
- package/src/specs/IOSWorkletsModuleProxyHolder.nitro.ts +6 -0
- package/src/specs/NativeLinearListLayout.nitro.ts +23 -0
- package/src/specs/NativeListDataSource.nitro.ts +28 -0
- package/src/specs/NativeListLayout.nitro.ts +6 -0
- package/src/specs/UIListModule.nitro.ts +13 -0
- package/src/specs/UIManagerHelper.nitro.ts +34 -0
- package/src/specs/UiListView.nitro.ts +31 -0
- package/src/specs/ViewHolder.nitro.ts +11 -0
- package/src/views/List.tsx +525 -0
- package/src/views/UiListHostComponent.ts +8 -0
- package/FillRateHelper.js +0 -179
- package/FlatList.js +0 -494
- package/LICENSE.md +0 -31
- package/MetroListView.js +0 -166
- package/SectionList.js +0 -291
- package/ViewabilityHelper.js +0 -260
- package/VirtualizeUtils.js +0 -163
- package/VirtualizedList.js +0 -861
- package/VirtualizedSectionList.js +0 -397
- package/index.js +0 -5
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// HybridViewHolderSpecSwift.hpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#pragma once
|
|
9
|
+
|
|
10
|
+
#include "HybridViewHolderSpec.hpp"
|
|
11
|
+
|
|
12
|
+
// Forward declaration of `HybridViewHolderSpec_cxx` to properly resolve imports.
|
|
13
|
+
namespace ReactNativeList { class HybridViewHolderSpec_cxx; }
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
#include "ReactNativeList-Swift-Cxx-Umbrella.hpp"
|
|
20
|
+
|
|
21
|
+
namespace margelo::nitro::reactnativelist {
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* The C++ part of HybridViewHolderSpec_cxx.swift.
|
|
25
|
+
*
|
|
26
|
+
* HybridViewHolderSpecSwift (C++) accesses HybridViewHolderSpec_cxx (Swift), and might
|
|
27
|
+
* contain some additional bridging code for C++ <> Swift interop.
|
|
28
|
+
*
|
|
29
|
+
* Since this obviously introduces an overhead, I hope at some point in
|
|
30
|
+
* the future, HybridViewHolderSpec_cxx can directly inherit from the C++ class HybridViewHolderSpec
|
|
31
|
+
* to simplify the whole structure and memory management.
|
|
32
|
+
*/
|
|
33
|
+
class HybridViewHolderSpecSwift: public virtual HybridViewHolderSpec {
|
|
34
|
+
public:
|
|
35
|
+
// Constructor from a Swift instance
|
|
36
|
+
explicit HybridViewHolderSpecSwift(const ReactNativeList::HybridViewHolderSpec_cxx& swiftPart):
|
|
37
|
+
HybridObject(HybridViewHolderSpec::TAG),
|
|
38
|
+
_swiftPart(swiftPart) { }
|
|
39
|
+
|
|
40
|
+
public:
|
|
41
|
+
// Get the Swift part
|
|
42
|
+
inline ReactNativeList::HybridViewHolderSpec_cxx& getSwiftPart() noexcept {
|
|
43
|
+
return _swiftPart;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
public:
|
|
47
|
+
inline size_t getExternalMemorySize() noexcept override {
|
|
48
|
+
return _swiftPart.getMemorySize();
|
|
49
|
+
}
|
|
50
|
+
bool equals(const std::shared_ptr<HybridObject>& other) override {
|
|
51
|
+
if (auto otherCast = std::dynamic_pointer_cast<HybridViewHolderSpecSwift>(other)) {
|
|
52
|
+
return _swiftPart.equals(otherCast->_swiftPart);
|
|
53
|
+
}
|
|
54
|
+
return false;
|
|
55
|
+
}
|
|
56
|
+
void dispose() noexcept override {
|
|
57
|
+
_swiftPart.dispose();
|
|
58
|
+
}
|
|
59
|
+
std::string toString() override {
|
|
60
|
+
return _swiftPart.toString();
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
public:
|
|
64
|
+
// Properties
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
public:
|
|
68
|
+
// Methods
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
private:
|
|
72
|
+
ReactNativeList::HybridViewHolderSpec_cxx _swiftPart;
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
} // namespace margelo::nitro::reactnativelist
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// HybridUiListViewComponent.mm
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#import "HybridUiListViewComponent.hpp"
|
|
9
|
+
#import <memory>
|
|
10
|
+
#import <react/renderer/componentregistry/ComponentDescriptorProvider.h>
|
|
11
|
+
#import <React/RCTViewComponentView.h>
|
|
12
|
+
#import <React/RCTComponentViewFactory.h>
|
|
13
|
+
#import <React/UIView+ComponentViewProtocol.h>
|
|
14
|
+
#import <NitroModules/NitroDefines.hpp>
|
|
15
|
+
#import <UIKit/UIKit.h>
|
|
16
|
+
|
|
17
|
+
#import "HybridUiListViewSpecSwift.hpp"
|
|
18
|
+
#import "ReactNativeList-Swift-Cxx-Umbrella.hpp"
|
|
19
|
+
|
|
20
|
+
#if __has_include(<cxxreact/ReactNativeVersion.h>)
|
|
21
|
+
#include <cxxreact/ReactNativeVersion.h>
|
|
22
|
+
#if REACT_NATIVE_VERSION_MINOR >= 82
|
|
23
|
+
#define ENABLE_RCT_COMPONENT_VIEW_INVALIDATE
|
|
24
|
+
#endif
|
|
25
|
+
#endif
|
|
26
|
+
|
|
27
|
+
using namespace facebook;
|
|
28
|
+
using namespace margelo::nitro::reactnativelist;
|
|
29
|
+
using namespace margelo::nitro::reactnativelist::views;
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Represents the React Native View holder for the Nitro "UiListView" HybridView.
|
|
33
|
+
*/
|
|
34
|
+
@interface HybridUiListViewComponent: RCTViewComponentView
|
|
35
|
+
+ (BOOL)shouldBeRecycled;
|
|
36
|
+
@end
|
|
37
|
+
|
|
38
|
+
@implementation HybridUiListViewComponent {
|
|
39
|
+
std::shared_ptr<HybridUiListViewSpecSwift> _hybridView;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
+ (void) load {
|
|
43
|
+
[super load];
|
|
44
|
+
[RCTComponentViewFactory.currentComponentViewFactory registerComponentViewClass:[HybridUiListViewComponent class]];
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
+ (react::ComponentDescriptorProvider) componentDescriptorProvider {
|
|
48
|
+
return react::concreteComponentDescriptorProvider<HybridUiListViewComponentDescriptor>();
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
- (instancetype) init {
|
|
52
|
+
if (self = [super init]) {
|
|
53
|
+
std::shared_ptr<HybridUiListViewSpec> hybridView = ReactNativeList::ReactNativeListAutolinking::createUiListView();
|
|
54
|
+
_hybridView = std::dynamic_pointer_cast<HybridUiListViewSpecSwift>(hybridView);
|
|
55
|
+
[self updateView];
|
|
56
|
+
}
|
|
57
|
+
return self;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
- (void) updateView {
|
|
61
|
+
// 1. Get Swift part
|
|
62
|
+
ReactNativeList::HybridUiListViewSpec_cxx& swiftPart = _hybridView->getSwiftPart();
|
|
63
|
+
|
|
64
|
+
// 2. Get UIView*
|
|
65
|
+
void* viewUnsafe = swiftPart.getView();
|
|
66
|
+
UIView* view = (__bridge_transfer UIView*) viewUnsafe;
|
|
67
|
+
|
|
68
|
+
// 3. Update RCTViewComponentView's [contentView]
|
|
69
|
+
[self setContentView:view];
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
- (void) updateProps:(const std::shared_ptr<const react::Props>&)props
|
|
73
|
+
oldProps:(const std::shared_ptr<const react::Props>&)oldProps {
|
|
74
|
+
// 1. Downcast props
|
|
75
|
+
const auto& newViewPropsConst = *std::static_pointer_cast<HybridUiListViewProps const>(props);
|
|
76
|
+
auto& newViewProps = const_cast<HybridUiListViewProps&>(newViewPropsConst);
|
|
77
|
+
ReactNativeList::HybridUiListViewSpec_cxx& swiftPart = _hybridView->getSwiftPart();
|
|
78
|
+
|
|
79
|
+
// 2. Update each prop individually
|
|
80
|
+
swiftPart.beforeUpdate();
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
swiftPart.afterUpdate();
|
|
85
|
+
|
|
86
|
+
// 3. Update hybridRef if it changed
|
|
87
|
+
if (newViewProps.hybridRef.isDirty) {
|
|
88
|
+
// hybridRef changed - call it with new this
|
|
89
|
+
const auto& maybeFunc = newViewProps.hybridRef.value;
|
|
90
|
+
if (maybeFunc.has_value()) {
|
|
91
|
+
maybeFunc.value()(_hybridView);
|
|
92
|
+
}
|
|
93
|
+
newViewProps.hybridRef.isDirty = false;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
// 4. Continue in base class
|
|
97
|
+
[super updateProps:props oldProps:oldProps];
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
+ (BOOL)shouldBeRecycled {
|
|
101
|
+
return ReactNativeList::ReactNativeListAutolinking::isUiListViewRecyclable();
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
- (void)prepareForRecycle {
|
|
105
|
+
[super prepareForRecycle];
|
|
106
|
+
ReactNativeList::HybridUiListViewSpec_cxx& swiftPart = _hybridView->getSwiftPart();
|
|
107
|
+
swiftPart.maybePrepareForRecycle();
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
#ifdef ENABLE_RCT_COMPONENT_VIEW_INVALIDATE
|
|
111
|
+
- (void)invalidate {
|
|
112
|
+
ReactNativeList::HybridUiListViewSpec_cxx& swiftPart = _hybridView->getSwiftPart();
|
|
113
|
+
swiftPart.onDropView();
|
|
114
|
+
[super invalidate];
|
|
115
|
+
}
|
|
116
|
+
#endif
|
|
117
|
+
|
|
118
|
+
@end
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// HybridViewHolderComponent.mm
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#import "HybridViewHolderComponent.hpp"
|
|
9
|
+
#import <memory>
|
|
10
|
+
#import <react/renderer/componentregistry/ComponentDescriptorProvider.h>
|
|
11
|
+
#import <React/RCTViewComponentView.h>
|
|
12
|
+
#import <React/RCTComponentViewFactory.h>
|
|
13
|
+
#import <React/UIView+ComponentViewProtocol.h>
|
|
14
|
+
#import <NitroModules/NitroDefines.hpp>
|
|
15
|
+
#import <UIKit/UIKit.h>
|
|
16
|
+
|
|
17
|
+
#import "HybridViewHolderSpecSwift.hpp"
|
|
18
|
+
#import "ReactNativeList-Swift-Cxx-Umbrella.hpp"
|
|
19
|
+
|
|
20
|
+
#if __has_include(<cxxreact/ReactNativeVersion.h>)
|
|
21
|
+
#include <cxxreact/ReactNativeVersion.h>
|
|
22
|
+
#if REACT_NATIVE_VERSION_MINOR >= 82
|
|
23
|
+
#define ENABLE_RCT_COMPONENT_VIEW_INVALIDATE
|
|
24
|
+
#endif
|
|
25
|
+
#endif
|
|
26
|
+
|
|
27
|
+
using namespace facebook;
|
|
28
|
+
using namespace margelo::nitro::reactnativelist;
|
|
29
|
+
using namespace margelo::nitro::reactnativelist::views;
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Represents the React Native View holder for the Nitro "ViewHolder" HybridView.
|
|
33
|
+
*/
|
|
34
|
+
@interface HybridViewHolderComponent: RCTViewComponentView
|
|
35
|
+
+ (BOOL)shouldBeRecycled;
|
|
36
|
+
@end
|
|
37
|
+
|
|
38
|
+
@implementation HybridViewHolderComponent {
|
|
39
|
+
std::shared_ptr<HybridViewHolderSpecSwift> _hybridView;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
+ (void) load {
|
|
43
|
+
[super load];
|
|
44
|
+
[RCTComponentViewFactory.currentComponentViewFactory registerComponentViewClass:[HybridViewHolderComponent class]];
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
+ (react::ComponentDescriptorProvider) componentDescriptorProvider {
|
|
48
|
+
return react::concreteComponentDescriptorProvider<HybridViewHolderComponentDescriptor>();
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
- (instancetype) init {
|
|
52
|
+
if (self = [super init]) {
|
|
53
|
+
std::shared_ptr<HybridViewHolderSpec> hybridView = ReactNativeList::ReactNativeListAutolinking::createViewHolder();
|
|
54
|
+
_hybridView = std::dynamic_pointer_cast<HybridViewHolderSpecSwift>(hybridView);
|
|
55
|
+
[self updateView];
|
|
56
|
+
}
|
|
57
|
+
return self;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
- (void) updateView {
|
|
61
|
+
// 1. Get Swift part
|
|
62
|
+
ReactNativeList::HybridViewHolderSpec_cxx& swiftPart = _hybridView->getSwiftPart();
|
|
63
|
+
|
|
64
|
+
// 2. Get UIView*
|
|
65
|
+
void* viewUnsafe = swiftPart.getView();
|
|
66
|
+
UIView* view = (__bridge_transfer UIView*) viewUnsafe;
|
|
67
|
+
|
|
68
|
+
// 3. Update RCTViewComponentView's [contentView]
|
|
69
|
+
[self setContentView:view];
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
- (void) updateProps:(const std::shared_ptr<const react::Props>&)props
|
|
73
|
+
oldProps:(const std::shared_ptr<const react::Props>&)oldProps {
|
|
74
|
+
// 1. Downcast props
|
|
75
|
+
const auto& newViewPropsConst = *std::static_pointer_cast<HybridViewHolderProps const>(props);
|
|
76
|
+
auto& newViewProps = const_cast<HybridViewHolderProps&>(newViewPropsConst);
|
|
77
|
+
ReactNativeList::HybridViewHolderSpec_cxx& swiftPart = _hybridView->getSwiftPart();
|
|
78
|
+
|
|
79
|
+
// 2. Update each prop individually
|
|
80
|
+
swiftPart.beforeUpdate();
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
swiftPart.afterUpdate();
|
|
85
|
+
|
|
86
|
+
// 3. Update hybridRef if it changed
|
|
87
|
+
if (newViewProps.hybridRef.isDirty) {
|
|
88
|
+
// hybridRef changed - call it with new this
|
|
89
|
+
const auto& maybeFunc = newViewProps.hybridRef.value;
|
|
90
|
+
if (maybeFunc.has_value()) {
|
|
91
|
+
maybeFunc.value()(_hybridView);
|
|
92
|
+
}
|
|
93
|
+
newViewProps.hybridRef.isDirty = false;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
// 4. Continue in base class
|
|
97
|
+
[super updateProps:props oldProps:oldProps];
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
+ (BOOL)shouldBeRecycled {
|
|
101
|
+
return ReactNativeList::ReactNativeListAutolinking::isViewHolderRecyclable();
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
- (void)prepareForRecycle {
|
|
105
|
+
[super prepareForRecycle];
|
|
106
|
+
ReactNativeList::HybridViewHolderSpec_cxx& swiftPart = _hybridView->getSwiftPart();
|
|
107
|
+
swiftPart.maybePrepareForRecycle();
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
#ifdef ENABLE_RCT_COMPONENT_VIEW_INVALIDATE
|
|
111
|
+
- (void)invalidate {
|
|
112
|
+
ReactNativeList::HybridViewHolderSpec_cxx& swiftPart = _hybridView->getSwiftPart();
|
|
113
|
+
swiftPart.onDropView();
|
|
114
|
+
[super invalidate];
|
|
115
|
+
}
|
|
116
|
+
#endif
|
|
117
|
+
|
|
118
|
+
@end
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// Func_bool_NativeListItem_NativeListItem.swift
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
import NitroModules
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Wraps a Swift `(_ oldItem: NativeListItem, _ newItem: NativeListItem) -> Bool` as a class.
|
|
12
|
+
* This class can be used from C++, e.g. to wrap the Swift closure as a `std::function`.
|
|
13
|
+
*/
|
|
14
|
+
public final class Func_bool_NativeListItem_NativeListItem {
|
|
15
|
+
public typealias bridge = margelo.nitro.reactnativelist.bridge.swift
|
|
16
|
+
|
|
17
|
+
private let closure: (_ oldItem: NativeListItem, _ newItem: NativeListItem) -> Bool
|
|
18
|
+
|
|
19
|
+
public init(_ closure: @escaping (_ oldItem: NativeListItem, _ newItem: NativeListItem) -> Bool) {
|
|
20
|
+
self.closure = closure
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
@inline(__always)
|
|
24
|
+
public func call(oldItem: NativeListItem, newItem: NativeListItem) -> Bool {
|
|
25
|
+
let __result: Bool = self.closure(oldItem, newItem)
|
|
26
|
+
return __result
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Casts this instance to a retained unsafe raw pointer.
|
|
31
|
+
* This acquires one additional strong reference on the object!
|
|
32
|
+
*/
|
|
33
|
+
@inline(__always)
|
|
34
|
+
public func toUnsafe() -> UnsafeMutableRawPointer {
|
|
35
|
+
return Unmanaged.passRetained(self).toOpaque()
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Casts an unsafe pointer to a `Func_bool_NativeListItem_NativeListItem`.
|
|
40
|
+
* The pointer has to be a retained opaque `Unmanaged<Func_bool_NativeListItem_NativeListItem>`.
|
|
41
|
+
* This removes one strong reference from the object!
|
|
42
|
+
*/
|
|
43
|
+
@inline(__always)
|
|
44
|
+
public static func fromUnsafe(_ pointer: UnsafeMutableRawPointer) -> Func_bool_NativeListItem_NativeListItem {
|
|
45
|
+
return Unmanaged<Func_bool_NativeListItem_NativeListItem>.fromOpaque(pointer).takeRetainedValue()
|
|
46
|
+
}
|
|
47
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// Func_bool_double_NativeListItem_double.swift
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
import NitroModules
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Wraps a Swift `(_ reactTag: Double, _ item: NativeListItem, _ index: Double) -> Bool` as a class.
|
|
12
|
+
* This class can be used from C++, e.g. to wrap the Swift closure as a `std::function`.
|
|
13
|
+
*/
|
|
14
|
+
public final class Func_bool_double_NativeListItem_double {
|
|
15
|
+
public typealias bridge = margelo.nitro.reactnativelist.bridge.swift
|
|
16
|
+
|
|
17
|
+
private let closure: (_ reactTag: Double, _ item: NativeListItem, _ index: Double) -> Bool
|
|
18
|
+
|
|
19
|
+
public init(_ closure: @escaping (_ reactTag: Double, _ item: NativeListItem, _ index: Double) -> Bool) {
|
|
20
|
+
self.closure = closure
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
@inline(__always)
|
|
24
|
+
public func call(reactTag: Double, item: NativeListItem, index: Double) -> Bool {
|
|
25
|
+
let __result: Bool = self.closure(reactTag, item, index)
|
|
26
|
+
return __result
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Casts this instance to a retained unsafe raw pointer.
|
|
31
|
+
* This acquires one additional strong reference on the object!
|
|
32
|
+
*/
|
|
33
|
+
@inline(__always)
|
|
34
|
+
public func toUnsafe() -> UnsafeMutableRawPointer {
|
|
35
|
+
return Unmanaged.passRetained(self).toOpaque()
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Casts an unsafe pointer to a `Func_bool_double_NativeListItem_double`.
|
|
40
|
+
* The pointer has to be a retained opaque `Unmanaged<Func_bool_double_NativeListItem_double>`.
|
|
41
|
+
* This removes one strong reference from the object!
|
|
42
|
+
*/
|
|
43
|
+
@inline(__always)
|
|
44
|
+
public static func fromUnsafe(_ pointer: UnsafeMutableRawPointer) -> Func_bool_double_NativeListItem_double {
|
|
45
|
+
return Unmanaged<Func_bool_double_NativeListItem_double>.fromOpaque(pointer).takeRetainedValue()
|
|
46
|
+
}
|
|
47
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// Func_double_std__string.swift
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
import NitroModules
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Wraps a Swift `(_ type: String) -> Double` as a class.
|
|
12
|
+
* This class can be used from C++, e.g. to wrap the Swift closure as a `std::function`.
|
|
13
|
+
*/
|
|
14
|
+
public final class Func_double_std__string {
|
|
15
|
+
public typealias bridge = margelo.nitro.reactnativelist.bridge.swift
|
|
16
|
+
|
|
17
|
+
private let closure: (_ type: String) -> Double
|
|
18
|
+
|
|
19
|
+
public init(_ closure: @escaping (_ type: String) -> Double) {
|
|
20
|
+
self.closure = closure
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
@inline(__always)
|
|
24
|
+
public func call(type: std.string) -> Double {
|
|
25
|
+
let __result: Double = self.closure(String(type))
|
|
26
|
+
return __result
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Casts this instance to a retained unsafe raw pointer.
|
|
31
|
+
* This acquires one additional strong reference on the object!
|
|
32
|
+
*/
|
|
33
|
+
@inline(__always)
|
|
34
|
+
public func toUnsafe() -> UnsafeMutableRawPointer {
|
|
35
|
+
return Unmanaged.passRetained(self).toOpaque()
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Casts an unsafe pointer to a `Func_double_std__string`.
|
|
40
|
+
* The pointer has to be a retained opaque `Unmanaged<Func_double_std__string>`.
|
|
41
|
+
* This removes one strong reference from the object!
|
|
42
|
+
*/
|
|
43
|
+
@inline(__always)
|
|
44
|
+
public static func fromUnsafe(_ pointer: UnsafeMutableRawPointer) -> Func_double_std__string {
|
|
45
|
+
return Unmanaged<Func_double_std__string>.fromOpaque(pointer).takeRetainedValue()
|
|
46
|
+
}
|
|
47
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// HybridIOSWorkletsModuleProxyHolderSpec.swift
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
import NitroModules
|
|
9
|
+
|
|
10
|
+
/// See ``HybridIOSWorkletsModuleProxyHolderSpec``
|
|
11
|
+
public protocol HybridIOSWorkletsModuleProxyHolderSpec_protocol: HybridObject {
|
|
12
|
+
// Properties
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
// Methods
|
|
16
|
+
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
public extension HybridIOSWorkletsModuleProxyHolderSpec_protocol {
|
|
20
|
+
/// Default implementation of ``HybridObject.toString``
|
|
21
|
+
func toString() -> String {
|
|
22
|
+
return "[HybridObject IOSWorkletsModuleProxyHolder]"
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/// See ``HybridIOSWorkletsModuleProxyHolderSpec``
|
|
27
|
+
open class HybridIOSWorkletsModuleProxyHolderSpec_base {
|
|
28
|
+
private weak var cxxWrapper: HybridIOSWorkletsModuleProxyHolderSpec_cxx? = nil
|
|
29
|
+
public init() { }
|
|
30
|
+
public func getCxxWrapper() -> HybridIOSWorkletsModuleProxyHolderSpec_cxx {
|
|
31
|
+
#if DEBUG
|
|
32
|
+
guard self is any HybridIOSWorkletsModuleProxyHolderSpec else {
|
|
33
|
+
fatalError("`self` is not a `HybridIOSWorkletsModuleProxyHolderSpec`! Did you accidentally inherit from `HybridIOSWorkletsModuleProxyHolderSpec_base` instead of `HybridIOSWorkletsModuleProxyHolderSpec`?")
|
|
34
|
+
}
|
|
35
|
+
#endif
|
|
36
|
+
if let cxxWrapper = self.cxxWrapper {
|
|
37
|
+
return cxxWrapper
|
|
38
|
+
} else {
|
|
39
|
+
let cxxWrapper = HybridIOSWorkletsModuleProxyHolderSpec_cxx(self as! any HybridIOSWorkletsModuleProxyHolderSpec)
|
|
40
|
+
self.cxxWrapper = cxxWrapper
|
|
41
|
+
return cxxWrapper
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* A Swift base-protocol representing the IOSWorkletsModuleProxyHolder HybridObject.
|
|
48
|
+
* Implement this protocol to create Swift-based instances of IOSWorkletsModuleProxyHolder.
|
|
49
|
+
* ```swift
|
|
50
|
+
* class HybridIOSWorkletsModuleProxyHolder : HybridIOSWorkletsModuleProxyHolderSpec {
|
|
51
|
+
* // ...
|
|
52
|
+
* }
|
|
53
|
+
* ```
|
|
54
|
+
*/
|
|
55
|
+
public typealias HybridIOSWorkletsModuleProxyHolderSpec = HybridIOSWorkletsModuleProxyHolderSpec_protocol & HybridIOSWorkletsModuleProxyHolderSpec_base
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// HybridIOSWorkletsModuleProxyHolderSpec_cxx.swift
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
import NitroModules
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* A class implementation that bridges HybridIOSWorkletsModuleProxyHolderSpec over to C++.
|
|
12
|
+
* In C++, we cannot use Swift protocols - so we need to wrap it in a class to make it strongly defined.
|
|
13
|
+
*
|
|
14
|
+
* Also, some Swift types need to be bridged with special handling:
|
|
15
|
+
* - Enums need to be wrapped in Structs, otherwise they cannot be accessed bi-directionally (Swift bug: https://github.com/swiftlang/swift/issues/75330)
|
|
16
|
+
* - Other HybridObjects need to be wrapped/unwrapped from the Swift TCxx wrapper
|
|
17
|
+
* - Throwing methods need to be wrapped with a Result<T, Error> type, as exceptions cannot be propagated to C++
|
|
18
|
+
*/
|
|
19
|
+
open class HybridIOSWorkletsModuleProxyHolderSpec_cxx {
|
|
20
|
+
/**
|
|
21
|
+
* The Swift <> C++ bridge's namespace (`margelo::nitro::reactnativelist::bridge::swift`)
|
|
22
|
+
* from `ReactNativeList-Swift-Cxx-Bridge.hpp`.
|
|
23
|
+
* This contains specialized C++ templates, and C++ helper functions that can be accessed from Swift.
|
|
24
|
+
*/
|
|
25
|
+
public typealias bridge = margelo.nitro.reactnativelist.bridge.swift
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Holds an instance of the `HybridIOSWorkletsModuleProxyHolderSpec` Swift protocol.
|
|
29
|
+
*/
|
|
30
|
+
private var __implementation: any HybridIOSWorkletsModuleProxyHolderSpec
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Holds a weak pointer to the C++ class that wraps the Swift class.
|
|
34
|
+
*/
|
|
35
|
+
private var __cxxPart: bridge.std__weak_ptr_HybridIOSWorkletsModuleProxyHolderSpec_
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Create a new `HybridIOSWorkletsModuleProxyHolderSpec_cxx` that wraps the given `HybridIOSWorkletsModuleProxyHolderSpec`.
|
|
39
|
+
* All properties and methods bridge to C++ types.
|
|
40
|
+
*/
|
|
41
|
+
public init(_ implementation: any HybridIOSWorkletsModuleProxyHolderSpec) {
|
|
42
|
+
self.__implementation = implementation
|
|
43
|
+
self.__cxxPart = .init()
|
|
44
|
+
/* no base class */
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Get the actual `HybridIOSWorkletsModuleProxyHolderSpec` instance this class wraps.
|
|
49
|
+
*/
|
|
50
|
+
@inline(__always)
|
|
51
|
+
public func getHybridIOSWorkletsModuleProxyHolderSpec() -> any HybridIOSWorkletsModuleProxyHolderSpec {
|
|
52
|
+
return __implementation
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Casts this instance to a retained unsafe raw pointer.
|
|
57
|
+
* This acquires one additional strong reference on the object!
|
|
58
|
+
*/
|
|
59
|
+
public func toUnsafe() -> UnsafeMutableRawPointer {
|
|
60
|
+
return Unmanaged.passRetained(self).toOpaque()
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* Casts an unsafe pointer to a `HybridIOSWorkletsModuleProxyHolderSpec_cxx`.
|
|
65
|
+
* The pointer has to be a retained opaque `Unmanaged<HybridIOSWorkletsModuleProxyHolderSpec_cxx>`.
|
|
66
|
+
* This removes one strong reference from the object!
|
|
67
|
+
*/
|
|
68
|
+
public class func fromUnsafe(_ pointer: UnsafeMutableRawPointer) -> HybridIOSWorkletsModuleProxyHolderSpec_cxx {
|
|
69
|
+
return Unmanaged<HybridIOSWorkletsModuleProxyHolderSpec_cxx>.fromOpaque(pointer).takeRetainedValue()
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Gets (or creates) the C++ part of this Hybrid Object.
|
|
74
|
+
* The C++ part is a `std::shared_ptr<HybridIOSWorkletsModuleProxyHolderSpec>`.
|
|
75
|
+
*/
|
|
76
|
+
public func getCxxPart() -> bridge.std__shared_ptr_HybridIOSWorkletsModuleProxyHolderSpec_ {
|
|
77
|
+
let cachedCxxPart = self.__cxxPart.lock()
|
|
78
|
+
if Bool(fromCxx: cachedCxxPart) {
|
|
79
|
+
return cachedCxxPart
|
|
80
|
+
} else {
|
|
81
|
+
let newCxxPart = bridge.create_std__shared_ptr_HybridIOSWorkletsModuleProxyHolderSpec_(self.toUnsafe())
|
|
82
|
+
__cxxPart = bridge.weakify_std__shared_ptr_HybridIOSWorkletsModuleProxyHolderSpec_(newCxxPart)
|
|
83
|
+
return newCxxPart
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* Get the memory size of the Swift class (plus size of any other allocations)
|
|
91
|
+
* so the JS VM can properly track it and garbage-collect the JS object if needed.
|
|
92
|
+
*/
|
|
93
|
+
@inline(__always)
|
|
94
|
+
public var memorySize: Int {
|
|
95
|
+
return MemoryHelper.getSizeOf(self.__implementation) + self.__implementation.memorySize
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* Compares this object with the given [other] object for reference equality.
|
|
100
|
+
*/
|
|
101
|
+
@inline(__always)
|
|
102
|
+
public func equals(other: HybridIOSWorkletsModuleProxyHolderSpec_cxx) -> Bool {
|
|
103
|
+
return self.__implementation === other.__implementation
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* Call dispose() on the Swift class.
|
|
108
|
+
* This _may_ be called manually from JS.
|
|
109
|
+
*/
|
|
110
|
+
@inline(__always)
|
|
111
|
+
public func dispose() {
|
|
112
|
+
self.__implementation.dispose()
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* Call toString() on the Swift class.
|
|
117
|
+
*/
|
|
118
|
+
@inline(__always)
|
|
119
|
+
public func toString() -> String {
|
|
120
|
+
return self.__implementation.toString()
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
// Properties
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
// Methods
|
|
127
|
+
|
|
128
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// HybridNativeLinearListLayoutSpec.swift
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
import NitroModules
|
|
9
|
+
|
|
10
|
+
/// See ``HybridNativeLinearListLayoutSpec``
|
|
11
|
+
public protocol HybridNativeLinearListLayoutSpec_protocol: HybridObject, HybridNativeListLayoutSpec_protocol {
|
|
12
|
+
// Properties
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
// Methods
|
|
16
|
+
func setConfig(config: NativeLinearListLayoutConfig) throws -> Void
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
public extension HybridNativeLinearListLayoutSpec_protocol {
|
|
20
|
+
/// Default implementation of ``HybridObject.toString``
|
|
21
|
+
func toString() -> String {
|
|
22
|
+
return "[HybridObject NativeLinearListLayout]"
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/// See ``HybridNativeLinearListLayoutSpec``
|
|
27
|
+
open class HybridNativeLinearListLayoutSpec_base: HybridNativeListLayoutSpec_base {
|
|
28
|
+
private weak var cxxWrapper: HybridNativeLinearListLayoutSpec_cxx? = nil
|
|
29
|
+
public override init() { super.init() }
|
|
30
|
+
public override func getCxxWrapper() -> HybridNativeLinearListLayoutSpec_cxx {
|
|
31
|
+
#if DEBUG
|
|
32
|
+
guard self is any HybridNativeLinearListLayoutSpec else {
|
|
33
|
+
fatalError("`self` is not a `HybridNativeLinearListLayoutSpec`! Did you accidentally inherit from `HybridNativeLinearListLayoutSpec_base` instead of `HybridNativeLinearListLayoutSpec`?")
|
|
34
|
+
}
|
|
35
|
+
#endif
|
|
36
|
+
if let cxxWrapper = self.cxxWrapper {
|
|
37
|
+
return cxxWrapper
|
|
38
|
+
} else {
|
|
39
|
+
let cxxWrapper = HybridNativeLinearListLayoutSpec_cxx(self as! any HybridNativeLinearListLayoutSpec)
|
|
40
|
+
self.cxxWrapper = cxxWrapper
|
|
41
|
+
return cxxWrapper
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* A Swift base-protocol representing the NativeLinearListLayout HybridObject.
|
|
48
|
+
* Implement this protocol to create Swift-based instances of NativeLinearListLayout.
|
|
49
|
+
* ```swift
|
|
50
|
+
* class HybridNativeLinearListLayout : HybridNativeLinearListLayoutSpec {
|
|
51
|
+
* // ...
|
|
52
|
+
* }
|
|
53
|
+
* ```
|
|
54
|
+
*/
|
|
55
|
+
public typealias HybridNativeLinearListLayoutSpec = HybridNativeLinearListLayoutSpec_protocol & HybridNativeLinearListLayoutSpec_base
|