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,66 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
function isReactNativeRuntime() {
|
|
4
|
+
return global.__RUNTIME_KIND === 1
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
let cachedReactNativeRendererProxy
|
|
8
|
+
function getReactNativeRendererProxy() {
|
|
9
|
+
if (cachedReactNativeRendererProxy == null) {
|
|
10
|
+
// Intentionally lazy: avoid loading the default RN renderer in non-RN runtimes.
|
|
11
|
+
// eslint-disable-next-line @react-native/no-deep-imports
|
|
12
|
+
cachedReactNativeRendererProxy = require('react-native/Libraries/ReactNative/RendererProxy')
|
|
13
|
+
}
|
|
14
|
+
return cachedReactNativeRendererProxy
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
function getNodeFromInternalInstanceHandle(internalInstanceHandle) {
|
|
18
|
+
if (isReactNativeRuntime()) {
|
|
19
|
+
return getReactNativeRendererProxy().getNodeFromInternalInstanceHandle(
|
|
20
|
+
internalInstanceHandle
|
|
21
|
+
)
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
const stateNode = internalInstanceHandle?.stateNode
|
|
25
|
+
if (stateNode == null) {
|
|
26
|
+
return null
|
|
27
|
+
}
|
|
28
|
+
return stateNode.node ?? stateNode
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
function getPublicInstanceFromInternalInstanceHandle(internalInstanceHandle) {
|
|
32
|
+
if (isReactNativeRuntime()) {
|
|
33
|
+
return getReactNativeRendererProxy().getPublicInstanceFromInternalInstanceHandle(
|
|
34
|
+
internalInstanceHandle
|
|
35
|
+
)
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
const stateNode = internalInstanceHandle?.stateNode
|
|
39
|
+
if (stateNode == null) {
|
|
40
|
+
return null
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
if (stateNode.canonical?.publicInstance != null) {
|
|
44
|
+
return stateNode.canonical.publicInstance
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
return stateNode.node ?? stateNode
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
function getPublicInstanceFromRootTag(rootTag) {
|
|
51
|
+
if (isReactNativeRuntime()) {
|
|
52
|
+
return getReactNativeRendererProxy().getPublicInstanceFromRootTag(rootTag)
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
if (global.rootInstance?.containerTag === Number(rootTag)) {
|
|
56
|
+
return global.rootInstance.publicInstance ?? null
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
return null
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
module.exports = {
|
|
63
|
+
getNodeFromInternalInstanceHandle,
|
|
64
|
+
getPublicInstanceFromInternalInstanceHandle,
|
|
65
|
+
getPublicInstanceFromRootTag,
|
|
66
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export function getReactNativeListMetroConfig<TConfig>(config: TConfig): TConfig
|
package/metro-config.js
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
const path = require('path')
|
|
4
|
+
|
|
5
|
+
const rendererProxyThreadSwitchPath = path.resolve(
|
|
6
|
+
__dirname,
|
|
7
|
+
'metro/RendererProxyThreadSwitch.js'
|
|
8
|
+
)
|
|
9
|
+
|
|
10
|
+
function isRendererProxyImport(moduleName) {
|
|
11
|
+
return /(?:^|\/)RendererProxy(?:\.js)?$/.test(moduleName)
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
function isReactNativeDomInternalsImporter(originModulePath) {
|
|
15
|
+
if (typeof originModulePath !== 'string') {
|
|
16
|
+
return false
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
return originModulePath.includes(
|
|
20
|
+
`${path.sep}node_modules${path.sep}react-native${path.sep}src${path.sep}private${path.sep}webapis${path.sep}dom${path.sep}nodes${path.sep}internals${path.sep}`
|
|
21
|
+
)
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
function getReactNativeListMetroConfig(config) {
|
|
25
|
+
config.resolver = config.resolver || {}
|
|
26
|
+
const currentResolveRequest = config.resolver.resolveRequest
|
|
27
|
+
|
|
28
|
+
config.resolver.resolveRequest = (context, moduleName, platform) => {
|
|
29
|
+
// Redirect only React Native DOM internals to a runtime-switching proxy.
|
|
30
|
+
if (
|
|
31
|
+
isRendererProxyImport(moduleName) &&
|
|
32
|
+
isReactNativeDomInternalsImporter(context.originModulePath)
|
|
33
|
+
) {
|
|
34
|
+
return {
|
|
35
|
+
type: 'sourceFile',
|
|
36
|
+
filePath: rendererProxyThreadSwitchPath,
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
return (currentResolveRequest || context.resolveRequest)(
|
|
41
|
+
context,
|
|
42
|
+
moduleName,
|
|
43
|
+
platform
|
|
44
|
+
)
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
return config
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
module.exports = {
|
|
51
|
+
getReactNativeListMetroConfig,
|
|
52
|
+
}
|
package/nitro.json
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://nitro.margelo.com/nitro.schema.json",
|
|
3
|
+
"cxxNamespace": [
|
|
4
|
+
"reactnativelist"
|
|
5
|
+
],
|
|
6
|
+
"ios": {
|
|
7
|
+
"iosModuleName": "ReactNativeList"
|
|
8
|
+
},
|
|
9
|
+
"android": {
|
|
10
|
+
"androidNamespace": [
|
|
11
|
+
"reactnativelist"
|
|
12
|
+
],
|
|
13
|
+
"androidCxxLibName": "ReactNativeList"
|
|
14
|
+
},
|
|
15
|
+
"autolinking": {
|
|
16
|
+
"ViewHolder": {
|
|
17
|
+
"kotlin": "HybridViewHolder",
|
|
18
|
+
"swift": "HybridViewHolder"
|
|
19
|
+
},
|
|
20
|
+
"UiListView": {
|
|
21
|
+
"kotlin": "HybridUiListView",
|
|
22
|
+
"swift": "HybridUiListView"
|
|
23
|
+
},
|
|
24
|
+
"NativeListDataSource": {
|
|
25
|
+
"kotlin": "HybridNativeListDataSource",
|
|
26
|
+
"swift": "HybridNativeListDataSource"
|
|
27
|
+
},
|
|
28
|
+
"NativeListLayout": {
|
|
29
|
+
"kotlin": "HybridNativeListLayout",
|
|
30
|
+
"swift": "HybridNativeListLayout"
|
|
31
|
+
},
|
|
32
|
+
"NativeLinearListLayout": {
|
|
33
|
+
"kotlin": "HybridNativeLinearListLayout",
|
|
34
|
+
"swift": "HybridNativeLinearListLayout"
|
|
35
|
+
},
|
|
36
|
+
"UiListModule": {
|
|
37
|
+
"kotlin": "HybridUiListModule",
|
|
38
|
+
"swift": "HybridUiListModule"
|
|
39
|
+
},
|
|
40
|
+
"UiManagerHelper": {
|
|
41
|
+
"cpp": "HybridUiManagerHelper"
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
"ignorePaths": [
|
|
45
|
+
"**/node_modules"
|
|
46
|
+
]
|
|
47
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
** linguist-generated=true
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
#
|
|
2
|
+
# ReactNativeList+autolinking.cmake
|
|
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
|
+
# This is a CMake file that adds all files generated by Nitrogen
|
|
9
|
+
# to the current CMake project.
|
|
10
|
+
#
|
|
11
|
+
# To use it, add this to your CMakeLists.txt:
|
|
12
|
+
# ```cmake
|
|
13
|
+
# include(${CMAKE_SOURCE_DIR}/../nitrogen/generated/android/ReactNativeList+autolinking.cmake)
|
|
14
|
+
# ```
|
|
15
|
+
|
|
16
|
+
# Define a flag to check if we are building properly
|
|
17
|
+
add_definitions(-DBUILDING_REACTNATIVELIST_WITH_GENERATED_CMAKE_PROJECT)
|
|
18
|
+
|
|
19
|
+
# Enable Raw Props parsing in react-native (for Nitro Views)
|
|
20
|
+
add_definitions(-DRN_SERIALIZABLE_STATE)
|
|
21
|
+
|
|
22
|
+
# Add all headers that were generated by Nitrogen
|
|
23
|
+
include_directories(
|
|
24
|
+
"../nitrogen/generated/shared/c++"
|
|
25
|
+
"../nitrogen/generated/android/c++"
|
|
26
|
+
"../nitrogen/generated/android/"
|
|
27
|
+
)
|
|
28
|
+
|
|
29
|
+
# Add all .cpp sources that were generated by Nitrogen
|
|
30
|
+
target_sources(
|
|
31
|
+
# CMake project name (Android C++ library name)
|
|
32
|
+
ReactNativeList PRIVATE
|
|
33
|
+
# Autolinking Setup
|
|
34
|
+
../nitrogen/generated/android/ReactNativeListOnLoad.cpp
|
|
35
|
+
# Shared Nitrogen C++ sources
|
|
36
|
+
../nitrogen/generated/shared/c++/HybridIOSWorkletsModuleProxyHolderSpec.cpp
|
|
37
|
+
../nitrogen/generated/shared/c++/HybridNativeLinearListLayoutSpec.cpp
|
|
38
|
+
../nitrogen/generated/shared/c++/HybridNativeListDataSourceSpec.cpp
|
|
39
|
+
../nitrogen/generated/shared/c++/HybridNativeListLayoutSpec.cpp
|
|
40
|
+
../nitrogen/generated/shared/c++/HybridUiListModuleSpec.cpp
|
|
41
|
+
../nitrogen/generated/shared/c++/HybridUiListViewSpec.cpp
|
|
42
|
+
../nitrogen/generated/shared/c++/views/HybridUiListViewComponent.cpp
|
|
43
|
+
../nitrogen/generated/shared/c++/HybridUiManagerHelperSpec.cpp
|
|
44
|
+
../nitrogen/generated/shared/c++/HybridViewHolderSpec.cpp
|
|
45
|
+
../nitrogen/generated/shared/c++/views/HybridViewHolderComponent.cpp
|
|
46
|
+
# Android-specific Nitrogen C++ sources
|
|
47
|
+
../nitrogen/generated/android/c++/JHybridIOSWorkletsModuleProxyHolderSpec.cpp
|
|
48
|
+
../nitrogen/generated/android/c++/JHybridNativeLinearListLayoutSpec.cpp
|
|
49
|
+
../nitrogen/generated/android/c++/JHybridNativeListDataSourceSpec.cpp
|
|
50
|
+
../nitrogen/generated/android/c++/JHybridNativeListLayoutSpec.cpp
|
|
51
|
+
../nitrogen/generated/android/c++/JHybridUiListModuleSpec.cpp
|
|
52
|
+
../nitrogen/generated/android/c++/JVariant_NullType_HybridIOSWorkletsModuleProxyHolderSpec.cpp
|
|
53
|
+
../nitrogen/generated/android/c++/JHybridUiListViewSpec.cpp
|
|
54
|
+
../nitrogen/generated/android/c++/views/JHybridUiListViewStateUpdater.cpp
|
|
55
|
+
../nitrogen/generated/android/c++/JHybridViewHolderSpec.cpp
|
|
56
|
+
../nitrogen/generated/android/c++/views/JHybridViewHolderStateUpdater.cpp
|
|
57
|
+
)
|
|
58
|
+
|
|
59
|
+
# From node_modules/react-native/ReactAndroid/cmake-utils/folly-flags.cmake
|
|
60
|
+
# Used in node_modules/react-native/ReactAndroid/cmake-utils/ReactNative-application.cmake
|
|
61
|
+
target_compile_definitions(
|
|
62
|
+
ReactNativeList PRIVATE
|
|
63
|
+
-DFOLLY_NO_CONFIG=1
|
|
64
|
+
-DFOLLY_HAVE_CLOCK_GETTIME=1
|
|
65
|
+
-DFOLLY_USE_LIBCPP=1
|
|
66
|
+
-DFOLLY_CFG_NO_COROUTINES=1
|
|
67
|
+
-DFOLLY_MOBILE=1
|
|
68
|
+
-DFOLLY_HAVE_RECVMMSG=1
|
|
69
|
+
-DFOLLY_HAVE_PTHREAD=1
|
|
70
|
+
# Once we target android-23 above, we can comment
|
|
71
|
+
# the following line. NDK uses GNU style stderror_r() after API 23.
|
|
72
|
+
-DFOLLY_HAVE_XSI_STRERROR_R=1
|
|
73
|
+
)
|
|
74
|
+
|
|
75
|
+
# Add all libraries required by the generated specs
|
|
76
|
+
find_package(fbjni REQUIRED) # <-- Used for communication between Java <-> C++
|
|
77
|
+
find_package(ReactAndroid REQUIRED) # <-- Used to set up React Native bindings (e.g. CallInvoker/TurboModule)
|
|
78
|
+
find_package(react-native-nitro-modules REQUIRED) # <-- Used to create all HybridObjects and use the Nitro core library
|
|
79
|
+
|
|
80
|
+
# Link all libraries together
|
|
81
|
+
target_link_libraries(
|
|
82
|
+
ReactNativeList
|
|
83
|
+
fbjni::fbjni # <-- Facebook C++ JNI helpers
|
|
84
|
+
ReactAndroid::jsi # <-- RN: JSI
|
|
85
|
+
react-native-nitro-modules::NitroModules # <-- NitroModules Core :)
|
|
86
|
+
)
|
|
87
|
+
|
|
88
|
+
# Link react-native (different prefab between RN 0.75 and RN 0.76)
|
|
89
|
+
if(ReactAndroid_VERSION_MINOR GREATER_EQUAL 76)
|
|
90
|
+
target_link_libraries(
|
|
91
|
+
ReactNativeList
|
|
92
|
+
ReactAndroid::reactnative # <-- RN: Native Modules umbrella prefab
|
|
93
|
+
)
|
|
94
|
+
else()
|
|
95
|
+
target_link_libraries(
|
|
96
|
+
ReactNativeList
|
|
97
|
+
ReactAndroid::react_nativemodule_core # <-- RN: TurboModules Core
|
|
98
|
+
)
|
|
99
|
+
endif()
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// ReactNativeList+autolinking.gradle
|
|
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
|
+
/// This is a Gradle file that adds all files generated by Nitrogen
|
|
9
|
+
/// to the current Gradle project.
|
|
10
|
+
///
|
|
11
|
+
/// To use it, add this to your build.gradle:
|
|
12
|
+
/// ```gradle
|
|
13
|
+
/// apply from: '../nitrogen/generated/android/ReactNativeList+autolinking.gradle'
|
|
14
|
+
/// ```
|
|
15
|
+
|
|
16
|
+
logger.warn("[NitroModules] 🔥 ReactNativeList is boosted by nitro!")
|
|
17
|
+
|
|
18
|
+
android {
|
|
19
|
+
sourceSets {
|
|
20
|
+
main {
|
|
21
|
+
java.srcDirs += [
|
|
22
|
+
// Nitrogen files
|
|
23
|
+
"${project.projectDir}/../nitrogen/generated/android/kotlin"
|
|
24
|
+
]
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// ReactNativeListOnLoad.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
|
+
#ifndef BUILDING_REACTNATIVELIST_WITH_GENERATED_CMAKE_PROJECT
|
|
9
|
+
#error ReactNativeListOnLoad.cpp is not being built with the autogenerated CMakeLists.txt project. Is a different CMakeLists.txt building this?
|
|
10
|
+
#endif
|
|
11
|
+
|
|
12
|
+
#include "ReactNativeListOnLoad.hpp"
|
|
13
|
+
|
|
14
|
+
#include <jni.h>
|
|
15
|
+
#include <fbjni/fbjni.h>
|
|
16
|
+
#include <NitroModules/HybridObjectRegistry.hpp>
|
|
17
|
+
|
|
18
|
+
#include "JHybridIOSWorkletsModuleProxyHolderSpec.hpp"
|
|
19
|
+
#include "JHybridNativeLinearListLayoutSpec.hpp"
|
|
20
|
+
#include "JHybridNativeListDataSourceSpec.hpp"
|
|
21
|
+
#include "JFunc_bool_NativeListItem_NativeListItem.hpp"
|
|
22
|
+
#include "JHybridNativeListLayoutSpec.hpp"
|
|
23
|
+
#include "JHybridUiListModuleSpec.hpp"
|
|
24
|
+
#include "JHybridUiListViewSpec.hpp"
|
|
25
|
+
#include "JFunc_double_std__string.hpp"
|
|
26
|
+
#include "JFunc_bool_double_NativeListItem_double.hpp"
|
|
27
|
+
#include "views/JHybridUiListViewStateUpdater.hpp"
|
|
28
|
+
#include "JHybridViewHolderSpec.hpp"
|
|
29
|
+
#include "views/JHybridViewHolderStateUpdater.hpp"
|
|
30
|
+
#include <NitroModules/DefaultConstructableObject.hpp>
|
|
31
|
+
#include "HybridUiManagerHelper.hpp"
|
|
32
|
+
|
|
33
|
+
namespace margelo::nitro::reactnativelist {
|
|
34
|
+
|
|
35
|
+
int initialize(JavaVM* vm) {
|
|
36
|
+
return facebook::jni::initialize(vm, []() {
|
|
37
|
+
::margelo::nitro::reactnativelist::registerAllNatives();
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
struct JHybridViewHolderSpecImpl: public jni::JavaClass<JHybridViewHolderSpecImpl, JHybridViewHolderSpec::JavaPart> {
|
|
42
|
+
static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/reactnativelist/HybridViewHolder;";
|
|
43
|
+
static std::shared_ptr<JHybridViewHolderSpec> create() {
|
|
44
|
+
static const auto constructorFn = javaClassStatic()->getConstructor<JHybridViewHolderSpecImpl::javaobject()>();
|
|
45
|
+
jni::local_ref<JHybridViewHolderSpec::JavaPart> javaPart = javaClassStatic()->newObject(constructorFn);
|
|
46
|
+
return javaPart->getJHybridViewHolderSpec();
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
struct JHybridUiListViewSpecImpl: public jni::JavaClass<JHybridUiListViewSpecImpl, JHybridUiListViewSpec::JavaPart> {
|
|
50
|
+
static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/reactnativelist/HybridUiListView;";
|
|
51
|
+
static std::shared_ptr<JHybridUiListViewSpec> create() {
|
|
52
|
+
static const auto constructorFn = javaClassStatic()->getConstructor<JHybridUiListViewSpecImpl::javaobject()>();
|
|
53
|
+
jni::local_ref<JHybridUiListViewSpec::JavaPart> javaPart = javaClassStatic()->newObject(constructorFn);
|
|
54
|
+
return javaPart->getJHybridUiListViewSpec();
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
struct JHybridNativeListDataSourceSpecImpl: public jni::JavaClass<JHybridNativeListDataSourceSpecImpl, JHybridNativeListDataSourceSpec::JavaPart> {
|
|
58
|
+
static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/reactnativelist/HybridNativeListDataSource;";
|
|
59
|
+
static std::shared_ptr<JHybridNativeListDataSourceSpec> create() {
|
|
60
|
+
static const auto constructorFn = javaClassStatic()->getConstructor<JHybridNativeListDataSourceSpecImpl::javaobject()>();
|
|
61
|
+
jni::local_ref<JHybridNativeListDataSourceSpec::JavaPart> javaPart = javaClassStatic()->newObject(constructorFn);
|
|
62
|
+
return javaPart->getJHybridNativeListDataSourceSpec();
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
struct JHybridNativeListLayoutSpecImpl: public jni::JavaClass<JHybridNativeListLayoutSpecImpl, JHybridNativeListLayoutSpec::JavaPart> {
|
|
66
|
+
static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/reactnativelist/HybridNativeListLayout;";
|
|
67
|
+
static std::shared_ptr<JHybridNativeListLayoutSpec> create() {
|
|
68
|
+
static const auto constructorFn = javaClassStatic()->getConstructor<JHybridNativeListLayoutSpecImpl::javaobject()>();
|
|
69
|
+
jni::local_ref<JHybridNativeListLayoutSpec::JavaPart> javaPart = javaClassStatic()->newObject(constructorFn);
|
|
70
|
+
return javaPart->getJHybridNativeListLayoutSpec();
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
struct JHybridNativeLinearListLayoutSpecImpl: public jni::JavaClass<JHybridNativeLinearListLayoutSpecImpl, JHybridNativeLinearListLayoutSpec::JavaPart> {
|
|
74
|
+
static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/reactnativelist/HybridNativeLinearListLayout;";
|
|
75
|
+
static std::shared_ptr<JHybridNativeLinearListLayoutSpec> create() {
|
|
76
|
+
static const auto constructorFn = javaClassStatic()->getConstructor<JHybridNativeLinearListLayoutSpecImpl::javaobject()>();
|
|
77
|
+
jni::local_ref<JHybridNativeLinearListLayoutSpec::JavaPart> javaPart = javaClassStatic()->newObject(constructorFn);
|
|
78
|
+
return javaPart->getJHybridNativeLinearListLayoutSpec();
|
|
79
|
+
}
|
|
80
|
+
};
|
|
81
|
+
struct JHybridUiListModuleSpecImpl: public jni::JavaClass<JHybridUiListModuleSpecImpl, JHybridUiListModuleSpec::JavaPart> {
|
|
82
|
+
static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/reactnativelist/HybridUiListModule;";
|
|
83
|
+
static std::shared_ptr<JHybridUiListModuleSpec> create() {
|
|
84
|
+
static const auto constructorFn = javaClassStatic()->getConstructor<JHybridUiListModuleSpecImpl::javaobject()>();
|
|
85
|
+
jni::local_ref<JHybridUiListModuleSpec::JavaPart> javaPart = javaClassStatic()->newObject(constructorFn);
|
|
86
|
+
return javaPart->getJHybridUiListModuleSpec();
|
|
87
|
+
}
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
void registerAllNatives() {
|
|
91
|
+
using namespace margelo::nitro;
|
|
92
|
+
using namespace margelo::nitro::reactnativelist;
|
|
93
|
+
|
|
94
|
+
// Register native JNI methods
|
|
95
|
+
margelo::nitro::reactnativelist::JHybridIOSWorkletsModuleProxyHolderSpec::CxxPart::registerNatives();
|
|
96
|
+
margelo::nitro::reactnativelist::JHybridNativeLinearListLayoutSpec::CxxPart::registerNatives();
|
|
97
|
+
margelo::nitro::reactnativelist::JHybridNativeListDataSourceSpec::CxxPart::registerNatives();
|
|
98
|
+
margelo::nitro::reactnativelist::JFunc_bool_NativeListItem_NativeListItem_cxx::registerNatives();
|
|
99
|
+
margelo::nitro::reactnativelist::JHybridNativeListLayoutSpec::CxxPart::registerNatives();
|
|
100
|
+
margelo::nitro::reactnativelist::JHybridUiListModuleSpec::CxxPart::registerNatives();
|
|
101
|
+
margelo::nitro::reactnativelist::JHybridUiListViewSpec::CxxPart::registerNatives();
|
|
102
|
+
margelo::nitro::reactnativelist::JFunc_double_std__string_cxx::registerNatives();
|
|
103
|
+
margelo::nitro::reactnativelist::JFunc_bool_double_NativeListItem_double_cxx::registerNatives();
|
|
104
|
+
margelo::nitro::reactnativelist::views::JHybridUiListViewStateUpdater::registerNatives();
|
|
105
|
+
margelo::nitro::reactnativelist::JHybridViewHolderSpec::CxxPart::registerNatives();
|
|
106
|
+
margelo::nitro::reactnativelist::views::JHybridViewHolderStateUpdater::registerNatives();
|
|
107
|
+
|
|
108
|
+
// Register Nitro Hybrid Objects
|
|
109
|
+
HybridObjectRegistry::registerHybridObjectConstructor(
|
|
110
|
+
"ViewHolder",
|
|
111
|
+
[]() -> std::shared_ptr<HybridObject> {
|
|
112
|
+
return JHybridViewHolderSpecImpl::create();
|
|
113
|
+
}
|
|
114
|
+
);
|
|
115
|
+
HybridObjectRegistry::registerHybridObjectConstructor(
|
|
116
|
+
"UiListView",
|
|
117
|
+
[]() -> std::shared_ptr<HybridObject> {
|
|
118
|
+
return JHybridUiListViewSpecImpl::create();
|
|
119
|
+
}
|
|
120
|
+
);
|
|
121
|
+
HybridObjectRegistry::registerHybridObjectConstructor(
|
|
122
|
+
"NativeListDataSource",
|
|
123
|
+
[]() -> std::shared_ptr<HybridObject> {
|
|
124
|
+
return JHybridNativeListDataSourceSpecImpl::create();
|
|
125
|
+
}
|
|
126
|
+
);
|
|
127
|
+
HybridObjectRegistry::registerHybridObjectConstructor(
|
|
128
|
+
"NativeListLayout",
|
|
129
|
+
[]() -> std::shared_ptr<HybridObject> {
|
|
130
|
+
return JHybridNativeListLayoutSpecImpl::create();
|
|
131
|
+
}
|
|
132
|
+
);
|
|
133
|
+
HybridObjectRegistry::registerHybridObjectConstructor(
|
|
134
|
+
"NativeLinearListLayout",
|
|
135
|
+
[]() -> std::shared_ptr<HybridObject> {
|
|
136
|
+
return JHybridNativeLinearListLayoutSpecImpl::create();
|
|
137
|
+
}
|
|
138
|
+
);
|
|
139
|
+
HybridObjectRegistry::registerHybridObjectConstructor(
|
|
140
|
+
"UiListModule",
|
|
141
|
+
[]() -> std::shared_ptr<HybridObject> {
|
|
142
|
+
return JHybridUiListModuleSpecImpl::create();
|
|
143
|
+
}
|
|
144
|
+
);
|
|
145
|
+
HybridObjectRegistry::registerHybridObjectConstructor(
|
|
146
|
+
"UiManagerHelper",
|
|
147
|
+
[]() -> std::shared_ptr<HybridObject> {
|
|
148
|
+
static_assert(std::is_default_constructible_v<HybridUiManagerHelper>,
|
|
149
|
+
"The HybridObject \"HybridUiManagerHelper\" is not default-constructible! "
|
|
150
|
+
"Create a public constructor that takes zero arguments to be able to autolink this HybridObject.");
|
|
151
|
+
return std::make_shared<HybridUiManagerHelper>();
|
|
152
|
+
}
|
|
153
|
+
);
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
} // namespace margelo::nitro::reactnativelist
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// ReactNativeListOnLoad.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
|
+
#include <jni.h>
|
|
9
|
+
#include <functional>
|
|
10
|
+
#include <NitroModules/NitroDefines.hpp>
|
|
11
|
+
|
|
12
|
+
namespace margelo::nitro::reactnativelist {
|
|
13
|
+
|
|
14
|
+
[[deprecated("Use registerNatives() instead.")]]
|
|
15
|
+
int initialize(JavaVM* vm);
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Register the native (C++) part of ReactNativeList, and autolinks all Hybrid Objects.
|
|
19
|
+
* Call this in your `JNI_OnLoad` function (probably inside `cpp-adapter.cpp`),
|
|
20
|
+
* inside a `facebook::jni::initialize(vm, ...)` call.
|
|
21
|
+
* Example:
|
|
22
|
+
* ```cpp (cpp-adapter.cpp)
|
|
23
|
+
* JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM* vm, void*) {
|
|
24
|
+
* return facebook::jni::initialize(vm, []() {
|
|
25
|
+
* // register all ReactNativeList HybridObjects
|
|
26
|
+
* margelo::nitro::reactnativelist::registerNatives();
|
|
27
|
+
* // any other custom registrations go here.
|
|
28
|
+
* });
|
|
29
|
+
* }
|
|
30
|
+
* ```
|
|
31
|
+
*/
|
|
32
|
+
void registerAllNatives();
|
|
33
|
+
|
|
34
|
+
} // namespace margelo::nitro::reactnativelist
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// JFunc_bool_NativeListItem_NativeListItem.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 <fbjni/fbjni.h>
|
|
11
|
+
#include <functional>
|
|
12
|
+
|
|
13
|
+
#include "NativeListItem.hpp"
|
|
14
|
+
#include <functional>
|
|
15
|
+
#include <NitroModules/JNICallable.hpp>
|
|
16
|
+
#include "JNativeListItem.hpp"
|
|
17
|
+
#include <string>
|
|
18
|
+
#include <optional>
|
|
19
|
+
#include <NitroModules/AnyMap.hpp>
|
|
20
|
+
#include <NitroModules/JAnyMap.hpp>
|
|
21
|
+
|
|
22
|
+
namespace margelo::nitro::reactnativelist {
|
|
23
|
+
|
|
24
|
+
using namespace facebook;
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Represents the Java/Kotlin callback `(oldItem: NativeListItem, newItem: NativeListItem) -> Boolean`.
|
|
28
|
+
* This can be passed around between C++ and Java/Kotlin.
|
|
29
|
+
*/
|
|
30
|
+
struct JFunc_bool_NativeListItem_NativeListItem: public jni::JavaClass<JFunc_bool_NativeListItem_NativeListItem> {
|
|
31
|
+
public:
|
|
32
|
+
static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/reactnativelist/Func_bool_NativeListItem_NativeListItem;";
|
|
33
|
+
|
|
34
|
+
public:
|
|
35
|
+
/**
|
|
36
|
+
* Invokes the function this `JFunc_bool_NativeListItem_NativeListItem` instance holds through JNI.
|
|
37
|
+
*/
|
|
38
|
+
bool invoke(const NativeListItem& oldItem, const NativeListItem& newItem) const {
|
|
39
|
+
static const auto method = javaClassStatic()->getMethod<jboolean(jni::alias_ref<JNativeListItem> /* oldItem */, jni::alias_ref<JNativeListItem> /* newItem */)>("invoke");
|
|
40
|
+
auto __result = method(self(), JNativeListItem::fromCpp(oldItem), JNativeListItem::fromCpp(newItem));
|
|
41
|
+
return static_cast<bool>(__result);
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* An implementation of Func_bool_NativeListItem_NativeListItem that is backed by a C++ implementation (using `std::function<...>`)
|
|
47
|
+
*/
|
|
48
|
+
class JFunc_bool_NativeListItem_NativeListItem_cxx final: public jni::HybridClass<JFunc_bool_NativeListItem_NativeListItem_cxx, JFunc_bool_NativeListItem_NativeListItem> {
|
|
49
|
+
public:
|
|
50
|
+
static jni::local_ref<JFunc_bool_NativeListItem_NativeListItem::javaobject> fromCpp(const std::function<bool(const NativeListItem& /* oldItem */, const NativeListItem& /* newItem */)>& func) {
|
|
51
|
+
return JFunc_bool_NativeListItem_NativeListItem_cxx::newObjectCxxArgs(func);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
public:
|
|
55
|
+
/**
|
|
56
|
+
* Invokes the C++ `std::function<...>` this `JFunc_bool_NativeListItem_NativeListItem_cxx` instance holds.
|
|
57
|
+
*/
|
|
58
|
+
jboolean invoke_cxx(jni::alias_ref<JNativeListItem> oldItem, jni::alias_ref<JNativeListItem> newItem) {
|
|
59
|
+
bool __result = _func(oldItem->toCpp(), newItem->toCpp());
|
|
60
|
+
return __result;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
public:
|
|
64
|
+
[[nodiscard]]
|
|
65
|
+
inline const std::function<bool(const NativeListItem& /* oldItem */, const NativeListItem& /* newItem */)>& getFunction() const {
|
|
66
|
+
return _func;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
public:
|
|
70
|
+
static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/reactnativelist/Func_bool_NativeListItem_NativeListItem_cxx;";
|
|
71
|
+
static void registerNatives() {
|
|
72
|
+
registerHybrid({makeNativeMethod("invoke_cxx", JFunc_bool_NativeListItem_NativeListItem_cxx::invoke_cxx)});
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
private:
|
|
76
|
+
explicit JFunc_bool_NativeListItem_NativeListItem_cxx(const std::function<bool(const NativeListItem& /* oldItem */, const NativeListItem& /* newItem */)>& func): _func(func) { }
|
|
77
|
+
|
|
78
|
+
private:
|
|
79
|
+
friend HybridBase;
|
|
80
|
+
std::function<bool(const NativeListItem& /* oldItem */, const NativeListItem& /* newItem */)> _func;
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
} // namespace margelo::nitro::reactnativelist
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// JFunc_bool_double_NativeListItem_double.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 <fbjni/fbjni.h>
|
|
11
|
+
#include <functional>
|
|
12
|
+
|
|
13
|
+
#include "NativeListItem.hpp"
|
|
14
|
+
#include <functional>
|
|
15
|
+
#include <NitroModules/JNICallable.hpp>
|
|
16
|
+
#include "JNativeListItem.hpp"
|
|
17
|
+
#include <string>
|
|
18
|
+
#include <optional>
|
|
19
|
+
#include <NitroModules/AnyMap.hpp>
|
|
20
|
+
#include <NitroModules/JAnyMap.hpp>
|
|
21
|
+
|
|
22
|
+
namespace margelo::nitro::reactnativelist {
|
|
23
|
+
|
|
24
|
+
using namespace facebook;
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Represents the Java/Kotlin callback `(reactTag: Double, item: NativeListItem, index: Double) -> Boolean`.
|
|
28
|
+
* This can be passed around between C++ and Java/Kotlin.
|
|
29
|
+
*/
|
|
30
|
+
struct JFunc_bool_double_NativeListItem_double: public jni::JavaClass<JFunc_bool_double_NativeListItem_double> {
|
|
31
|
+
public:
|
|
32
|
+
static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/reactnativelist/Func_bool_double_NativeListItem_double;";
|
|
33
|
+
|
|
34
|
+
public:
|
|
35
|
+
/**
|
|
36
|
+
* Invokes the function this `JFunc_bool_double_NativeListItem_double` instance holds through JNI.
|
|
37
|
+
*/
|
|
38
|
+
bool invoke(double reactTag, const NativeListItem& item, double index) const {
|
|
39
|
+
static const auto method = javaClassStatic()->getMethod<jboolean(double /* reactTag */, jni::alias_ref<JNativeListItem> /* item */, double /* index */)>("invoke");
|
|
40
|
+
auto __result = method(self(), reactTag, JNativeListItem::fromCpp(item), index);
|
|
41
|
+
return static_cast<bool>(__result);
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* An implementation of Func_bool_double_NativeListItem_double that is backed by a C++ implementation (using `std::function<...>`)
|
|
47
|
+
*/
|
|
48
|
+
class JFunc_bool_double_NativeListItem_double_cxx final: public jni::HybridClass<JFunc_bool_double_NativeListItem_double_cxx, JFunc_bool_double_NativeListItem_double> {
|
|
49
|
+
public:
|
|
50
|
+
static jni::local_ref<JFunc_bool_double_NativeListItem_double::javaobject> fromCpp(const std::function<bool(double /* reactTag */, const NativeListItem& /* item */, double /* index */)>& func) {
|
|
51
|
+
return JFunc_bool_double_NativeListItem_double_cxx::newObjectCxxArgs(func);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
public:
|
|
55
|
+
/**
|
|
56
|
+
* Invokes the C++ `std::function<...>` this `JFunc_bool_double_NativeListItem_double_cxx` instance holds.
|
|
57
|
+
*/
|
|
58
|
+
jboolean invoke_cxx(double reactTag, jni::alias_ref<JNativeListItem> item, double index) {
|
|
59
|
+
bool __result = _func(reactTag, item->toCpp(), index);
|
|
60
|
+
return __result;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
public:
|
|
64
|
+
[[nodiscard]]
|
|
65
|
+
inline const std::function<bool(double /* reactTag */, const NativeListItem& /* item */, double /* index */)>& getFunction() const {
|
|
66
|
+
return _func;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
public:
|
|
70
|
+
static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/reactnativelist/Func_bool_double_NativeListItem_double_cxx;";
|
|
71
|
+
static void registerNatives() {
|
|
72
|
+
registerHybrid({makeNativeMethod("invoke_cxx", JFunc_bool_double_NativeListItem_double_cxx::invoke_cxx)});
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
private:
|
|
76
|
+
explicit JFunc_bool_double_NativeListItem_double_cxx(const std::function<bool(double /* reactTag */, const NativeListItem& /* item */, double /* index */)>& func): _func(func) { }
|
|
77
|
+
|
|
78
|
+
private:
|
|
79
|
+
friend HybridBase;
|
|
80
|
+
std::function<bool(double /* reactTag */, const NativeListItem& /* item */, double /* index */)> _func;
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
} // namespace margelo::nitro::reactnativelist
|