@onekeyfe/react-native-native-list 3.0.105
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 +342 -0
- package/android/CMakeLists.txt +20 -0
- package/android/build.gradle +105 -0
- package/android/gradle.properties +4 -0
- package/android/src/main/AndroidManifest.xml +1 -0
- package/android/src/main/cpp/cpp-adapter.cpp +6 -0
- package/android/src/main/java/com/onekey/nativelist/HybridNativeList.kt +125 -0
- package/android/src/main/java/com/onekey/nativelist/NativeListAdapter.kt +165 -0
- package/android/src/main/java/com/onekey/nativelist/NativeListModels.kt +147 -0
- package/android/src/main/java/com/onekey/nativelist/NativeListPackage.kt +25 -0
- package/android/src/main/java/com/onekey/nativelist/NativeListRowView.kt +2939 -0
- package/android/src/main/java/com/onekey/nativelist/NativeListView.kt +1794 -0
- package/common/fonts/Roobert-Bold.ttf +0 -0
- package/common/fonts/Roobert-Medium.ttf +0 -0
- package/common/fonts/Roobert-Regular.ttf +0 -0
- package/common/fonts/Roobert-SemiBold.ttf +0 -0
- package/docs/DESIGN.md +129 -0
- package/ios/HybridNativeList.swift +131 -0
- package/ios/NativeListCell.swift +2858 -0
- package/ios/NativeListDesignAssets.swift +110 -0
- package/ios/NativeListModels.swift +215 -0
- package/ios/RNCNativeListView.swift +1737 -0
- package/ios/Resources/NativeListIcons.xcassets/Contents.json +1 -0
- package/ios/Resources/NativeListIcons.xcassets/onekey_arrow_bottom.imageset/Contents.json +1 -0
- package/ios/Resources/NativeListIcons.xcassets/onekey_arrow_bottom.imageset/icon.svg +1 -0
- package/ios/Resources/NativeListIcons.xcassets/onekey_arrow_top.imageset/Contents.json +1 -0
- package/ios/Resources/NativeListIcons.xcassets/onekey_arrow_top.imageset/icon.svg +1 -0
- package/ios/Resources/NativeListIcons.xcassets/onekey_chart_trending_up.imageset/Contents.json +1 -0
- package/ios/Resources/NativeListIcons.xcassets/onekey_chart_trending_up.imageset/icon.svg +1 -0
- package/ios/Resources/NativeListIcons.xcassets/onekey_checkbox_checked.imageset/Contents.json +1 -0
- package/ios/Resources/NativeListIcons.xcassets/onekey_checkbox_checked.imageset/icon.svg +1 -0
- package/ios/Resources/NativeListIcons.xcassets/onekey_checkbox_indeterminate.imageset/Contents.json +1 -0
- package/ios/Resources/NativeListIcons.xcassets/onekey_checkbox_indeterminate.imageset/icon.svg +1 -0
- package/ios/Resources/NativeListIcons.xcassets/onekey_chevron_bottom.imageset/Contents.json +1 -0
- package/ios/Resources/NativeListIcons.xcassets/onekey_chevron_bottom.imageset/icon.svg +1 -0
- package/ios/Resources/NativeListIcons.xcassets/onekey_chevron_grabber_ver.imageset/Contents.json +1 -0
- package/ios/Resources/NativeListIcons.xcassets/onekey_chevron_grabber_ver.imageset/icon.svg +1 -0
- package/ios/Resources/NativeListIcons.xcassets/onekey_chevron_right_small.imageset/Contents.json +1 -0
- package/ios/Resources/NativeListIcons.xcassets/onekey_chevron_right_small.imageset/icon.svg +1 -0
- package/ios/Resources/NativeListIcons.xcassets/onekey_chevron_top.imageset/Contents.json +1 -0
- package/ios/Resources/NativeListIcons.xcassets/onekey_chevron_top.imageset/icon.svg +1 -0
- package/ios/Resources/NativeListIcons.xcassets/onekey_dot_hor.imageset/Contents.json +1 -0
- package/ios/Resources/NativeListIcons.xcassets/onekey_dot_hor.imageset/icon.svg +1 -0
- package/ios/Resources/NativeListIcons.xcassets/onekey_drag.imageset/Contents.json +1 -0
- package/ios/Resources/NativeListIcons.xcassets/onekey_drag.imageset/icon.svg +1 -0
- package/ios/Resources/NativeListIcons.xcassets/onekey_error_solid.imageset/Contents.json +1 -0
- package/ios/Resources/NativeListIcons.xcassets/onekey_error_solid.imageset/icon.svg +1 -0
- package/ios/Resources/NativeListIcons.xcassets/onekey_image_square_waves.imageset/Contents.json +1 -0
- package/ios/Resources/NativeListIcons.xcassets/onekey_image_square_waves.imageset/icon.svg +1 -0
- package/ios/Resources/NativeListIcons.xcassets/onekey_info_circle.imageset/Contents.json +1 -0
- package/ios/Resources/NativeListIcons.xcassets/onekey_info_circle.imageset/icon.svg +1 -0
- package/ios/Resources/NativeListIcons.xcassets/onekey_minus_circle.imageset/Contents.json +1 -0
- package/ios/Resources/NativeListIcons.xcassets/onekey_minus_circle.imageset/icon.svg +1 -0
- package/ios/Resources/NativeListIcons.xcassets/onekey_minus_circle_solid.imageset/Contents.json +1 -0
- package/ios/Resources/NativeListIcons.xcassets/onekey_minus_circle_solid.imageset/icon.svg +1 -0
- package/ios/Resources/NativeListIcons.xcassets/onekey_pencil.imageset/Contents.json +1 -0
- package/ios/Resources/NativeListIcons.xcassets/onekey_pencil.imageset/icon.svg +1 -0
- package/ios/Resources/NativeListIcons.xcassets/onekey_plus_circle.imageset/Contents.json +1 -0
- package/ios/Resources/NativeListIcons.xcassets/onekey_plus_circle.imageset/icon.svg +1 -0
- package/ios/Resources/NativeListIcons.xcassets/onekey_plus_small.imageset/Contents.json +1 -0
- package/ios/Resources/NativeListIcons.xcassets/onekey_plus_small.imageset/icon.svg +1 -0
- package/ios/Resources/NativeListIcons.xcassets/onekey_questionmark_solid.imageset/Contents.json +1 -0
- package/ios/Resources/NativeListIcons.xcassets/onekey_questionmark_solid.imageset/icon.svg +1 -0
- package/ios/Resources/NativeListIcons.xcassets/onekey_shield_exclamation.imageset/Contents.json +1 -0
- package/ios/Resources/NativeListIcons.xcassets/onekey_shield_exclamation.imageset/icon.svg +1 -0
- package/ios/Resources/NativeListIcons.xcassets/onekey_speaker_promote.imageset/Contents.json +1 -0
- package/ios/Resources/NativeListIcons.xcassets/onekey_speaker_promote.imageset/icon.svg +1 -0
- package/ios/Resources/NativeListIcons.xcassets/onekey_star.imageset/Contents.json +1 -0
- package/ios/Resources/NativeListIcons.xcassets/onekey_star.imageset/icon.svg +1 -0
- package/ios/Resources/NativeListIcons.xcassets/onekey_star_solid.imageset/Contents.json +1 -0
- package/ios/Resources/NativeListIcons.xcassets/onekey_star_solid.imageset/icon.svg +1 -0
- package/ios/Resources/NativeListIcons.xcassets/onekey_swap_hor.imageset/Contents.json +1 -0
- package/ios/Resources/NativeListIcons.xcassets/onekey_swap_hor.imageset/icon.svg +1 -0
- package/lib/module/NativeList.js +183 -0
- package/lib/module/NativeList.nitro.js +4 -0
- package/lib/module/NativeList.types.js +4 -0
- package/lib/module/NativeList.web.js +167 -0
- package/lib/module/index.js +6 -0
- package/lib/module/models.js +2 -0
- package/lib/module/package.json +1 -0
- package/lib/module/scrolling.js +121 -0
- package/lib/module/selection.js +85 -0
- package/lib/module/validation.js +562 -0
- package/lib/module/web/NativeListWebEngine.js +2238 -0
- package/lib/nitrogen/generated/.gitattributes +1 -0
- package/lib/nitrogen/generated/android/c++/JFunc_void_std__string.hpp +76 -0
- package/lib/nitrogen/generated/android/c++/JHybridNativeListSpec.cpp +201 -0
- package/lib/nitrogen/generated/android/c++/JHybridNativeListSpec.hpp +84 -0
- package/lib/nitrogen/generated/android/c++/JNativeListScrollAlignment.hpp +64 -0
- package/lib/nitrogen/generated/android/c++/views/JHybridNativeListStateUpdater.cpp +104 -0
- package/lib/nitrogen/generated/android/c++/views/JHybridNativeListStateUpdater.hpp +54 -0
- package/lib/nitrogen/generated/android/kotlin/com/margelo/nitro/nativelist/Func_void_std__string.kt +78 -0
- package/lib/nitrogen/generated/android/kotlin/com/margelo/nitro/nativelist/HybridNativeListSpec.kt +177 -0
- package/lib/nitrogen/generated/android/kotlin/com/margelo/nitro/nativelist/NativeListScrollAlignment.kt +25 -0
- package/lib/nitrogen/generated/android/kotlin/com/margelo/nitro/nativelist/nativelistOnLoad.kt +35 -0
- package/lib/nitrogen/generated/android/kotlin/com/margelo/nitro/nativelist/views/HybridNativeListManager.kt +96 -0
- package/lib/nitrogen/generated/android/kotlin/com/margelo/nitro/nativelist/views/HybridNativeListStateUpdater.kt +23 -0
- package/lib/nitrogen/generated/android/nativelist+autolinking.cmake +83 -0
- package/lib/nitrogen/generated/android/nativelist+autolinking.gradle +27 -0
- package/lib/nitrogen/generated/android/nativelistOnLoad.cpp +58 -0
- package/lib/nitrogen/generated/android/nativelistOnLoad.hpp +34 -0
- package/lib/nitrogen/generated/ios/NativeListModule+autolinking.rb +62 -0
- package/lib/nitrogen/generated/ios/NativeListModule-Swift-Cxx-Bridge.cpp +41 -0
- package/lib/nitrogen/generated/ios/NativeListModule-Swift-Cxx-Bridge.hpp +91 -0
- package/lib/nitrogen/generated/ios/NativeListModule-Swift-Cxx-Umbrella.hpp +49 -0
- package/lib/nitrogen/generated/ios/NativeListModuleAutolinking.mm +33 -0
- package/lib/nitrogen/generated/ios/NativeListModuleAutolinking.swift +26 -0
- package/lib/nitrogen/generated/ios/c++/HybridNativeListSpecSwift.cpp +11 -0
- package/lib/nitrogen/generated/ios/c++/HybridNativeListSpecSwift.hpp +180 -0
- package/lib/nitrogen/generated/ios/c++/views/HybridNativeListComponent.mm +180 -0
- package/lib/nitrogen/generated/ios/swift/Func_void_std__string.swift +46 -0
- package/lib/nitrogen/generated/ios/swift/HybridNativeListSpec.swift +69 -0
- package/lib/nitrogen/generated/ios/swift/HybridNativeListSpec_cxx.swift +447 -0
- package/lib/nitrogen/generated/ios/swift/NativeListScrollAlignment.swift +48 -0
- package/lib/nitrogen/generated/shared/c++/HybridNativeListSpec.cpp +43 -0
- package/lib/nitrogen/generated/shared/c++/HybridNativeListSpec.hpp +87 -0
- package/lib/nitrogen/generated/shared/c++/NativeListScrollAlignment.hpp +84 -0
- package/lib/nitrogen/generated/shared/c++/views/HybridNativeListComponent.cpp +46 -0
- package/lib/nitrogen/generated/shared/c++/views/HybridNativeListComponent.hpp +103 -0
- package/lib/nitrogen/generated/shared/json/NativeListConfig.json +16 -0
- package/lib/typescript/package.json +1 -0
- package/lib/typescript/src/NativeList.d.ts +18 -0
- package/lib/typescript/src/NativeList.nitro.d.ts +29 -0
- package/lib/typescript/src/NativeList.types.d.ts +87 -0
- package/lib/typescript/src/NativeList.web.d.ts +19 -0
- package/lib/typescript/src/index.d.ts +7 -0
- package/lib/typescript/src/models.d.ts +456 -0
- package/lib/typescript/src/scrolling.d.ts +32 -0
- package/lib/typescript/src/selection.d.ts +27 -0
- package/lib/typescript/src/validation.d.ts +7 -0
- package/lib/typescript/src/web/NativeListWebEngine.d.ts +203 -0
- package/nitro.json +23 -0
- package/nitrogen/generated/.gitattributes +1 -0
- package/nitrogen/generated/android/c++/JFunc_void_std__string.hpp +76 -0
- package/nitrogen/generated/android/c++/JHybridNativeListSpec.cpp +201 -0
- package/nitrogen/generated/android/c++/JHybridNativeListSpec.hpp +84 -0
- package/nitrogen/generated/android/c++/JNativeListScrollAlignment.hpp +64 -0
- package/nitrogen/generated/android/c++/views/JHybridNativeListStateUpdater.cpp +104 -0
- package/nitrogen/generated/android/c++/views/JHybridNativeListStateUpdater.hpp +54 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nativelist/Func_void_std__string.kt +78 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nativelist/HybridNativeListSpec.kt +177 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nativelist/NativeListScrollAlignment.kt +25 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nativelist/nativelistOnLoad.kt +35 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nativelist/views/HybridNativeListManager.kt +96 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nativelist/views/HybridNativeListStateUpdater.kt +23 -0
- package/nitrogen/generated/android/nativelist+autolinking.cmake +83 -0
- package/nitrogen/generated/android/nativelist+autolinking.gradle +27 -0
- package/nitrogen/generated/android/nativelistOnLoad.cpp +58 -0
- package/nitrogen/generated/android/nativelistOnLoad.hpp +34 -0
- package/nitrogen/generated/ios/NativeListModule+autolinking.rb +62 -0
- package/nitrogen/generated/ios/NativeListModule-Swift-Cxx-Bridge.cpp +41 -0
- package/nitrogen/generated/ios/NativeListModule-Swift-Cxx-Bridge.hpp +91 -0
- package/nitrogen/generated/ios/NativeListModule-Swift-Cxx-Umbrella.hpp +49 -0
- package/nitrogen/generated/ios/NativeListModuleAutolinking.mm +33 -0
- package/nitrogen/generated/ios/NativeListModuleAutolinking.swift +26 -0
- package/nitrogen/generated/ios/c++/HybridNativeListSpecSwift.cpp +11 -0
- package/nitrogen/generated/ios/c++/HybridNativeListSpecSwift.hpp +180 -0
- package/nitrogen/generated/ios/c++/views/HybridNativeListComponent.mm +180 -0
- package/nitrogen/generated/ios/swift/Func_void_std__string.swift +46 -0
- package/nitrogen/generated/ios/swift/HybridNativeListSpec.swift +69 -0
- package/nitrogen/generated/ios/swift/HybridNativeListSpec_cxx.swift +447 -0
- package/nitrogen/generated/ios/swift/NativeListScrollAlignment.swift +48 -0
- package/nitrogen/generated/shared/c++/HybridNativeListSpec.cpp +43 -0
- package/nitrogen/generated/shared/c++/HybridNativeListSpec.hpp +87 -0
- package/nitrogen/generated/shared/c++/NativeListScrollAlignment.hpp +84 -0
- package/nitrogen/generated/shared/c++/views/HybridNativeListComponent.cpp +46 -0
- package/nitrogen/generated/shared/c++/views/HybridNativeListComponent.hpp +103 -0
- package/nitrogen/generated/shared/json/NativeListConfig.json +16 -0
- package/package.json +126 -0
- package/react-native-native-list.podspec +38 -0
- package/react-native.config.js +19 -0
- package/src/NativeList.nitro.ts +48 -0
- package/src/NativeList.tsx +298 -0
- package/src/NativeList.types.ts +125 -0
- package/src/NativeList.web.tsx +258 -0
- package/src/index.ts +35 -0
- package/src/models.ts +604 -0
- package/src/scrolling.ts +189 -0
- package/src/selection.ts +159 -0
- package/src/validation.ts +877 -0
- package/src/web/NativeListWebEngine.ts +3767 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"info":{"author":"xcode","version":1}}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"images":[{"filename":"icon.svg","idiom":"universal"}],"info":{"author":"xcode","version":1},"properties":{"preserves-vector-representation":true,"template-rendering-intent":"template"}}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="#000"><path d="m13 17.586 5-5L19.414 14 12 21.414 4.586 14 6 12.586l5 5V3h2z"/></svg>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"images":[{"filename":"icon.svg","idiom":"universal"}],"info":{"author":"xcode","version":1},"properties":{"preserves-vector-representation":true,"template-rendering-intent":"template"}}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="#000"><path d="M19.414 10 18 11.414l-5-5V21h-2V6.414l-5 5L4.586 10 12 2.586z"/></svg>
|
package/ios/Resources/NativeListIcons.xcassets/onekey_chart_trending_up.imageset/Contents.json
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"images":[{"filename":"icon.svg","idiom":"universal"}],"info":{"author":"xcode","version":1},"properties":{"preserves-vector-representation":true,"template-rendering-intent":"template"}}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="#000"><path d="M22 13h-2V9.414l-7 7-4-4-6 6L1.586 17 9 9.586l4 4L18.586 8H15V6h7z"/></svg>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"images":[{"filename":"icon.svg","idiom":"universal"}],"info":{"author":"xcode","version":1},"properties":{"preserves-vector-representation":true,"template-rendering-intent":"template"}}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="#000"><path d="M12.204 5.043a1 1 0 0 1 0 1.414l-4.5 4.5a1 1 0 0 1-1.414 0l-2-2a1 1 0 1 1 1.414-1.414l1.293 1.293 3.793-3.793a1 1 0 0 1 1.414 0"/></svg>
|
package/ios/Resources/NativeListIcons.xcassets/onekey_checkbox_indeterminate.imageset/Contents.json
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"images":[{"filename":"icon.svg","idiom":"universal"}],"info":{"author":"xcode","version":1},"properties":{"preserves-vector-representation":true,"template-rendering-intent":"template"}}
|
package/ios/Resources/NativeListIcons.xcassets/onekey_checkbox_indeterminate.imageset/icon.svg
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="#000"><path d="M4 8a1 1 0 0 1 1-1h6a1 1 0 0 1 0 2H5a1 1 0 0 1-1-1"/></svg>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"images":[{"filename":"icon.svg","idiom":"universal"}],"info":{"author":"xcode","version":1},"properties":{"preserves-vector-representation":true,"template-rendering-intent":"template"}}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg fill="#000" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="M20.707 9.707 12 18.414 3.293 9.707l1.414-1.414L12 15.586l7.293-7.293z"/></svg>
|
package/ios/Resources/NativeListIcons.xcassets/onekey_chevron_grabber_ver.imageset/Contents.json
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"images":[{"filename":"icon.svg","idiom":"universal"}],"info":{"author":"xcode","version":1},"properties":{"preserves-vector-representation":true,"template-rendering-intent":"template"}}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg fill="#000" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="M17.414 15 12 20.414 6.586 15 8 13.586l4 4 4-4zm0-6L16 10.414l-4-4-4 4L6.586 9 12 3.586z"/></svg>
|
package/ios/Resources/NativeListIcons.xcassets/onekey_chevron_right_small.imageset/Contents.json
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"images":[{"filename":"icon.svg","idiom":"universal"}],"info":{"author":"xcode","version":1},"properties":{"preserves-vector-representation":true,"template-rendering-intent":"template"}}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="#000"><path d="M15.414 12 10 17.414 8.586 16l4-4-4-4L10 6.586z"/></svg>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"images":[{"filename":"icon.svg","idiom":"universal"}],"info":{"author":"xcode","version":1},"properties":{"preserves-vector-representation":true,"template-rendering-intent":"template"}}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg fill="#000" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="m20.707 14.293-1.414 1.414L12 8.414l-7.293 7.293-1.414-1.414L12 5.586z"/></svg>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"images":[{"filename":"icon.svg","idiom":"universal"}],"info":{"author":"xcode","version":1},"properties":{"preserves-vector-representation":true,"template-rendering-intent":"template"}}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="#000"><path d="M6 14H2v-4h4zm8 0h-4v-4h4zm8 0h-4v-4h4z"/></svg>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"images":[{"filename":"icon.svg","idiom":"universal"}],"info":{"author":"xcode","version":1},"properties":{"preserves-vector-representation":true,"template-rendering-intent":"template"}}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="#000"><path d="M11 21H7v-4h4zm6 0h-4v-4h4zm-6-7H7v-4h4zm6 0h-4v-4h4zm-6-7H7V3h4zm6 0h-4V3h4z"/></svg>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"images":[{"filename":"icon.svg","idiom":"universal"}],"info":{"author":"xcode","version":1},"properties":{"preserves-vector-representation":true,"template-rendering-intent":"template"}}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="#000"><path fill-rule="evenodd" d="M23.256 20H.742L12 1.041zM11 15v2h2v-2zm0-6v5h2V9z" clip-rule="evenodd"/></svg>
|
package/ios/Resources/NativeListIcons.xcassets/onekey_image_square_waves.imageset/Contents.json
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"images":[{"filename":"icon.svg","idiom":"universal"}],"info":{"author":"xcode","version":1},"properties":{"preserves-vector-representation":true,"template-rendering-intent":"template"}}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="#000" viewBox="0 0 24 24"><path d="M14.25 7a2 2 0 1 1 0 4 2 2 0 0 1 0-4"/><path fill-rule="evenodd" d="M21 21H3V3h18zM5 16.414V19h12.586L14 15.414l-2 2-4-4zm0-2.828 3-3 4 4 2-2 5 5V5H5z" clip-rule="evenodd"/></svg>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"images":[{"filename":"icon.svg","idiom":"universal"}],"info":{"author":"xcode","version":1},"properties":{"preserves-vector-representation":true,"template-rendering-intent":"template"}}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="#000"><path d="M13 17h-2v-5h-1v-2h3zm0-8h-2V7h2z"/><path fill-rule="evenodd" d="M12 2c5.523 0 10 4.477 10 10s-4.477 10-10 10S2 17.523 2 12 6.477 2 12 2m0 2a8 8 0 1 0 0 16 8 8 0 0 0 0-16" clip-rule="evenodd"/></svg>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"images":[{"filename":"icon.svg","idiom":"universal"}],"info":{"author":"xcode","version":1},"properties":{"preserves-vector-representation":true,"template-rendering-intent":"template"}}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="#000"><path d="M17 13H7v-2h10z"/><path fill-rule="evenodd" d="M12 2c5.523 0 10 4.477 10 10s-4.477 10-10 10S2 17.523 2 12 6.477 2 12 2m0 2a8 8 0 1 0 0 16 8 8 0 0 0 0-16" clip-rule="evenodd"/></svg>
|
package/ios/Resources/NativeListIcons.xcassets/onekey_minus_circle_solid.imageset/Contents.json
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"images":[{"filename":"icon.svg","idiom":"universal"}],"info":{"author":"xcode","version":1},"properties":{"preserves-vector-representation":true,"template-rendering-intent":"template"}}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="#000"><path fill-rule="evenodd" d="M12 2c5.523 0 10 4.477 10 10s-4.477 10-10 10S2 17.523 2 12 6.477 2 12 2M7 13h10v-2H7z" clip-rule="evenodd"/></svg>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"images":[{"filename":"icon.svg","idiom":"universal"}],"info":{"author":"xcode","version":1},"properties":{"preserves-vector-representation":true,"template-rendering-intent":"template"}}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="#000"><path fill-rule="evenodd" d="M22.414 7.5 7.914 22H2v-5.914l14.5-14.5zM4 16.914V20h3.086l9.5-9.5L13.5 7.414zM14.914 6 18 9.086 19.586 7.5 16.5 4.414z" clip-rule="evenodd"/></svg>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"images":[{"filename":"icon.svg","idiom":"universal"}],"info":{"author":"xcode","version":1},"properties":{"preserves-vector-representation":true,"template-rendering-intent":"template"}}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="#000"><path d="M13 11h4v2h-4v4h-2v-4l-4 .001v-2L11 11V7h2z"/><path fill-rule="evenodd" d="M12 2c5.523 0 10 4.477 10 10s-4.477 10-10 10S2 17.523 2 12 6.477 2 12 2m0 2a8 8 0 1 0 0 16 8 8 0 0 0 0-16" clip-rule="evenodd"/></svg>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"images":[{"filename":"icon.svg","idiom":"universal"}],"info":{"author":"xcode","version":1},"properties":{"preserves-vector-representation":true,"template-rendering-intent":"template"}}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="#000"><path d="M13 11h5v2h-5v5h-2v-5H6v-2h5V6h2z"/></svg>
|
package/ios/Resources/NativeListIcons.xcassets/onekey_questionmark_solid.imageset/Contents.json
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"images":[{"filename":"icon.svg","idiom":"universal"}],"info":{"author":"xcode","version":1},"properties":{"preserves-vector-representation":true,"template-rendering-intent":"template"}}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="#000"><path fill-rule="evenodd" d="M12 2c5.523 0 10 4.477 10 10s-4.477 10-10 10S2 17.523 2 12 6.477 2 12 2m-1 15h2v-2h-2zM9 7v3h2V9h2v1l-2 1.5V14h2v-1.5l2-1.5V7z" clip-rule="evenodd"/></svg>
|
package/ios/Resources/NativeListIcons.xcassets/onekey_shield_exclamation.imageset/Contents.json
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"images":[{"filename":"icon.svg","idiom":"universal"}],"info":{"author":"xcode","version":1},"properties":{"preserves-vector-representation":true,"template-rendering-intent":"template"}}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="#000"><path d="M12 12.25a1.25 1.25 0 1 1 0 2.5 1.25 1.25 0 0 1 0-2.5m0-4.75a1 1 0 0 1 1 1v2a1 1 0 0 1-2 0v-2a1 1 0 0 1 1-1"/><path fill-rule="evenodd" d="M11.352 2.223c.42-.145.876-.145 1.296 0l6.98 2.4a1.995 1.995 0 0 1 1.347 1.886v5.432c0 2.799-1.146 4.817-2.805 6.387-1.61 1.525-3.735 2.652-5.696 3.71a1 1 0 0 1-.947 0c-1.961-1.058-4.086-2.185-5.697-3.71-1.659-1.57-2.805-3.588-2.805-6.386V6.508c0-.852.542-1.61 1.347-1.887l6.98-2.4ZM5.02 6.509v5.432c0 2.16.848 3.676 2.18 4.938 1.272 1.204 2.957 2.149 4.799 3.145 1.842-.996 3.527-1.94 4.799-3.145 1.332-1.262 2.181-2.778 2.181-4.938V6.51L12 4.109z" clip-rule="evenodd"/></svg>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"images":[{"filename":"icon.svg","idiom":"universal"}],"info":{"author":"xcode","version":1},"properties":{"preserves-vector-representation":true,"template-rendering-intent":"template"}}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="#000"><path fill-rule="evenodd" d="M21.996 11a4 4 0 0 1-3 3.874v5.495l-5.361-1.711A3.998 3.998 0 0 1 5.996 17v-.779l-4-1.276v-7.89l17-5.424v5.495c1.725.444 3 2.01 3 3.874m-2 0c0-.74-.402-1.385-1-1.731v3.46c.597-.345 1-.989 1-1.729M7.998 7.24v7.521l8.998 2.871V4.368l-8.998 2.87ZM3.996 8.516v4.967l2.002.638V7.877zm4 8.484a2 2 0 0 0 3.706 1.041L7.996 16.86z" clip-rule="evenodd"/></svg>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"images":[{"filename":"icon.svg","idiom":"universal"}],"info":{"author":"xcode","version":1},"properties":{"preserves-vector-representation":true,"template-rendering-intent":"template"}}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="#000"><path fill-rule="evenodd" d="m15.455 7.243 7.729 1.123-5.592 5.45 1.32 7.698L12 17.879l-6.911 3.635 1.32-7.698-5.592-5.45 7.728-1.123L12 .24zM9.872 9.071l-4.759.69 3.444 3.358-.814 4.738L12 15.62l.465.245 3.791 1.993-.813-4.739 3.443-3.357-4.758-.69L12 4.758z" clip-rule="evenodd"/></svg>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"images":[{"filename":"icon.svg","idiom":"universal"}],"info":{"author":"xcode","version":1},"properties":{"preserves-vector-representation":true,"template-rendering-intent":"template"}}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg fill="#000" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="m15.405 7.313 7.84 1.034-5.735 5.443 1.44 7.774L12 17.793l-6.948 3.771 1.44-7.774L.756 8.347l7.839-1.034L12 .178z"/></svg>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"images":[{"filename":"icon.svg","idiom":"universal"}],"info":{"author":"xcode","version":1},"properties":{"preserves-vector-representation":true,"template-rendering-intent":"template"}}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="#000"><path d="M21 16H6.914l2.293 2.293-1.414 1.414L2.086 14H21zm.914-6H3V8h14.086l-2.293-2.293 1.414-1.414z"/></svg>
|
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import React, { forwardRef, useImperativeHandle, useMemo, useRef } from 'react';
|
|
4
|
+
import { callback, getHostComponent } from 'react-native-nitro-modules';
|
|
5
|
+
import { normalizeIndexScroll, normalizeKeyScroll, normalizePositionScroll, resolveLocationIndex, scrollFailure, validateOffset } from "./scrolling.js";
|
|
6
|
+
import { serializePatches, serializeSnapshot } from "./validation.js";
|
|
7
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
8
|
+
const NativeListConfig = require('../nitrogen/generated/shared/json/NativeListConfig.json');
|
|
9
|
+
const NativeListHost = getHostComponent('NativeList', () => NativeListConfig);
|
|
10
|
+
function parsePayload(payloadJson) {
|
|
11
|
+
return JSON.parse(payloadJson);
|
|
12
|
+
}
|
|
13
|
+
export const NativeList = /*#__PURE__*/forwardRef(function NativeList({
|
|
14
|
+
snapshot,
|
|
15
|
+
webVirtualizationEnabled: _webVirtualizationEnabled,
|
|
16
|
+
onRowAction,
|
|
17
|
+
onActionAnchorInvalidated,
|
|
18
|
+
onSelectionDelta,
|
|
19
|
+
onReorder,
|
|
20
|
+
onEndReached,
|
|
21
|
+
onVisibleRangeChanged,
|
|
22
|
+
onRefresh,
|
|
23
|
+
onScrollToIndexFailed,
|
|
24
|
+
initialScrollIndex,
|
|
25
|
+
initialScrollKey,
|
|
26
|
+
initialScrollViewPosition,
|
|
27
|
+
initialScrollViewOffset,
|
|
28
|
+
...viewProps
|
|
29
|
+
}, forwardedRef) {
|
|
30
|
+
const nativeRef = useRef(null);
|
|
31
|
+
const callbacksRef = useRef({
|
|
32
|
+
onRowAction,
|
|
33
|
+
onActionAnchorInvalidated,
|
|
34
|
+
onSelectionDelta,
|
|
35
|
+
onReorder,
|
|
36
|
+
onEndReached,
|
|
37
|
+
onVisibleRangeChanged,
|
|
38
|
+
onRefresh,
|
|
39
|
+
onScrollToIndexFailed
|
|
40
|
+
});
|
|
41
|
+
callbacksRef.current = {
|
|
42
|
+
onRowAction,
|
|
43
|
+
onActionAnchorInvalidated,
|
|
44
|
+
onSelectionDelta,
|
|
45
|
+
onReorder,
|
|
46
|
+
onEndReached,
|
|
47
|
+
onVisibleRangeChanged,
|
|
48
|
+
onRefresh,
|
|
49
|
+
onScrollToIndexFailed
|
|
50
|
+
};
|
|
51
|
+
const snapshotRef = useRef(snapshot);
|
|
52
|
+
snapshotRef.current = snapshot;
|
|
53
|
+
const initialScrollRef = useRef(initialScrollIndex === undefined && initialScrollKey === undefined ? undefined : initialScrollIndex !== undefined ? normalizeIndexScroll({
|
|
54
|
+
index: initialScrollIndex,
|
|
55
|
+
animated: false,
|
|
56
|
+
viewPosition: initialScrollViewPosition,
|
|
57
|
+
viewOffset: initialScrollViewOffset
|
|
58
|
+
}) : {
|
|
59
|
+
key: initialScrollKey,
|
|
60
|
+
scroll: normalizePositionScroll({
|
|
61
|
+
animated: false,
|
|
62
|
+
viewPosition: initialScrollViewPosition,
|
|
63
|
+
viewOffset: initialScrollViewOffset
|
|
64
|
+
}, 'start')
|
|
65
|
+
});
|
|
66
|
+
const didApplyInitialScroll = useRef(false);
|
|
67
|
+
const snapshotJson = useMemo(() => serializeSnapshot(snapshot), [snapshot]);
|
|
68
|
+
const emitIndexFailure = (index, reason) => {
|
|
69
|
+
callbacksRef.current.onScrollToIndexFailed?.(scrollFailure(snapshotRef.current.rows, index, reason));
|
|
70
|
+
};
|
|
71
|
+
const dispatchIndexScroll = (index, scroll) => {
|
|
72
|
+
if (index >= snapshotRef.current.rows.length) {
|
|
73
|
+
emitIndexFailure(index, 'index-out-of-range');
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
nativeRef.current?.scrollToIndex(index, scroll.animated, scroll.alignment, scroll.viewPosition, scroll.viewOffset);
|
|
77
|
+
};
|
|
78
|
+
const dispatchKeyScroll = (key, scroll) => {
|
|
79
|
+
nativeRef.current?.scrollToKey(key, scroll.animated, scroll.alignment, scroll.viewPosition, scroll.viewOffset);
|
|
80
|
+
};
|
|
81
|
+
const applyInitialScroll = () => {
|
|
82
|
+
if (didApplyInitialScroll.current || !nativeRef.current) return;
|
|
83
|
+
didApplyInitialScroll.current = true;
|
|
84
|
+
const initial = initialScrollRef.current;
|
|
85
|
+
if (!initial) return;
|
|
86
|
+
if (initial.index !== undefined) dispatchIndexScroll(initial.index, initial.scroll);else if (initial.key !== undefined) dispatchKeyScroll(initial.key, initial.scroll);
|
|
87
|
+
};
|
|
88
|
+
const applyInitialScrollCallbackRef = useRef(applyInitialScroll);
|
|
89
|
+
applyInitialScrollCallbackRef.current = applyInitialScroll;
|
|
90
|
+
useImperativeHandle(forwardedRef, () => ({
|
|
91
|
+
applySnapshot(nextSnapshot) {
|
|
92
|
+
snapshotRef.current = nextSnapshot;
|
|
93
|
+
nativeRef.current?.applySnapshot(serializeSnapshot(nextSnapshot));
|
|
94
|
+
},
|
|
95
|
+
applyPatches(patches) {
|
|
96
|
+
if (patches.length > 0) nativeRef.current?.applyPatches(serializePatches(patches));
|
|
97
|
+
},
|
|
98
|
+
reconcileSelection(selectedKeys) {
|
|
99
|
+
nativeRef.current?.reconcileSelection(JSON.stringify(selectedKeys));
|
|
100
|
+
},
|
|
101
|
+
scrollToKey(paramsOrKey, animated, alignment) {
|
|
102
|
+
const {
|
|
103
|
+
key,
|
|
104
|
+
scroll
|
|
105
|
+
} = normalizeKeyScroll(paramsOrKey, animated, alignment);
|
|
106
|
+
dispatchKeyScroll(key, scroll);
|
|
107
|
+
},
|
|
108
|
+
scrollToIndex(paramsOrIndex, animated, alignment) {
|
|
109
|
+
const {
|
|
110
|
+
index,
|
|
111
|
+
scroll
|
|
112
|
+
} = normalizeIndexScroll(paramsOrIndex, animated, alignment);
|
|
113
|
+
dispatchIndexScroll(index, scroll);
|
|
114
|
+
},
|
|
115
|
+
scrollToItem(params) {
|
|
116
|
+
const index = snapshotRef.current.rows.findIndex(row => row.key === params.item.key);
|
|
117
|
+
if (index < 0) {
|
|
118
|
+
emitIndexFailure(-1, 'item-not-found');
|
|
119
|
+
return;
|
|
120
|
+
}
|
|
121
|
+
dispatchIndexScroll(index, normalizePositionScroll(params, 'start'));
|
|
122
|
+
},
|
|
123
|
+
scrollToOffset({
|
|
124
|
+
offset,
|
|
125
|
+
animated = true
|
|
126
|
+
}) {
|
|
127
|
+
validateOffset(offset);
|
|
128
|
+
nativeRef.current?.scrollToOffset(offset, animated);
|
|
129
|
+
},
|
|
130
|
+
scrollToEnd({
|
|
131
|
+
animated = true
|
|
132
|
+
} = {}) {
|
|
133
|
+
nativeRef.current?.scrollToEnd(animated);
|
|
134
|
+
},
|
|
135
|
+
scrollToLocation(params) {
|
|
136
|
+
const index = resolveLocationIndex(snapshotRef.current.rows, params);
|
|
137
|
+
if (index === undefined) {
|
|
138
|
+
const sectionCount = snapshotRef.current.rows.filter(row => row.type === 'sectionHeader' && row.variant !== 'summary').length;
|
|
139
|
+
emitIndexFailure(params.itemIndex, params.sectionIndex >= sectionCount ? 'section-out-of-range' : 'item-out-of-range');
|
|
140
|
+
return;
|
|
141
|
+
}
|
|
142
|
+
dispatchIndexScroll(index, normalizePositionScroll(params, 'start'));
|
|
143
|
+
},
|
|
144
|
+
setActionAnchorState(state) {
|
|
145
|
+
nativeRef.current?.setActionAnchorState(JSON.stringify(state));
|
|
146
|
+
},
|
|
147
|
+
setRefreshing(refreshing) {
|
|
148
|
+
nativeRef.current?.setRefreshing(refreshing);
|
|
149
|
+
}
|
|
150
|
+
}));
|
|
151
|
+
const nativeCallbacks = useMemo(() => ({
|
|
152
|
+
hybridRef: callback(ref => {
|
|
153
|
+
nativeRef.current = ref;
|
|
154
|
+
applyInitialScrollCallbackRef.current();
|
|
155
|
+
}),
|
|
156
|
+
onRowAction: callback(payloadJson => {
|
|
157
|
+
const payload = parsePayload(payloadJson);
|
|
158
|
+
if (payload.actionKey === 'nativeList.refresh') callbacksRef.current.onRefresh?.();
|
|
159
|
+
callbacksRef.current.onRowAction?.(payload);
|
|
160
|
+
}),
|
|
161
|
+
onActionAnchorInvalidated: callback(payloadJson => {
|
|
162
|
+
callbacksRef.current.onActionAnchorInvalidated?.(parsePayload(payloadJson));
|
|
163
|
+
}),
|
|
164
|
+
onSelectionDelta: callback(payloadJson => {
|
|
165
|
+
callbacksRef.current.onSelectionDelta?.(parsePayload(payloadJson));
|
|
166
|
+
}),
|
|
167
|
+
onReorder: callback(payloadJson => {
|
|
168
|
+
callbacksRef.current.onReorder?.(parsePayload(payloadJson));
|
|
169
|
+
}),
|
|
170
|
+
onEndReached: callback(payloadJson => {
|
|
171
|
+
callbacksRef.current.onEndReached?.(parsePayload(payloadJson));
|
|
172
|
+
}),
|
|
173
|
+
onVisibleRangeChanged: callback(payloadJson => {
|
|
174
|
+
callbacksRef.current.onVisibleRangeChanged?.(parsePayload(payloadJson));
|
|
175
|
+
})
|
|
176
|
+
}), []);
|
|
177
|
+
return /*#__PURE__*/_jsx(NativeListHost, {
|
|
178
|
+
...viewProps,
|
|
179
|
+
...nativeCallbacks,
|
|
180
|
+
snapshotJson: snapshotJson
|
|
181
|
+
});
|
|
182
|
+
});
|
|
183
|
+
//# sourceMappingURL=NativeList.js.map
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import React, { forwardRef, useCallback, useEffect, useImperativeHandle, useMemo, useRef, useState } from 'react';
|
|
4
|
+
import { View } from 'react-native';
|
|
5
|
+
import { normalizeIndexScroll, normalizeKeyScroll, normalizePositionScroll, resolveLocationIndex, scrollFailure, validateOffset } from "./scrolling.js";
|
|
6
|
+
import { serializePatches, validateSnapshot } from "./validation.js";
|
|
7
|
+
import { NativeListWebEngine } from "./web/NativeListWebEngine.js";
|
|
8
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
9
|
+
export const NativeList = /*#__PURE__*/forwardRef(function NativeList({
|
|
10
|
+
snapshot,
|
|
11
|
+
webVirtualizationEnabled = true,
|
|
12
|
+
onRowAction,
|
|
13
|
+
onActionAnchorInvalidated,
|
|
14
|
+
onSelectionDelta,
|
|
15
|
+
onReorder,
|
|
16
|
+
onEndReached,
|
|
17
|
+
onVisibleRangeChanged,
|
|
18
|
+
onRefresh,
|
|
19
|
+
onScrollToIndexFailed,
|
|
20
|
+
initialScrollIndex,
|
|
21
|
+
initialScrollKey,
|
|
22
|
+
initialScrollViewPosition,
|
|
23
|
+
initialScrollViewOffset,
|
|
24
|
+
...viewProps
|
|
25
|
+
}, forwardedRef) {
|
|
26
|
+
const [host, setHost] = useState(null);
|
|
27
|
+
const engineRef = useRef(undefined);
|
|
28
|
+
const webVirtualizationEnabledRef = useRef(webVirtualizationEnabled);
|
|
29
|
+
webVirtualizationEnabledRef.current = webVirtualizationEnabled;
|
|
30
|
+
const validatedSnapshot = useMemo(() => validateSnapshot(snapshot), [snapshot]);
|
|
31
|
+
const snapshotRef = useRef(validatedSnapshot);
|
|
32
|
+
snapshotRef.current = validatedSnapshot;
|
|
33
|
+
const appliedSnapshotRef = useRef(undefined);
|
|
34
|
+
const callbacksRef = useRef({});
|
|
35
|
+
callbacksRef.current = {
|
|
36
|
+
onRowAction,
|
|
37
|
+
onActionAnchorInvalidated,
|
|
38
|
+
onSelectionDelta,
|
|
39
|
+
onReorder,
|
|
40
|
+
onEndReached,
|
|
41
|
+
onVisibleRangeChanged,
|
|
42
|
+
onRefresh,
|
|
43
|
+
onScrollToIndexFailed
|
|
44
|
+
};
|
|
45
|
+
const initialScrollRef = useRef(initialScrollIndex === undefined && initialScrollKey === undefined ? undefined : initialScrollIndex !== undefined ? normalizeIndexScroll({
|
|
46
|
+
index: initialScrollIndex,
|
|
47
|
+
animated: false,
|
|
48
|
+
viewPosition: initialScrollViewPosition,
|
|
49
|
+
viewOffset: initialScrollViewOffset
|
|
50
|
+
}) : {
|
|
51
|
+
key: initialScrollKey,
|
|
52
|
+
scroll: normalizePositionScroll({
|
|
53
|
+
animated: false,
|
|
54
|
+
viewPosition: initialScrollViewPosition,
|
|
55
|
+
viewOffset: initialScrollViewOffset
|
|
56
|
+
}, 'start')
|
|
57
|
+
});
|
|
58
|
+
const didApplyInitialScroll = useRef(false);
|
|
59
|
+
useEffect(() => {
|
|
60
|
+
if (!host) return;
|
|
61
|
+
const engine = new NativeListWebEngine(host, snapshotRef.current, callbacksRef.current, webVirtualizationEnabledRef.current);
|
|
62
|
+
engineRef.current = engine;
|
|
63
|
+
appliedSnapshotRef.current = snapshotRef.current;
|
|
64
|
+
const initial = initialScrollRef.current;
|
|
65
|
+
if (initial && !didApplyInitialScroll.current) {
|
|
66
|
+
didApplyInitialScroll.current = true;
|
|
67
|
+
if (initial.index !== undefined) engine.scrollToIndex(initial.index, initial.scroll);else if (initial.key !== undefined) engine.scrollToKey(initial.key, initial.scroll);
|
|
68
|
+
}
|
|
69
|
+
return () => {
|
|
70
|
+
engine.destroy();
|
|
71
|
+
if (engineRef.current === engine) engineRef.current = undefined;
|
|
72
|
+
};
|
|
73
|
+
}, [host]);
|
|
74
|
+
useEffect(() => {
|
|
75
|
+
engineRef.current?.setVirtualizationEnabled(webVirtualizationEnabled);
|
|
76
|
+
}, [webVirtualizationEnabled]);
|
|
77
|
+
useEffect(() => {
|
|
78
|
+
engineRef.current?.updateCallbacks(callbacksRef.current);
|
|
79
|
+
});
|
|
80
|
+
useEffect(() => {
|
|
81
|
+
const engine = engineRef.current;
|
|
82
|
+
if (!engine || appliedSnapshotRef.current === validatedSnapshot) return;
|
|
83
|
+
engine.applySnapshot(validatedSnapshot);
|
|
84
|
+
appliedSnapshotRef.current = validatedSnapshot;
|
|
85
|
+
}, [validatedSnapshot]);
|
|
86
|
+
const emitIndexFailure = (index, reason) => {
|
|
87
|
+
callbacksRef.current.onScrollToIndexFailed?.(scrollFailure(snapshotRef.current.rows, index, reason));
|
|
88
|
+
};
|
|
89
|
+
useImperativeHandle(forwardedRef, () => ({
|
|
90
|
+
applySnapshot(nextSnapshot) {
|
|
91
|
+
const next = validateSnapshot(nextSnapshot);
|
|
92
|
+
snapshotRef.current = next;
|
|
93
|
+
appliedSnapshotRef.current = next;
|
|
94
|
+
engineRef.current?.applySnapshot(next);
|
|
95
|
+
},
|
|
96
|
+
applyPatches(patches) {
|
|
97
|
+
if (patches.length > 0) {
|
|
98
|
+
serializePatches(patches);
|
|
99
|
+
engineRef.current?.applyPatches(patches);
|
|
100
|
+
}
|
|
101
|
+
},
|
|
102
|
+
reconcileSelection(selectedKeys) {
|
|
103
|
+
engineRef.current?.reconcileSelection(selectedKeys);
|
|
104
|
+
},
|
|
105
|
+
scrollToKey(paramsOrKey, animated, alignment) {
|
|
106
|
+
const {
|
|
107
|
+
key,
|
|
108
|
+
scroll
|
|
109
|
+
} = normalizeKeyScroll(paramsOrKey, animated, alignment);
|
|
110
|
+
engineRef.current?.scrollToKey(key, scroll);
|
|
111
|
+
},
|
|
112
|
+
scrollToIndex(paramsOrIndex, animated, alignment) {
|
|
113
|
+
const {
|
|
114
|
+
index,
|
|
115
|
+
scroll
|
|
116
|
+
} = normalizeIndexScroll(paramsOrIndex, animated, alignment);
|
|
117
|
+
if (index >= snapshotRef.current.rows.length) {
|
|
118
|
+
emitIndexFailure(index, 'index-out-of-range');
|
|
119
|
+
return;
|
|
120
|
+
}
|
|
121
|
+
engineRef.current?.scrollToIndex(index, scroll);
|
|
122
|
+
},
|
|
123
|
+
scrollToItem(params) {
|
|
124
|
+
const index = snapshotRef.current.rows.findIndex(row => row.key === params.item.key);
|
|
125
|
+
if (index < 0) {
|
|
126
|
+
emitIndexFailure(-1, 'item-not-found');
|
|
127
|
+
return;
|
|
128
|
+
}
|
|
129
|
+
engineRef.current?.scrollToIndex(index, normalizePositionScroll(params, 'start'));
|
|
130
|
+
},
|
|
131
|
+
scrollToOffset({
|
|
132
|
+
offset,
|
|
133
|
+
animated = true
|
|
134
|
+
}) {
|
|
135
|
+
validateOffset(offset);
|
|
136
|
+
engineRef.current?.scrollToOffset(offset, animated);
|
|
137
|
+
},
|
|
138
|
+
scrollToEnd({
|
|
139
|
+
animated = true
|
|
140
|
+
} = {}) {
|
|
141
|
+
engineRef.current?.scrollToEnd(animated);
|
|
142
|
+
},
|
|
143
|
+
scrollToLocation(params) {
|
|
144
|
+
const index = resolveLocationIndex(snapshotRef.current.rows, params);
|
|
145
|
+
if (index === undefined) {
|
|
146
|
+
const sectionCount = snapshotRef.current.rows.filter(row => row.type === 'sectionHeader' && row.variant !== 'summary').length;
|
|
147
|
+
emitIndexFailure(params.itemIndex, params.sectionIndex >= sectionCount ? 'section-out-of-range' : 'item-out-of-range');
|
|
148
|
+
return;
|
|
149
|
+
}
|
|
150
|
+
engineRef.current?.scrollToIndex(index, normalizePositionScroll(params, 'start'));
|
|
151
|
+
},
|
|
152
|
+
setActionAnchorState(state) {
|
|
153
|
+
engineRef.current?.setActionAnchorState(state);
|
|
154
|
+
},
|
|
155
|
+
setRefreshing(refreshing) {
|
|
156
|
+
engineRef.current?.setRefreshing(refreshing);
|
|
157
|
+
}
|
|
158
|
+
}));
|
|
159
|
+
const setHostRef = useCallback(value => {
|
|
160
|
+
setHost(value);
|
|
161
|
+
}, []);
|
|
162
|
+
return /*#__PURE__*/_jsx(View, {
|
|
163
|
+
...viewProps,
|
|
164
|
+
ref: setHostRef
|
|
165
|
+
});
|
|
166
|
+
});
|
|
167
|
+
//# sourceMappingURL=NativeList.web.js.map
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
export { NativeList } from './NativeList';
|
|
4
|
+
export { applyRowPatches, serializePatches, serializeSnapshot, validatePatches, validateSnapshot } from "./validation.js";
|
|
5
|
+
export { checkboxStateForKeys, checkboxStateForSection, isSelectableRow, reduceSelection, selectionStateFromSnapshot } from "./selection.js";
|
|
6
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"type":"module"}
|