react-native-list 1.0.0 → 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 +190 -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/ListView/__mocks__/ListViewMock.js +0 -55
- 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/__flowtests__/FlatList-flowtest.js +0 -90
- package/__flowtests__/SectionList-flowtest.js +0 -89
- package/__tests__/FillRateHelper-test.js +0 -106
- package/__tests__/FlatList-test.js +0 -64
- package/__tests__/SectionList-test.js +0 -67
- package/__tests__/ViewabilityHelper-test.js +0 -359
- package/__tests__/VirtualizeUtils-test.js +0 -74
- package/__tests__/__snapshots__/FlatList-test.js.snap +0 -251
- package/__tests__/__snapshots__/SectionList-test.js.snap +0 -283
- package/index.js +0 -5
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// HybridUiListModuleSpec.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
|
+
#if __has_include(<NitroModules/HybridObject.hpp>)
|
|
11
|
+
#include <NitroModules/HybridObject.hpp>
|
|
12
|
+
#else
|
|
13
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
14
|
+
#endif
|
|
15
|
+
|
|
16
|
+
// Forward declaration of `HybridIOSWorkletsModuleProxyHolderSpec` to properly resolve imports.
|
|
17
|
+
namespace margelo::nitro::reactnativelist { class HybridIOSWorkletsModuleProxyHolderSpec; }
|
|
18
|
+
|
|
19
|
+
#include <memory>
|
|
20
|
+
#include "HybridIOSWorkletsModuleProxyHolderSpec.hpp"
|
|
21
|
+
#include <NitroModules/Null.hpp>
|
|
22
|
+
#include <variant>
|
|
23
|
+
#include <optional>
|
|
24
|
+
|
|
25
|
+
namespace margelo::nitro::reactnativelist {
|
|
26
|
+
|
|
27
|
+
using namespace margelo::nitro;
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* An abstract base class for `UiListModule`
|
|
31
|
+
* Inherit this class to create instances of `HybridUiListModuleSpec` in C++.
|
|
32
|
+
* You must explicitly call `HybridObject`'s constructor yourself, because it is virtual.
|
|
33
|
+
* @example
|
|
34
|
+
* ```cpp
|
|
35
|
+
* class HybridUiListModule: public HybridUiListModuleSpec {
|
|
36
|
+
* public:
|
|
37
|
+
* HybridUiListModule(...): HybridObject(TAG) { ... }
|
|
38
|
+
* // ...
|
|
39
|
+
* };
|
|
40
|
+
* ```
|
|
41
|
+
*/
|
|
42
|
+
class HybridUiListModuleSpec: public virtual HybridObject {
|
|
43
|
+
public:
|
|
44
|
+
// Constructor
|
|
45
|
+
explicit HybridUiListModuleSpec(): HybridObject(TAG) { }
|
|
46
|
+
|
|
47
|
+
// Destructor
|
|
48
|
+
~HybridUiListModuleSpec() override = default;
|
|
49
|
+
|
|
50
|
+
public:
|
|
51
|
+
// Properties
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
public:
|
|
55
|
+
// Methods
|
|
56
|
+
virtual std::shared_ptr<HybridIOSWorkletsModuleProxyHolderSpec> iosGetWorkletsModule() = 0;
|
|
57
|
+
virtual void setupRuntime(const std::optional<std::variant<nitro::NullType, std::shared_ptr<HybridIOSWorkletsModuleProxyHolderSpec>>>& workletsModuleHolder) = 0;
|
|
58
|
+
|
|
59
|
+
protected:
|
|
60
|
+
// Hybrid Setup
|
|
61
|
+
void loadHybridMethods() override;
|
|
62
|
+
|
|
63
|
+
protected:
|
|
64
|
+
// Tag for logging
|
|
65
|
+
static constexpr auto TAG = "UiListModule";
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
} // namespace margelo::nitro::reactnativelist
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// HybridUiListViewSpec.cpp
|
|
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
|
+
#include "HybridUiListViewSpec.hpp"
|
|
9
|
+
|
|
10
|
+
namespace margelo::nitro::reactnativelist {
|
|
11
|
+
|
|
12
|
+
void HybridUiListViewSpec::loadHybridMethods() {
|
|
13
|
+
// load base methods/properties
|
|
14
|
+
HybridObject::loadHybridMethods();
|
|
15
|
+
// load custom methods/properties
|
|
16
|
+
registerHybrids(this, [](Prototype& prototype) {
|
|
17
|
+
prototype.registerHybridMethod("setListCallbacks", &HybridUiListViewSpec::setListCallbacks);
|
|
18
|
+
prototype.registerHybridMethod("setDataSource", &HybridUiListViewSpec::setDataSource);
|
|
19
|
+
prototype.registerHybridMethod("setLayout", &HybridUiListViewSpec::setLayout);
|
|
20
|
+
prototype.registerHybridMethod("getSurfaceId", &HybridUiListViewSpec::getSurfaceId);
|
|
21
|
+
prototype.registerHybridMethod("disposeRendererSurface", &HybridUiListViewSpec::disposeRendererSurface);
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
} // namespace margelo::nitro::reactnativelist
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// HybridUiListViewSpec.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
|
+
#if __has_include(<NitroModules/HybridObject.hpp>)
|
|
11
|
+
#include <NitroModules/HybridObject.hpp>
|
|
12
|
+
#else
|
|
13
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
14
|
+
#endif
|
|
15
|
+
|
|
16
|
+
// Forward declaration of `HybridUiListModuleSpec` to properly resolve imports.
|
|
17
|
+
namespace margelo::nitro::reactnativelist { class HybridUiListModuleSpec; }
|
|
18
|
+
// Forward declaration of `NativeListItem` to properly resolve imports.
|
|
19
|
+
namespace margelo::nitro::reactnativelist { struct NativeListItem; }
|
|
20
|
+
// Forward declaration of `HybridNativeListDataSourceSpec` to properly resolve imports.
|
|
21
|
+
namespace margelo::nitro::reactnativelist { class HybridNativeListDataSourceSpec; }
|
|
22
|
+
// Forward declaration of `HybridNativeListLayoutSpec` to properly resolve imports.
|
|
23
|
+
namespace margelo::nitro::reactnativelist { class HybridNativeListLayoutSpec; }
|
|
24
|
+
|
|
25
|
+
#include <memory>
|
|
26
|
+
#include "HybridUiListModuleSpec.hpp"
|
|
27
|
+
#include <string>
|
|
28
|
+
#include <functional>
|
|
29
|
+
#include "NativeListItem.hpp"
|
|
30
|
+
#include "HybridNativeListDataSourceSpec.hpp"
|
|
31
|
+
#include "HybridNativeListLayoutSpec.hpp"
|
|
32
|
+
|
|
33
|
+
namespace margelo::nitro::reactnativelist {
|
|
34
|
+
|
|
35
|
+
using namespace margelo::nitro;
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* An abstract base class for `UiListView`
|
|
39
|
+
* Inherit this class to create instances of `HybridUiListViewSpec` in C++.
|
|
40
|
+
* You must explicitly call `HybridObject`'s constructor yourself, because it is virtual.
|
|
41
|
+
* @example
|
|
42
|
+
* ```cpp
|
|
43
|
+
* class HybridUiListView: public HybridUiListViewSpec {
|
|
44
|
+
* public:
|
|
45
|
+
* HybridUiListView(...): HybridObject(TAG) { ... }
|
|
46
|
+
* // ...
|
|
47
|
+
* };
|
|
48
|
+
* ```
|
|
49
|
+
*/
|
|
50
|
+
class HybridUiListViewSpec: public virtual HybridObject {
|
|
51
|
+
public:
|
|
52
|
+
// Constructor
|
|
53
|
+
explicit HybridUiListViewSpec(): HybridObject(TAG) { }
|
|
54
|
+
|
|
55
|
+
// Destructor
|
|
56
|
+
~HybridUiListViewSpec() override = default;
|
|
57
|
+
|
|
58
|
+
public:
|
|
59
|
+
// Properties
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
public:
|
|
63
|
+
// Methods
|
|
64
|
+
virtual void setListCallbacks(const std::shared_ptr<HybridUiListModuleSpec>& uiListModule, const std::function<double(const std::string& /* type */)>& createView, const std::function<bool(double /* reactTag */, const NativeListItem& /* item */, double /* index */)>& updateView) = 0;
|
|
65
|
+
virtual void setDataSource(const std::shared_ptr<HybridNativeListDataSourceSpec>& dataSource) = 0;
|
|
66
|
+
virtual void setLayout(const std::shared_ptr<HybridNativeListLayoutSpec>& layout) = 0;
|
|
67
|
+
virtual double getSurfaceId() = 0;
|
|
68
|
+
virtual void disposeRendererSurface() = 0;
|
|
69
|
+
|
|
70
|
+
protected:
|
|
71
|
+
// Hybrid Setup
|
|
72
|
+
void loadHybridMethods() override;
|
|
73
|
+
|
|
74
|
+
protected:
|
|
75
|
+
// Tag for logging
|
|
76
|
+
static constexpr auto TAG = "UiListView";
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
} // namespace margelo::nitro::reactnativelist
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// HybridUiManagerHelperSpec.cpp
|
|
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
|
+
#include "HybridUiManagerHelperSpec.hpp"
|
|
9
|
+
|
|
10
|
+
namespace margelo::nitro::reactnativelist {
|
|
11
|
+
|
|
12
|
+
void HybridUiManagerHelperSpec::loadHybridMethods() {
|
|
13
|
+
// load base methods/properties
|
|
14
|
+
HybridObject::loadHybridMethods();
|
|
15
|
+
// load custom methods/properties
|
|
16
|
+
registerHybrids(this, [](Prototype& prototype) {
|
|
17
|
+
prototype.registerHybridMethod("completeRootSync", &HybridUiManagerHelperSpec::completeRootSync);
|
|
18
|
+
prototype.registerHybridMethod("registerManagedSurface", &HybridUiManagerHelperSpec::registerManagedSurface);
|
|
19
|
+
prototype.registerHybridMethod("unregisterManagedSurface", &HybridUiManagerHelperSpec::unregisterManagedSurface);
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
} // namespace margelo::nitro::reactnativelist
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// HybridUiManagerHelperSpec.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
|
+
#if __has_include(<NitroModules/HybridObject.hpp>)
|
|
11
|
+
#include <NitroModules/HybridObject.hpp>
|
|
12
|
+
#else
|
|
13
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
14
|
+
#endif
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
#include "JSIConverter+UIManagerBinding.hpp"
|
|
19
|
+
#include "JSIConverter+ShadowNodeList.hpp"
|
|
20
|
+
|
|
21
|
+
namespace margelo::nitro::reactnativelist {
|
|
22
|
+
|
|
23
|
+
using namespace margelo::nitro;
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* An abstract base class for `UiManagerHelper`
|
|
27
|
+
* Inherit this class to create instances of `HybridUiManagerHelperSpec` in C++.
|
|
28
|
+
* You must explicitly call `HybridObject`'s constructor yourself, because it is virtual.
|
|
29
|
+
* @example
|
|
30
|
+
* ```cpp
|
|
31
|
+
* class HybridUiManagerHelper: public HybridUiManagerHelperSpec {
|
|
32
|
+
* public:
|
|
33
|
+
* HybridUiManagerHelper(...): HybridObject(TAG) { ... }
|
|
34
|
+
* // ...
|
|
35
|
+
* };
|
|
36
|
+
* ```
|
|
37
|
+
*/
|
|
38
|
+
class HybridUiManagerHelperSpec: public virtual HybridObject {
|
|
39
|
+
public:
|
|
40
|
+
// Constructor
|
|
41
|
+
explicit HybridUiManagerHelperSpec(): HybridObject(TAG) { }
|
|
42
|
+
|
|
43
|
+
// Destructor
|
|
44
|
+
~HybridUiManagerHelperSpec() override = default;
|
|
45
|
+
|
|
46
|
+
public:
|
|
47
|
+
// Properties
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
public:
|
|
51
|
+
// Methods
|
|
52
|
+
virtual void completeRootSync(std::shared_ptr<facebook::react::UIManagerBinding> nativeFabricUIManager, double surfaceId, facebook::react::ShadowNode::UnsharedListOfShared childSet) = 0;
|
|
53
|
+
virtual void registerManagedSurface(double surfaceId) = 0;
|
|
54
|
+
virtual void unregisterManagedSurface(double surfaceId) = 0;
|
|
55
|
+
|
|
56
|
+
protected:
|
|
57
|
+
// Hybrid Setup
|
|
58
|
+
void loadHybridMethods() override;
|
|
59
|
+
|
|
60
|
+
protected:
|
|
61
|
+
// Tag for logging
|
|
62
|
+
static constexpr auto TAG = "UiManagerHelper";
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
} // namespace margelo::nitro::reactnativelist
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// HybridViewHolderSpec.cpp
|
|
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
|
+
#include "HybridViewHolderSpec.hpp"
|
|
9
|
+
|
|
10
|
+
namespace margelo::nitro::reactnativelist {
|
|
11
|
+
|
|
12
|
+
void HybridViewHolderSpec::loadHybridMethods() {
|
|
13
|
+
// load base methods/properties
|
|
14
|
+
HybridObject::loadHybridMethods();
|
|
15
|
+
// load custom methods/properties
|
|
16
|
+
registerHybrids(this, [](Prototype& prototype) {
|
|
17
|
+
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
} // namespace margelo::nitro::reactnativelist
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// HybridViewHolderSpec.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
|
+
#if __has_include(<NitroModules/HybridObject.hpp>)
|
|
11
|
+
#include <NitroModules/HybridObject.hpp>
|
|
12
|
+
#else
|
|
13
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
14
|
+
#endif
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
namespace margelo::nitro::reactnativelist {
|
|
21
|
+
|
|
22
|
+
using namespace margelo::nitro;
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* An abstract base class for `ViewHolder`
|
|
26
|
+
* Inherit this class to create instances of `HybridViewHolderSpec` in C++.
|
|
27
|
+
* You must explicitly call `HybridObject`'s constructor yourself, because it is virtual.
|
|
28
|
+
* @example
|
|
29
|
+
* ```cpp
|
|
30
|
+
* class HybridViewHolder: public HybridViewHolderSpec {
|
|
31
|
+
* public:
|
|
32
|
+
* HybridViewHolder(...): HybridObject(TAG) { ... }
|
|
33
|
+
* // ...
|
|
34
|
+
* };
|
|
35
|
+
* ```
|
|
36
|
+
*/
|
|
37
|
+
class HybridViewHolderSpec: public virtual HybridObject {
|
|
38
|
+
public:
|
|
39
|
+
// Constructor
|
|
40
|
+
explicit HybridViewHolderSpec(): HybridObject(TAG) { }
|
|
41
|
+
|
|
42
|
+
// Destructor
|
|
43
|
+
~HybridViewHolderSpec() override = default;
|
|
44
|
+
|
|
45
|
+
public:
|
|
46
|
+
// Properties
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
public:
|
|
50
|
+
// Methods
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
protected:
|
|
54
|
+
// Hybrid Setup
|
|
55
|
+
void loadHybridMethods() override;
|
|
56
|
+
|
|
57
|
+
protected:
|
|
58
|
+
// Tag for logging
|
|
59
|
+
static constexpr auto TAG = "ViewHolder";
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
} // namespace margelo::nitro::reactnativelist
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// NativeItemSizeEstimate.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
|
+
#if __has_include(<NitroModules/JSIConverter.hpp>)
|
|
11
|
+
#include <NitroModules/JSIConverter.hpp>
|
|
12
|
+
#else
|
|
13
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
14
|
+
#endif
|
|
15
|
+
#if __has_include(<NitroModules/NitroDefines.hpp>)
|
|
16
|
+
#include <NitroModules/NitroDefines.hpp>
|
|
17
|
+
#else
|
|
18
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
19
|
+
#endif
|
|
20
|
+
#if __has_include(<NitroModules/JSIHelpers.hpp>)
|
|
21
|
+
#include <NitroModules/JSIHelpers.hpp>
|
|
22
|
+
#else
|
|
23
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
24
|
+
#endif
|
|
25
|
+
#if __has_include(<NitroModules/PropNameIDCache.hpp>)
|
|
26
|
+
#include <NitroModules/PropNameIDCache.hpp>
|
|
27
|
+
#else
|
|
28
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
29
|
+
#endif
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
#include <optional>
|
|
34
|
+
|
|
35
|
+
namespace margelo::nitro::reactnativelist {
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* A struct which can be represented as a JavaScript object (NativeItemSizeEstimate).
|
|
39
|
+
*/
|
|
40
|
+
struct NativeItemSizeEstimate final {
|
|
41
|
+
public:
|
|
42
|
+
std::optional<double> width SWIFT_PRIVATE;
|
|
43
|
+
std::optional<double> height SWIFT_PRIVATE;
|
|
44
|
+
|
|
45
|
+
public:
|
|
46
|
+
NativeItemSizeEstimate() = default;
|
|
47
|
+
explicit NativeItemSizeEstimate(std::optional<double> width, std::optional<double> height): width(width), height(height) {}
|
|
48
|
+
|
|
49
|
+
public:
|
|
50
|
+
friend bool operator==(const NativeItemSizeEstimate& lhs, const NativeItemSizeEstimate& rhs) = default;
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
} // namespace margelo::nitro::reactnativelist
|
|
54
|
+
|
|
55
|
+
namespace margelo::nitro {
|
|
56
|
+
|
|
57
|
+
// C++ NativeItemSizeEstimate <> JS NativeItemSizeEstimate (object)
|
|
58
|
+
template <>
|
|
59
|
+
struct JSIConverter<margelo::nitro::reactnativelist::NativeItemSizeEstimate> final {
|
|
60
|
+
static inline margelo::nitro::reactnativelist::NativeItemSizeEstimate fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
|
|
61
|
+
jsi::Object obj = arg.asObject(runtime);
|
|
62
|
+
return margelo::nitro::reactnativelist::NativeItemSizeEstimate(
|
|
63
|
+
JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "width"))),
|
|
64
|
+
JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "height")))
|
|
65
|
+
);
|
|
66
|
+
}
|
|
67
|
+
static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::reactnativelist::NativeItemSizeEstimate& arg) {
|
|
68
|
+
jsi::Object obj(runtime);
|
|
69
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "width"), JSIConverter<std::optional<double>>::toJSI(runtime, arg.width));
|
|
70
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "height"), JSIConverter<std::optional<double>>::toJSI(runtime, arg.height));
|
|
71
|
+
return obj;
|
|
72
|
+
}
|
|
73
|
+
static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
|
|
74
|
+
if (!value.isObject()) {
|
|
75
|
+
return false;
|
|
76
|
+
}
|
|
77
|
+
jsi::Object obj = value.getObject(runtime);
|
|
78
|
+
if (!nitro::isPlainObject(runtime, obj)) {
|
|
79
|
+
return false;
|
|
80
|
+
}
|
|
81
|
+
if (!JSIConverter<std::optional<double>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "width")))) return false;
|
|
82
|
+
if (!JSIConverter<std::optional<double>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "height")))) return false;
|
|
83
|
+
return true;
|
|
84
|
+
}
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
} // namespace margelo::nitro
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// NativeLinearListLayoutConfig.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
|
+
#if __has_include(<NitroModules/JSIConverter.hpp>)
|
|
11
|
+
#include <NitroModules/JSIConverter.hpp>
|
|
12
|
+
#else
|
|
13
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
14
|
+
#endif
|
|
15
|
+
#if __has_include(<NitroModules/NitroDefines.hpp>)
|
|
16
|
+
#include <NitroModules/NitroDefines.hpp>
|
|
17
|
+
#else
|
|
18
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
19
|
+
#endif
|
|
20
|
+
#if __has_include(<NitroModules/JSIHelpers.hpp>)
|
|
21
|
+
#include <NitroModules/JSIHelpers.hpp>
|
|
22
|
+
#else
|
|
23
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
24
|
+
#endif
|
|
25
|
+
#if __has_include(<NitroModules/PropNameIDCache.hpp>)
|
|
26
|
+
#include <NitroModules/PropNameIDCache.hpp>
|
|
27
|
+
#else
|
|
28
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
29
|
+
#endif
|
|
30
|
+
|
|
31
|
+
// Forward declaration of `NativeLinearListLayoutIOSConfig` to properly resolve imports.
|
|
32
|
+
namespace margelo::nitro::reactnativelist { struct NativeLinearListLayoutIOSConfig; }
|
|
33
|
+
|
|
34
|
+
#include "NativeLinearListLayoutIOSConfig.hpp"
|
|
35
|
+
#include <optional>
|
|
36
|
+
|
|
37
|
+
namespace margelo::nitro::reactnativelist {
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* A struct which can be represented as a JavaScript object (NativeLinearListLayoutConfig).
|
|
41
|
+
*/
|
|
42
|
+
struct NativeLinearListLayoutConfig final {
|
|
43
|
+
public:
|
|
44
|
+
double topInset SWIFT_PRIVATE;
|
|
45
|
+
double bottomInset SWIFT_PRIVATE;
|
|
46
|
+
double itemSpacing SWIFT_PRIVATE;
|
|
47
|
+
double itemHorizontalInset SWIFT_PRIVATE;
|
|
48
|
+
double itemVerticalInset SWIFT_PRIVATE;
|
|
49
|
+
std::optional<NativeLinearListLayoutIOSConfig> iosConfig SWIFT_PRIVATE;
|
|
50
|
+
|
|
51
|
+
public:
|
|
52
|
+
NativeLinearListLayoutConfig() = default;
|
|
53
|
+
explicit NativeLinearListLayoutConfig(double topInset, double bottomInset, double itemSpacing, double itemHorizontalInset, double itemVerticalInset, std::optional<NativeLinearListLayoutIOSConfig> iosConfig): topInset(topInset), bottomInset(bottomInset), itemSpacing(itemSpacing), itemHorizontalInset(itemHorizontalInset), itemVerticalInset(itemVerticalInset), iosConfig(iosConfig) {}
|
|
54
|
+
|
|
55
|
+
public:
|
|
56
|
+
friend bool operator==(const NativeLinearListLayoutConfig& lhs, const NativeLinearListLayoutConfig& rhs) = default;
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
} // namespace margelo::nitro::reactnativelist
|
|
60
|
+
|
|
61
|
+
namespace margelo::nitro {
|
|
62
|
+
|
|
63
|
+
// C++ NativeLinearListLayoutConfig <> JS NativeLinearListLayoutConfig (object)
|
|
64
|
+
template <>
|
|
65
|
+
struct JSIConverter<margelo::nitro::reactnativelist::NativeLinearListLayoutConfig> final {
|
|
66
|
+
static inline margelo::nitro::reactnativelist::NativeLinearListLayoutConfig fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
|
|
67
|
+
jsi::Object obj = arg.asObject(runtime);
|
|
68
|
+
return margelo::nitro::reactnativelist::NativeLinearListLayoutConfig(
|
|
69
|
+
JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "topInset"))),
|
|
70
|
+
JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "bottomInset"))),
|
|
71
|
+
JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "itemSpacing"))),
|
|
72
|
+
JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "itemHorizontalInset"))),
|
|
73
|
+
JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "itemVerticalInset"))),
|
|
74
|
+
JSIConverter<std::optional<margelo::nitro::reactnativelist::NativeLinearListLayoutIOSConfig>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "iosConfig")))
|
|
75
|
+
);
|
|
76
|
+
}
|
|
77
|
+
static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::reactnativelist::NativeLinearListLayoutConfig& arg) {
|
|
78
|
+
jsi::Object obj(runtime);
|
|
79
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "topInset"), JSIConverter<double>::toJSI(runtime, arg.topInset));
|
|
80
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "bottomInset"), JSIConverter<double>::toJSI(runtime, arg.bottomInset));
|
|
81
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "itemSpacing"), JSIConverter<double>::toJSI(runtime, arg.itemSpacing));
|
|
82
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "itemHorizontalInset"), JSIConverter<double>::toJSI(runtime, arg.itemHorizontalInset));
|
|
83
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "itemVerticalInset"), JSIConverter<double>::toJSI(runtime, arg.itemVerticalInset));
|
|
84
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "iosConfig"), JSIConverter<std::optional<margelo::nitro::reactnativelist::NativeLinearListLayoutIOSConfig>>::toJSI(runtime, arg.iosConfig));
|
|
85
|
+
return obj;
|
|
86
|
+
}
|
|
87
|
+
static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
|
|
88
|
+
if (!value.isObject()) {
|
|
89
|
+
return false;
|
|
90
|
+
}
|
|
91
|
+
jsi::Object obj = value.getObject(runtime);
|
|
92
|
+
if (!nitro::isPlainObject(runtime, obj)) {
|
|
93
|
+
return false;
|
|
94
|
+
}
|
|
95
|
+
if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "topInset")))) return false;
|
|
96
|
+
if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "bottomInset")))) return false;
|
|
97
|
+
if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "itemSpacing")))) return false;
|
|
98
|
+
if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "itemHorizontalInset")))) return false;
|
|
99
|
+
if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "itemVerticalInset")))) return false;
|
|
100
|
+
if (!JSIConverter<std::optional<margelo::nitro::reactnativelist::NativeLinearListLayoutIOSConfig>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "iosConfig")))) return false;
|
|
101
|
+
return true;
|
|
102
|
+
}
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
} // namespace margelo::nitro
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// NativeLinearListLayoutIOSConfig.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
|
+
#if __has_include(<NitroModules/JSIConverter.hpp>)
|
|
11
|
+
#include <NitroModules/JSIConverter.hpp>
|
|
12
|
+
#else
|
|
13
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
14
|
+
#endif
|
|
15
|
+
#if __has_include(<NitroModules/NitroDefines.hpp>)
|
|
16
|
+
#include <NitroModules/NitroDefines.hpp>
|
|
17
|
+
#else
|
|
18
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
19
|
+
#endif
|
|
20
|
+
#if __has_include(<NitroModules/JSIHelpers.hpp>)
|
|
21
|
+
#include <NitroModules/JSIHelpers.hpp>
|
|
22
|
+
#else
|
|
23
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
24
|
+
#endif
|
|
25
|
+
#if __has_include(<NitroModules/PropNameIDCache.hpp>)
|
|
26
|
+
#include <NitroModules/PropNameIDCache.hpp>
|
|
27
|
+
#else
|
|
28
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
29
|
+
#endif
|
|
30
|
+
|
|
31
|
+
// Forward declaration of `NativeItemSizeEstimate` to properly resolve imports.
|
|
32
|
+
namespace margelo::nitro::reactnativelist { struct NativeItemSizeEstimate; }
|
|
33
|
+
|
|
34
|
+
#include "NativeItemSizeEstimate.hpp"
|
|
35
|
+
#include <optional>
|
|
36
|
+
|
|
37
|
+
namespace margelo::nitro::reactnativelist {
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* A struct which can be represented as a JavaScript object (NativeLinearListLayoutIOSConfig).
|
|
41
|
+
*/
|
|
42
|
+
struct NativeLinearListLayoutIOSConfig final {
|
|
43
|
+
public:
|
|
44
|
+
std::optional<NativeItemSizeEstimate> estimatedItemSize SWIFT_PRIVATE;
|
|
45
|
+
|
|
46
|
+
public:
|
|
47
|
+
NativeLinearListLayoutIOSConfig() = default;
|
|
48
|
+
explicit NativeLinearListLayoutIOSConfig(std::optional<NativeItemSizeEstimate> estimatedItemSize): estimatedItemSize(estimatedItemSize) {}
|
|
49
|
+
|
|
50
|
+
public:
|
|
51
|
+
friend bool operator==(const NativeLinearListLayoutIOSConfig& lhs, const NativeLinearListLayoutIOSConfig& rhs) = default;
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
} // namespace margelo::nitro::reactnativelist
|
|
55
|
+
|
|
56
|
+
namespace margelo::nitro {
|
|
57
|
+
|
|
58
|
+
// C++ NativeLinearListLayoutIOSConfig <> JS NativeLinearListLayoutIOSConfig (object)
|
|
59
|
+
template <>
|
|
60
|
+
struct JSIConverter<margelo::nitro::reactnativelist::NativeLinearListLayoutIOSConfig> final {
|
|
61
|
+
static inline margelo::nitro::reactnativelist::NativeLinearListLayoutIOSConfig fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
|
|
62
|
+
jsi::Object obj = arg.asObject(runtime);
|
|
63
|
+
return margelo::nitro::reactnativelist::NativeLinearListLayoutIOSConfig(
|
|
64
|
+
JSIConverter<std::optional<margelo::nitro::reactnativelist::NativeItemSizeEstimate>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "estimatedItemSize")))
|
|
65
|
+
);
|
|
66
|
+
}
|
|
67
|
+
static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::reactnativelist::NativeLinearListLayoutIOSConfig& arg) {
|
|
68
|
+
jsi::Object obj(runtime);
|
|
69
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "estimatedItemSize"), JSIConverter<std::optional<margelo::nitro::reactnativelist::NativeItemSizeEstimate>>::toJSI(runtime, arg.estimatedItemSize));
|
|
70
|
+
return obj;
|
|
71
|
+
}
|
|
72
|
+
static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
|
|
73
|
+
if (!value.isObject()) {
|
|
74
|
+
return false;
|
|
75
|
+
}
|
|
76
|
+
jsi::Object obj = value.getObject(runtime);
|
|
77
|
+
if (!nitro::isPlainObject(runtime, obj)) {
|
|
78
|
+
return false;
|
|
79
|
+
}
|
|
80
|
+
if (!JSIConverter<std::optional<margelo::nitro::reactnativelist::NativeItemSizeEstimate>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "estimatedItemSize")))) return false;
|
|
81
|
+
return true;
|
|
82
|
+
}
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
} // namespace margelo::nitro
|