@onekeyfe/react-native-native-list 6.7.0-48 → 6.7.0-49

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.
@@ -1963,7 +1963,10 @@ class NativeListView(
1963
1963
  private var footerView: NativeListRowHost = NativeListRendererRegistry.create(reactContext, NativeListRendererKey.ACTION.ordinal, fonts)
1964
1964
  private var footerRendererKey = NativeListRendererKey.ACTION
1965
1965
  private val sectionIndexView = NativeListSectionIndexView(context, fonts)
1966
- private val sectionIndexPreview = TextView(context)
1966
+ // RN touch targeting still visits invisible native children with retained bounds.
1967
+ private val sectionIndexPreview = object : TextView(context), ReactPointerEventsView {
1968
+ override val pointerEvents: PointerEvents = PointerEvents.NONE
1969
+ }
1967
1970
  private var config: NativeListConfig? = null
1968
1971
  private var usesSelectorSourceScale = false
1969
1972
  private val stickyHeaderView = NativeListRendererRegistry.create(reactContext, NativeListRendererKey.SECTION_HEADER.ordinal, fonts)
@@ -2177,14 +2180,6 @@ class NativeListView(
2177
2180
  stickyHeaderHost.visibility = GONE
2178
2181
  stickyHeaderHost.addView(stickyHeaderView, FrameLayout.LayoutParams(FrameLayout.LayoutParams.MATCH_PARENT, FrameLayout.LayoutParams.WRAP_CONTENT))
2179
2182
  contentContainer.addView(stickyHeaderHost, FrameLayout.LayoutParams(FrameLayout.LayoutParams.MATCH_PARENT, FrameLayout.LayoutParams.WRAP_CONTENT, Gravity.TOP))
2180
- contentContainer.addView(
2181
- sectionIndexView,
2182
- FrameLayout.LayoutParams(
2183
- sectionIndexDp(SECTION_INDEX_RAIL_WIDTH_DP),
2184
- FrameLayout.LayoutParams.MATCH_PARENT,
2185
- Gravity.END,
2186
- ),
2187
- )
2188
2183
  sectionIndexPreview.apply {
2189
2184
  gravity = Gravity.CENTER
2190
2185
  textSize = 30f
@@ -2194,16 +2189,13 @@ class NativeListView(
2194
2189
  alpha = 0f
2195
2190
  importantForAccessibility = IMPORTANT_FOR_ACCESSIBILITY_NO
2196
2191
  }
2197
- contentContainer.addView(
2198
- sectionIndexPreview,
2199
- FrameLayout.LayoutParams(
2200
- sectionIndexDp(SECTION_INDEX_PREVIEW_WIDTH_DP),
2201
- sectionIndexDp(SECTION_INDEX_PREVIEW_HEIGHT_DP),
2202
- Gravity.CENTER_VERTICAL or Gravity.END,
2203
- ).apply {
2204
- marginEnd = sectionIndexDp(SECTION_INDEX_PREVIEW_END_MARGIN_DP)
2205
- },
2206
- )
2192
+ sectionIndexPreview.layoutParams = FrameLayout.LayoutParams(
2193
+ sectionIndexDp(SECTION_INDEX_PREVIEW_WIDTH_DP),
2194
+ sectionIndexDp(SECTION_INDEX_PREVIEW_HEIGHT_DP),
2195
+ Gravity.CENTER_VERTICAL or Gravity.END,
2196
+ ).apply {
2197
+ marginEnd = sectionIndexDp(SECTION_INDEX_PREVIEW_END_MARGIN_DP)
2198
+ }
2207
2199
  addView(contentContainer, LayoutParams(LayoutParams.MATCH_PARENT, 0, 1f))
2208
2200
  footerView.visibility = GONE
2209
2201
  addView(footerView, LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT))
@@ -3704,6 +3696,18 @@ class NativeListView(
3704
3696
  }
3705
3697
 
3706
3698
  private fun updateSectionIndexAttachment() {
3699
+ if (sectionIndexEntries.isEmpty()) {
3700
+ stopSectionIndexAttachmentTracking()
3701
+ sectionIndexAttachmentHandler.removeCallbacks(sectionIndexListAttachmentRunnable)
3702
+ sectionIndexListAttachmentScheduled = false
3703
+ (sectionIndexView.parent as? ViewGroup)?.let { previous ->
3704
+ previous.removeView(sectionIndexView)
3705
+ previous.endViewTransition(sectionIndexView)
3706
+ }
3707
+ contentContainer.removeView(sectionIndexPreview)
3708
+ return
3709
+ }
3710
+ if (sectionIndexPreview.parent == null) contentContainer.addView(sectionIndexPreview)
3707
3711
  val windowHost = rootView as? FrameLayout
3708
3712
  val canUseWindowHost = config?.sectionIndexCenteredInWindow == true &&
3709
3713
  sectionIndexEntries.isNotEmpty() &&
@@ -3757,6 +3761,7 @@ class NativeListView(
3757
3761
  }
3758
3762
 
3759
3763
  private fun scheduleSectionIndexAttachmentToList() {
3764
+ if (sectionIndexEntries.isEmpty()) return
3760
3765
  if (sectionIndexView.parent === contentContainer) return
3761
3766
  if (sectionIndexListAttachmentScheduled) return
3762
3767
  sectionIndexListAttachmentScheduled = true
@@ -3764,6 +3769,7 @@ class NativeListView(
3764
3769
  }
3765
3770
 
3766
3771
  private fun attachSectionIndexToList() {
3772
+ if (sectionIndexEntries.isEmpty()) return
3767
3773
  if (sectionIndexView.parent === contentContainer) return
3768
3774
  (sectionIndexView.parent as? ViewGroup)?.let { previous ->
3769
3775
  previous.removeView(sectionIndexView)
package/docs/SPEC.md CHANGED
@@ -858,6 +858,19 @@ keep their existing layout and public interfaces.
858
858
 
859
859
  ### Android section-index attachment
860
860
 
861
+ The index rail and its letter preview MUST remain outside the view hierarchy
862
+ until the accepted configuration contains usable index entries. Disabling the
863
+ index or removing its last usable entry MUST detach both views, cancel the
864
+ preview interaction, and prevent a pending attachment callback from restoring
865
+ them. Restoring usable entries MUST reattach the same view instances without
866
+ duplicate parents. This attachment lifecycle is Android-specific; iOS and Web
867
+ keep their existing behavior.
868
+
869
+ The section-index letter preview is decorative. It MUST NOT participate in
870
+ React Native touch targeting while visible, fading, or invisible. Controls in
871
+ React container slots beneath its bounds MUST remain pressable; the index rail
872
+ continues to own index selection and scrubbing.
873
+
861
874
  When `sectionIndex.centeredInWindow` is enabled, the Android index rail moves
862
875
  between the list container and the window host as list visibility and attachment
863
876
  change. Before adding that same rail to its new parent, the previous parent MUST
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@onekeyfe/react-native-native-list",
3
- "version": "6.7.0-48",
3
+ "version": "6.7.0-49",
4
4
  "description": "Template-driven native RecyclerView and UICollectionView for React Native",
5
5
  "source": "./src/index.ts",
6
6
  "main": "./lib/module/index.js",