Skip to content

Commit 479cd52

Browse files
twasilczykfacebook-github-bot
authored andcommitted
RN: hook up ImportantForInteractionHelper to ScrollViews and TextViews
Summary: Changelog: [Internal] Differential Revision: D113045366
1 parent 8f5fa1c commit 479cd52

8 files changed

Lines changed: 48 additions & 2 deletions

File tree

packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/scroll/ReactHorizontalScrollView.kt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ import com.facebook.react.views.scroll.ReactScrollViewHelper.SNAP_ALIGNMENT_DISA
6262
import com.facebook.react.views.scroll.ReactScrollViewHelper.SNAP_ALIGNMENT_END
6363
import com.facebook.react.views.scroll.ReactScrollViewHelper.SNAP_ALIGNMENT_START
6464
import com.facebook.react.views.scroll.ReactScrollViewHelper.findNextFocusableView
65+
import com.facebook.react.views.view.ImportantForInteractionHelper
6566
import com.facebook.systrace.Systrace
6667
import kotlin.math.abs
6768
import kotlin.math.ceil
@@ -175,6 +176,11 @@ constructor(context: Context, private val fpsListener: FpsListener? = null) :
175176
private var pendingContentOffsetX = UNSET_CONTENT_OFFSET
176177
private var pendingContentOffsetY = UNSET_CONTENT_OFFSET
177178
public open var pointerEvents: PointerEvents = PointerEvents.AUTO
179+
set(value) {
180+
field = value
181+
ImportantForInteractionHelper.setImportantForInteraction(this, value, _overflow)
182+
}
183+
178184
private var contentView: View? = null
179185
private var maintainVisibleContentPositionHelper:
180186
MaintainVisibleScrollPositionHelper<ReactHorizontalScrollView>? =
@@ -425,6 +431,7 @@ constructor(context: Context, private val fpsListener: FpsListener? = null) :
425431
else Overflow.SCROLL,
426432
)
427433
}
434+
ImportantForInteractionHelper.setImportantForInteraction(this, pointerEvents, _overflow)
428435
invalidate()
429436
}
430437

packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/scroll/ReactNestedScrollView.kt

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* This source code is licensed under the MIT license found in the
55
* LICENSE file in the root directory of this source tree.
66
*
7-
* @generated SignedSource<<1ad8f84ac759d8d225ce0fd57dccea7b>>
7+
* @generated SignedSource<<21f8ac172eefdbfa94cab925e21d7a99>>
88
*/
99

1010
/**
@@ -64,6 +64,7 @@ import com.facebook.react.views.scroll.ReactScrollViewHelper.SNAP_ALIGNMENT_DISA
6464
import com.facebook.react.views.scroll.ReactScrollViewHelper.SNAP_ALIGNMENT_END
6565
import com.facebook.react.views.scroll.ReactScrollViewHelper.SNAP_ALIGNMENT_START
6666
import com.facebook.react.views.scroll.ReactScrollViewHelper.findNextFocusableView
67+
import com.facebook.react.views.view.ImportantForInteractionHelper
6768
import com.facebook.systrace.Systrace
6869
import kotlin.math.abs
6970
import kotlin.math.ceil
@@ -112,6 +113,10 @@ constructor(context: Context, private val fpsListener: FpsListener? = null) :
112113
override var hasChildPressedStateDelay: Boolean? = null
113114

114115
public open var pointerEvents: PointerEvents = PointerEvents.AUTO
116+
set(value) {
117+
field = value
118+
ImportantForInteractionHelper.setImportantForInteraction(this, value, _overflow)
119+
}
115120

116121
public open var fadingEdgeLengthStart: Int = 0
117122
set(value) {
@@ -393,6 +398,7 @@ constructor(context: Context, private val fpsListener: FpsListener? = null) :
393398
else Overflow.SCROLL,
394399
)
395400
}
401+
ImportantForInteractionHelper.setImportantForInteraction(this, pointerEvents, _overflow)
396402
invalidate()
397403
}
398404

packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/scroll/ReactScrollView.kt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ import com.facebook.react.views.scroll.ReactScrollViewHelper.SNAP_ALIGNMENT_DISA
5656
import com.facebook.react.views.scroll.ReactScrollViewHelper.SNAP_ALIGNMENT_END
5757
import com.facebook.react.views.scroll.ReactScrollViewHelper.SNAP_ALIGNMENT_START
5858
import com.facebook.react.views.scroll.ReactScrollViewHelper.findNextFocusableView
59+
import com.facebook.react.views.view.ImportantForInteractionHelper
5960
import com.facebook.systrace.Systrace
6061
import kotlin.math.abs
6162
import kotlin.math.ceil
@@ -104,6 +105,10 @@ constructor(context: Context, private val fpsListener: FpsListener? = null) :
104105
override var hasChildPressedStateDelay: Boolean? = null
105106

106107
public open var pointerEvents: PointerEvents = PointerEvents.AUTO
108+
set(value) {
109+
field = value
110+
ImportantForInteractionHelper.setImportantForInteraction(this, value, _overflow)
111+
}
107112

108113
public open var fadingEdgeLengthStart: Int = 0
109114
set(value) {
@@ -385,6 +390,7 @@ constructor(context: Context, private val fpsListener: FpsListener? = null) :
385390
else Overflow.SCROLL,
386391
)
387392
}
393+
ImportantForInteractionHelper.setImportantForInteraction(this, pointerEvents, _overflow)
388394
invalidate()
389395
}
390396

packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/PreparedLayoutTextViewManager.kt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import com.facebook.react.uimanager.IViewGroupManager
2121
import com.facebook.react.uimanager.LayoutShadowNode
2222
import com.facebook.react.uimanager.LengthPercentage
2323
import com.facebook.react.uimanager.LengthPercentageType
24+
import com.facebook.react.uimanager.PointerEvents
2425
import com.facebook.react.uimanager.ReactStylesDiffMap
2526
import com.facebook.react.uimanager.ReferenceStateWrapper
2627
import com.facebook.react.uimanager.StateWrapper
@@ -33,6 +34,7 @@ import com.facebook.react.uimanager.style.BorderStyle
3334
import com.facebook.react.uimanager.style.LogicalEdge
3435
import com.facebook.react.uimanager.style.Overflow
3536
import com.facebook.react.views.text.ReactTextViewAccessibilityDelegate.AccessibilityLinks
37+
import com.facebook.react.views.view.ImportantForInteractionHelper
3638
import java.util.HashMap
3739

3840
@ReactModule(name = PreparedLayoutTextViewManager.REACT_CLASS)
@@ -109,6 +111,11 @@ internal class PreparedLayoutTextViewManager :
109111
@ReactProp(name = "overflow")
110112
fun setOverflow(view: PreparedLayoutTextView, overflow: String?): Unit {
111113
view.overflow = Overflow.fromString(overflow)
114+
ImportantForInteractionHelper.setImportantForInteraction(
115+
view,
116+
PointerEvents.AUTO,
117+
view.overflow,
118+
)
112119
}
113120

114121
@ReactProp(name = "accessible")

packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactTextView.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -676,4 +676,8 @@ public void setOverflow(@Nullable String overflow) {
676676
mOverflow = Overflow.fromString(overflow);
677677
invalidate();
678678
}
679+
680+
/* package */ Overflow getOverflow() {
681+
return mOverflow;
682+
}
679683
}

packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactTextViewManager.kt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ import com.facebook.react.uimanager.IViewManagerWithChildren
3131
import com.facebook.react.uimanager.LayoutShadowNode
3232
import com.facebook.react.uimanager.LengthPercentage
3333
import com.facebook.react.uimanager.LengthPercentageType
34+
import com.facebook.react.uimanager.PointerEvents
3435
import com.facebook.react.uimanager.ReactStylesDiffMap
3536
import com.facebook.react.uimanager.ReferenceStateWrapper
3637
import com.facebook.react.uimanager.StateWrapper
@@ -44,6 +45,7 @@ import com.facebook.react.uimanager.style.BorderStyle.Companion.fromString
4445
import com.facebook.react.uimanager.style.LogicalEdge
4546
import com.facebook.react.views.text.DefaultStyleValuesUtil.getDefaultTextColorHighlight
4647
import com.facebook.react.views.text.ReactTypefaceUtils.getFontWeightAdjustment
48+
import com.facebook.react.views.view.ImportantForInteractionHelper
4749
import java.util.HashMap
4850

4951
/** View manager for `<Text>` nodes. */
@@ -236,6 +238,11 @@ public constructor(
236238
@ReactProp(name = "overflow")
237239
public fun setOverflow(view: ReactTextView, overflow: String?) {
238240
view.setOverflow(overflow)
241+
ImportantForInteractionHelper.setImportantForInteraction(
242+
view,
243+
PointerEvents.AUTO,
244+
view.overflow,
245+
)
239246
}
240247

241248
@ReactProp(name = "accessible")

packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactEditText.kt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,9 @@ public open class ReactEditText public constructor(context: Context) : AppCompat
140140
private var didAttachToWindow = false
141141
private var selectTextOnFocus = false
142142
private var placeholder: String? = null
143-
private var overflow = Overflow.VISIBLE
143+
internal var overflow = Overflow.VISIBLE
144+
private set
145+
144146
private var wasMultiline = false
145147

146148
public var stateWrapper: StateWrapper? = null

packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactTextInputManager.kt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ import com.facebook.react.uimanager.BaseViewManager
4646
import com.facebook.react.uimanager.LayoutShadowNode
4747
import com.facebook.react.uimanager.LengthPercentage
4848
import com.facebook.react.uimanager.LengthPercentageType
49+
import com.facebook.react.uimanager.PointerEvents
4950
import com.facebook.react.uimanager.ReactStylesDiffMap
5051
import com.facebook.react.uimanager.StateWrapper
5152
import com.facebook.react.uimanager.ThemedReactContext
@@ -73,6 +74,7 @@ import com.facebook.react.views.text.ReactTypefaceUtils.getFontWeightAdjustment
7374
import com.facebook.react.views.text.ReactTypefaceUtils.parseFontVariant
7475
import com.facebook.react.views.text.TextAttributeProps
7576
import com.facebook.react.views.text.TextLayoutManager
77+
import com.facebook.react.views.view.ImportantForInteractionHelper
7678
import java.util.LinkedList
7779

7880
/** Manages instances of TextInput. */
@@ -882,6 +884,11 @@ public open class ReactTextInputManager public constructor() :
882884
@ReactProp(name = "overflow")
883885
public fun setOverflow(view: ReactEditText, overflow: String?) {
884886
view.setOverflow(overflow)
887+
ImportantForInteractionHelper.setImportantForInteraction(
888+
view,
889+
PointerEvents.AUTO,
890+
view.overflow,
891+
)
885892
}
886893

887894
override fun onAfterUpdateTransaction(view: ReactEditText) {

0 commit comments

Comments
 (0)