react-native-tvos 0.77.1-0 → 0.77.2-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/Libraries/Core/ReactNativeVersion.js +2 -2
- package/Libraries/Image/Image.android.js +2 -0
- package/Libraries/Image/ImageViewNativeComponent.js +3 -4
- package/React/Base/RCTVersion.m +2 -2
- package/React/Fabric/Mounting/ComponentViews/TextInput/RCTTextInputComponentView.mm +1 -7
- package/ReactAndroid/gradle.properties +1 -1
- package/ReactAndroid/src/main/AndroidManifest.xml +1 -1
- package/ReactAndroid/src/main/java/com/facebook/react/ReactActivityDelegate.java +4 -1
- package/ReactAndroid/src/main/java/com/facebook/react/ReactFragment.java +6 -1
- package/ReactAndroid/src/main/java/com/facebook/react/devsupport/DebugOverlayController.java +7 -2
- package/ReactAndroid/src/main/java/com/facebook/react/fabric/FabricUIManager.java +8 -2
- package/ReactAndroid/src/main/java/com/facebook/react/modules/i18nmanager/I18nManagerModule.kt +6 -1
- package/ReactAndroid/src/main/java/com/facebook/react/modules/permissions/PermissionsModule.kt +15 -4
- package/ReactAndroid/src/main/java/com/facebook/react/modules/systeminfo/ReactNativeVersion.java +2 -2
- package/ReactAndroid/src/main/java/com/facebook/react/uimanager/BackgroundStyleApplicator.kt +21 -41
- package/ReactAndroid/src/main/java/com/facebook/react/uimanager/drawable/BackgroundDrawable.kt +0 -1
- package/ReactAndroid/src/main/java/com/facebook/react/uimanager/drawable/BorderDrawable.kt +0 -1
- package/ReactAndroid/src/main/java/com/facebook/react/uimanager/drawable/CSSBackgroundDrawable.java +0 -1
- package/ReactAndroid/src/main/java/com/facebook/react/uimanager/drawable/CompositeBackgroundDrawable.kt +132 -150
- package/ReactAndroid/src/main/java/com/facebook/react/uimanager/drawable/Drawable.kt +17 -0
- package/ReactAndroid/src/main/java/com/facebook/react/uimanager/drawable/LayerDrawable.kt +19 -0
- package/ReactAndroid/src/main/java/com/facebook/react/uimanager/drawable/OutlineDrawable.kt +0 -1
- package/ReactAndroid/src/main/java/com/facebook/react/views/image/ReactImageManager.kt +1 -1
- package/ReactAndroid/src/main/java/com/facebook/react/views/scroll/ReactHorizontalScrollView.java +1 -1
- package/ReactAndroid/src/main/java/com/facebook/react/views/scroll/ReactScrollView.java +8 -0
- package/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactBaseTextShadowNode.java +10 -2
- package/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactTextShadowNode.java +36 -27
- package/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactTextView.java +3 -3
- package/ReactAndroid/src/main/java/com/facebook/react/views/text/TextLayoutManager.java +38 -31
- package/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactEditText.java +4 -2
- package/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactTextInputLocalData.java +13 -2
- package/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactTextInputShadowNode.java +12 -2
- package/ReactAndroid/src/main/java/com/facebook/react/views/view/ReactDrawableHelper.java +2 -1
- package/ReactAndroid/src/main/java/com/facebook/react/views/view/ReactViewManager.kt +3 -0
- package/ReactCommon/cxxreact/ReactNativeVersion.h +2 -2
- package/ReactCommon/react/nativemodule/core/platform/ios/ReactCommon/RCTInteropTurboModule.mm +9 -0
- package/ReactCommon/react/nativemodule/core/platform/ios/ReactCommon/RCTTurboModule.mm +24 -13
- package/ReactCommon/react/renderer/textlayoutmanager/platform/ios/react/renderer/textlayoutmanager/RCTAttributedTextUtils.h +24 -3
- package/ReactCommon/react/renderer/textlayoutmanager/platform/ios/react/renderer/textlayoutmanager/RCTAttributedTextUtils.mm +1 -43
- package/ReactCommon/react/renderer/textlayoutmanager/platform/ios/react/renderer/textlayoutmanager/RCTTextLayoutManager.mm +4 -5
- package/gradle/libs.versions.toml +1 -1
- package/package.json +10 -10
- package/react-native.config.js +11 -21
- package/scripts/codegen/generate-artifacts-executor.js +8 -4
- package/scripts/generate-codegen-artifacts.js +6 -1
- package/sdks/hermesc/osx-bin/hermes +0 -0
- package/sdks/hermesc/osx-bin/hermesc +0 -0
- package/sdks/hermesc/win64-bin/hermesc.exe +0 -0
- package/sdks/hermesc/win64-bin/msvcp140.dll +0 -0
- package/sdks/hermesc/win64-bin/vcruntime140.dll +0 -0
- package/sdks/hermesc/win64-bin/vcruntime140_1.dll +0 -0
|
@@ -15,7 +15,6 @@ import android.graphics.drawable.Drawable
|
|
|
15
15
|
import android.graphics.drawable.LayerDrawable
|
|
16
16
|
import android.os.Build
|
|
17
17
|
import com.facebook.react.common.annotations.UnstableReactNativeAPI
|
|
18
|
-
import com.facebook.react.internal.featureflags.ReactNativeFeatureFlags
|
|
19
18
|
import com.facebook.react.uimanager.PixelUtil.dpToPx
|
|
20
19
|
import com.facebook.react.uimanager.style.BorderInsets
|
|
21
20
|
import com.facebook.react.uimanager.style.BorderRadiusStyle
|
|
@@ -31,10 +30,10 @@ internal class CompositeBackgroundDrawable(
|
|
|
31
30
|
* Any non-react-managed background already part of the view, like one set as Android style on a
|
|
32
31
|
* TextInput
|
|
33
32
|
*/
|
|
34
|
-
|
|
33
|
+
val originalBackground: Drawable? = null,
|
|
35
34
|
|
|
36
35
|
/** Non-inset box shadows */
|
|
37
|
-
outerShadows:
|
|
36
|
+
val outerShadows: List<Drawable> = emptyList(),
|
|
38
37
|
|
|
39
38
|
/**
|
|
40
39
|
* CSS background layer and border rendering
|
|
@@ -42,147 +41,144 @@ internal class CompositeBackgroundDrawable(
|
|
|
42
41
|
* TODO: we should extract path logic from here, and fast-path to using simpler drawables like
|
|
43
42
|
* ColorDrawable in the common cases
|
|
44
43
|
*/
|
|
45
|
-
|
|
44
|
+
val cssBackground: CSSBackgroundDrawable? = null,
|
|
46
45
|
|
|
47
46
|
/** Background rendering Layer */
|
|
48
|
-
background: BackgroundDrawable? = null,
|
|
47
|
+
val background: BackgroundDrawable? = null,
|
|
49
48
|
|
|
50
49
|
/** Border rendering Layer */
|
|
51
|
-
border: BorderDrawable? = null,
|
|
50
|
+
val border: BorderDrawable? = null,
|
|
52
51
|
|
|
53
52
|
/** TouchableNativeFeeback set selection background, like "SelectableBackground" */
|
|
54
|
-
feedbackUnderlay: Drawable? = null,
|
|
53
|
+
val feedbackUnderlay: Drawable? = null,
|
|
55
54
|
|
|
56
55
|
/** Inset box-shadows */
|
|
57
|
-
innerShadows:
|
|
56
|
+
val innerShadows: List<Drawable> = emptyList(),
|
|
58
57
|
|
|
59
58
|
/** Outline */
|
|
60
|
-
outline: OutlineDrawable? = null,
|
|
61
|
-
) : LayerDrawable(emptyArray()) {
|
|
62
|
-
public var outerShadows: LayerDrawable? = outerShadows
|
|
63
|
-
private set
|
|
59
|
+
val outline: OutlineDrawable? = null,
|
|
64
60
|
|
|
65
|
-
|
|
66
|
-
|
|
61
|
+
// Holder value for currently set insets
|
|
62
|
+
var borderInsets: BorderInsets? = null,
|
|
67
63
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
public var borderInsets: BorderInsets? = null
|
|
82
|
-
|
|
83
|
-
// Holder value for currently set border radius
|
|
84
|
-
public var borderRadius: BorderRadiusStyle? = null
|
|
64
|
+
// Holder value for currently set border radius
|
|
65
|
+
var borderRadius: BorderRadiusStyle? = null,
|
|
66
|
+
) :
|
|
67
|
+
com.facebook.react.uimanager.drawable.LayerDrawable(
|
|
68
|
+
createLayersArray(
|
|
69
|
+
originalBackground,
|
|
70
|
+
outerShadows,
|
|
71
|
+
cssBackground,
|
|
72
|
+
background,
|
|
73
|
+
border,
|
|
74
|
+
feedbackUnderlay,
|
|
75
|
+
innerShadows,
|
|
76
|
+
outline)) {
|
|
85
77
|
|
|
86
78
|
init {
|
|
87
79
|
// We want to overlay drawables, instead of placing future drawables within the content area of
|
|
88
80
|
// previous ones. E.g. an EditText style may set padding on a TextInput, but we don't want to
|
|
89
81
|
// constrain background color to the area inside of the padding.
|
|
90
82
|
setPaddingMode(LayerDrawable.PADDING_MODE_STACK)
|
|
91
|
-
|
|
92
|
-
addLayer(originalBackground, ORIGINAL_BACKGROUND_ID)
|
|
93
|
-
addLayer(outerShadows, OUTER_SHADOWS_ID)
|
|
94
|
-
addLayer(cssBackground, CSS_BACKGROUND_ID)
|
|
95
|
-
addLayer(background, BACKGROUND_ID)
|
|
96
|
-
addLayer(border, BORDER_ID)
|
|
97
|
-
addLayer(feedbackUnderlay, FEEDBACK_UNDERLAY_ID)
|
|
98
|
-
addLayer(innerShadows, INNER_SHADOWS_ID)
|
|
99
|
-
addLayer(outline, OUTLINE_ID)
|
|
100
83
|
}
|
|
101
84
|
|
|
102
|
-
|
|
103
|
-
cssBackground: CSSBackgroundDrawable?
|
|
104
|
-
): CompositeBackgroundDrawable {
|
|
85
|
+
fun withNewCssBackground(cssBackground: CSSBackgroundDrawable?): CompositeBackgroundDrawable {
|
|
105
86
|
return CompositeBackgroundDrawable(
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
}
|
|
87
|
+
context,
|
|
88
|
+
originalBackground,
|
|
89
|
+
outerShadows,
|
|
90
|
+
cssBackground,
|
|
91
|
+
background,
|
|
92
|
+
border,
|
|
93
|
+
feedbackUnderlay,
|
|
94
|
+
innerShadows,
|
|
95
|
+
outline,
|
|
96
|
+
borderInsets,
|
|
97
|
+
borderRadius,
|
|
98
|
+
)
|
|
119
99
|
}
|
|
120
100
|
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
public fun withNewOutline(outline: OutlineDrawable?): CompositeBackgroundDrawable =
|
|
137
|
-
withNewLayer(outline, OUTLINE_ID, this::outline::set)
|
|
138
|
-
|
|
139
|
-
/** @return true if the layer was updated, false if it was not */
|
|
140
|
-
private fun updateLayer(layer: Drawable?, id: Int): Boolean {
|
|
141
|
-
if (layer == null) {
|
|
142
|
-
return findDrawableByLayerId(id) == null
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
if (findDrawableByLayerId(id) == null) {
|
|
146
|
-
insertNewLayer(layer, id)
|
|
147
|
-
} else {
|
|
148
|
-
setDrawableByLayerId(id, layer)
|
|
149
|
-
}
|
|
150
|
-
invalidateSelf()
|
|
151
|
-
return true
|
|
101
|
+
fun withNewBackground(background: BackgroundDrawable?): CompositeBackgroundDrawable {
|
|
102
|
+
return CompositeBackgroundDrawable(
|
|
103
|
+
context,
|
|
104
|
+
originalBackground,
|
|
105
|
+
outerShadows,
|
|
106
|
+
cssBackground,
|
|
107
|
+
background,
|
|
108
|
+
border,
|
|
109
|
+
feedbackUnderlay,
|
|
110
|
+
innerShadows,
|
|
111
|
+
outline,
|
|
112
|
+
borderInsets,
|
|
113
|
+
borderRadius,
|
|
114
|
+
)
|
|
152
115
|
}
|
|
153
116
|
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
117
|
+
fun withNewShadows(
|
|
118
|
+
outerShadows: List<Drawable>,
|
|
119
|
+
innerShadows: List<Drawable>
|
|
120
|
+
): CompositeBackgroundDrawable {
|
|
121
|
+
return CompositeBackgroundDrawable(
|
|
122
|
+
context,
|
|
123
|
+
originalBackground,
|
|
124
|
+
outerShadows,
|
|
125
|
+
cssBackground,
|
|
126
|
+
background,
|
|
127
|
+
border,
|
|
128
|
+
feedbackUnderlay,
|
|
129
|
+
innerShadows,
|
|
130
|
+
outline,
|
|
131
|
+
borderInsets,
|
|
132
|
+
borderRadius,
|
|
133
|
+
)
|
|
134
|
+
}
|
|
161
135
|
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
136
|
+
fun withNewBorder(border: BorderDrawable): CompositeBackgroundDrawable {
|
|
137
|
+
return CompositeBackgroundDrawable(
|
|
138
|
+
context,
|
|
139
|
+
originalBackground,
|
|
140
|
+
outerShadows,
|
|
141
|
+
cssBackground,
|
|
142
|
+
background,
|
|
143
|
+
border,
|
|
144
|
+
feedbackUnderlay,
|
|
145
|
+
innerShadows,
|
|
146
|
+
outline,
|
|
147
|
+
borderInsets,
|
|
148
|
+
borderRadius,
|
|
149
|
+
)
|
|
175
150
|
}
|
|
176
151
|
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
152
|
+
fun withNewOutline(outline: OutlineDrawable): CompositeBackgroundDrawable {
|
|
153
|
+
return CompositeBackgroundDrawable(
|
|
154
|
+
context,
|
|
155
|
+
originalBackground,
|
|
156
|
+
outerShadows,
|
|
157
|
+
cssBackground,
|
|
158
|
+
background,
|
|
159
|
+
border,
|
|
160
|
+
feedbackUnderlay,
|
|
161
|
+
innerShadows,
|
|
162
|
+
outline,
|
|
163
|
+
borderInsets,
|
|
164
|
+
borderRadius,
|
|
165
|
+
)
|
|
166
|
+
}
|
|
181
167
|
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
168
|
+
fun withNewFeedbackUnderlay(newUnderlay: Drawable?): CompositeBackgroundDrawable {
|
|
169
|
+
return CompositeBackgroundDrawable(
|
|
170
|
+
context,
|
|
171
|
+
originalBackground,
|
|
172
|
+
outerShadows,
|
|
173
|
+
cssBackground,
|
|
174
|
+
background,
|
|
175
|
+
border,
|
|
176
|
+
newUnderlay,
|
|
177
|
+
innerShadows,
|
|
178
|
+
outline,
|
|
179
|
+
borderInsets,
|
|
180
|
+
borderRadius,
|
|
181
|
+
)
|
|
186
182
|
}
|
|
187
183
|
|
|
188
184
|
/* Android's elevation implementation requires this to be implemented to know where to draw the
|
|
@@ -222,41 +218,27 @@ internal class CompositeBackgroundDrawable(
|
|
|
222
218
|
}
|
|
223
219
|
}
|
|
224
220
|
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
221
|
+
companion object {
|
|
222
|
+
private fun createLayersArray(
|
|
223
|
+
originalBackground: Drawable?,
|
|
224
|
+
outerShadows: List<Drawable>,
|
|
225
|
+
cssBackground: CSSBackgroundDrawable?,
|
|
226
|
+
background: BackgroundDrawable?,
|
|
227
|
+
border: BorderDrawable?,
|
|
228
|
+
feedbackUnderlay: Drawable?,
|
|
229
|
+
innerShadows: List<Drawable>,
|
|
230
|
+
outline: OutlineDrawable?
|
|
231
|
+
): Array<Drawable?> {
|
|
232
|
+
val layers = mutableListOf<Drawable?>()
|
|
233
|
+
originalBackground?.let { layers.add(it) }
|
|
234
|
+
layers.addAll(outerShadows.asReversed())
|
|
235
|
+
cssBackground?.let { layers.add(it) }
|
|
236
|
+
background?.let { layers.add(it) }
|
|
237
|
+
border?.let { layers.add(it) }
|
|
238
|
+
feedbackUnderlay?.let { layers.add(it) }
|
|
239
|
+
layers.addAll(innerShadows.asReversed())
|
|
240
|
+
outline?.let { layers.add(it) }
|
|
241
|
+
return layers.toTypedArray()
|
|
235
242
|
}
|
|
236
|
-
return CompositeBackgroundDrawable(
|
|
237
|
-
context,
|
|
238
|
-
originalBackground,
|
|
239
|
-
outerShadows,
|
|
240
|
-
cssBackground,
|
|
241
|
-
background,
|
|
242
|
-
border,
|
|
243
|
-
feedbackUnderlay,
|
|
244
|
-
innerShadows,
|
|
245
|
-
outline)
|
|
246
|
-
.also { composite ->
|
|
247
|
-
composite.borderInsets = this.borderInsets
|
|
248
|
-
composite.borderRadius = this.borderRadius
|
|
249
|
-
}
|
|
250
|
-
}
|
|
251
|
-
|
|
252
|
-
private companion object {
|
|
253
|
-
private const val ORIGINAL_BACKGROUND_ID: Int = 0
|
|
254
|
-
private const val OUTER_SHADOWS_ID: Int = 1
|
|
255
|
-
private const val CSS_BACKGROUND_ID: Int = 2
|
|
256
|
-
private const val BACKGROUND_ID: Int = 3
|
|
257
|
-
private const val BORDER_ID: Int = 4
|
|
258
|
-
private const val FEEDBACK_UNDERLAY_ID: Int = 5
|
|
259
|
-
private const val INNER_SHADOWS_ID: Int = 6
|
|
260
|
-
private const val OUTLINE_ID: Int = 7
|
|
261
243
|
}
|
|
262
244
|
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
package com.facebook.react.uimanager.drawable
|
|
2
|
+
|
|
3
|
+
import android.annotation.TargetApi
|
|
4
|
+
import android.graphics.drawable.Drawable
|
|
5
|
+
import android.os.Build
|
|
6
|
+
import android.view.View
|
|
7
|
+
|
|
8
|
+
internal abstract class Drawable: Drawable() {
|
|
9
|
+
@TargetApi(Build.VERSION_CODES.M)
|
|
10
|
+
override fun getLayoutDirection(): Int {
|
|
11
|
+
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
|
12
|
+
return super.getLayoutDirection()
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
return View.LAYOUT_DIRECTION_LTR;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
package com.facebook.react.uimanager.drawable
|
|
2
|
+
|
|
3
|
+
import android.annotation.TargetApi
|
|
4
|
+
import android.graphics.drawable.Drawable
|
|
5
|
+
import android.graphics.drawable.LayerDrawable
|
|
6
|
+
import android.os.Build
|
|
7
|
+
import android.view.View
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
internal abstract class LayerDrawable(layers: Array<Drawable?>) : LayerDrawable(layers) {
|
|
11
|
+
@TargetApi(Build.VERSION_CODES.M)
|
|
12
|
+
override fun getLayoutDirection(): Int {
|
|
13
|
+
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
|
14
|
+
return super.getLayoutDirection()
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
return View.LAYOUT_DIRECTION_LTR;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
@@ -17,7 +17,6 @@ import android.graphics.Path
|
|
|
17
17
|
import android.graphics.PathEffect
|
|
18
18
|
import android.graphics.PixelFormat
|
|
19
19
|
import android.graphics.RectF
|
|
20
|
-
import android.graphics.drawable.Drawable
|
|
21
20
|
import com.facebook.react.uimanager.PixelUtil.pxToDp
|
|
22
21
|
import com.facebook.react.uimanager.style.BorderRadiusStyle
|
|
23
22
|
import com.facebook.react.uimanager.style.ComputedBorderRadius
|
|
@@ -124,7 +124,7 @@ public constructor(
|
|
|
124
124
|
}
|
|
125
125
|
}
|
|
126
126
|
|
|
127
|
-
@ReactProp(name = "defaultSource"
|
|
127
|
+
@ReactProp(name = "defaultSource")
|
|
128
128
|
public fun setDefaultSource(view: ReactImageView, source: String?) {
|
|
129
129
|
view.setDefaultSource(source)
|
|
130
130
|
}
|
package/ReactAndroid/src/main/java/com/facebook/react/views/scroll/ReactHorizontalScrollView.java
CHANGED
|
@@ -154,7 +154,7 @@ public class ReactHorizontalScrollView extends HorizontalScrollView
|
|
|
154
154
|
|
|
155
155
|
@Override
|
|
156
156
|
protected int computeScrollDeltaToGetChildRectOnScreen(Rect rect) {
|
|
157
|
-
if (mScrollEnabled) {
|
|
157
|
+
if (!mScrollEnabled) {
|
|
158
158
|
return 0;
|
|
159
159
|
}
|
|
160
160
|
return super.computeScrollDeltaToGetChildRectOnScreen(rect);
|
|
@@ -400,6 +400,14 @@ public class ReactScrollView extends ScrollView
|
|
|
400
400
|
}
|
|
401
401
|
}
|
|
402
402
|
|
|
403
|
+
@Override
|
|
404
|
+
protected int computeScrollDeltaToGetChildRectOnScreen(Rect rect) {
|
|
405
|
+
if (!mScrollEnabled) {
|
|
406
|
+
return 0;
|
|
407
|
+
}
|
|
408
|
+
return super.computeScrollDeltaToGetChildRectOnScreen(rect);
|
|
409
|
+
}
|
|
410
|
+
|
|
403
411
|
@Override
|
|
404
412
|
protected void onScrollChanged(int x, int y, int oldX, int oldY) {
|
|
405
413
|
Systrace.beginSection(Systrace.TRACE_TAG_REACT_JAVA_BRIDGE, "ReactScrollView.onScrollChanged");
|
package/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactBaseTextShadowNode.java
CHANGED
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
|
|
8
8
|
package com.facebook.react.views.text;
|
|
9
9
|
|
|
10
|
+
import android.annotation.TargetApi;
|
|
10
11
|
import android.graphics.Color;
|
|
11
12
|
import android.graphics.Typeface;
|
|
12
13
|
import android.os.Build;
|
|
@@ -66,6 +67,7 @@ import java.util.Map;
|
|
|
66
67
|
* <p>This also node calculates {@link Spannable} object based on subnodes of the same type, which
|
|
67
68
|
* can be used in concrete classes to feed native views and compute layout.
|
|
68
69
|
*/
|
|
70
|
+
@TargetApi(Build.VERSION_CODES.M)
|
|
69
71
|
public abstract class ReactBaseTextShadowNode extends LayoutShadowNode {
|
|
70
72
|
|
|
71
73
|
// Use a direction weak character so the placeholder doesn't change the direction of the previous
|
|
@@ -330,8 +332,10 @@ public abstract class ReactBaseTextShadowNode extends LayoutShadowNode {
|
|
|
330
332
|
|
|
331
333
|
protected int mNumberOfLines = ReactConstants.UNSET;
|
|
332
334
|
protected int mTextAlign = Gravity.NO_GRAVITY;
|
|
333
|
-
protected int mTextBreakStrategy =
|
|
334
|
-
|
|
335
|
+
protected int mTextBreakStrategy =
|
|
336
|
+
(Build.VERSION.SDK_INT < Build.VERSION_CODES.M) ? Layout.BREAK_STRATEGY_SIMPLE : Layout.BREAK_STRATEGY_HIGH_QUALITY;
|
|
337
|
+
protected int mHyphenationFrequency =
|
|
338
|
+
(Build.VERSION.SDK_INT < Build.VERSION_CODES.M) ? Layout.BREAK_STRATEGY_SIMPLE : Layout.HYPHENATION_FREQUENCY_NONE;
|
|
335
339
|
protected int mJustificationMode =
|
|
336
340
|
(Build.VERSION.SDK_INT < Build.VERSION_CODES.O) ? 0 : Layout.JUSTIFICATION_MODE_NONE;
|
|
337
341
|
|
|
@@ -573,6 +577,10 @@ public abstract class ReactBaseTextShadowNode extends LayoutShadowNode {
|
|
|
573
577
|
|
|
574
578
|
@ReactProp(name = ViewProps.TEXT_BREAK_STRATEGY)
|
|
575
579
|
public void setTextBreakStrategy(@Nullable String textBreakStrategy) {
|
|
580
|
+
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M) {
|
|
581
|
+
return;
|
|
582
|
+
}
|
|
583
|
+
|
|
576
584
|
if (textBreakStrategy == null || "highQuality".equals(textBreakStrategy)) {
|
|
577
585
|
mTextBreakStrategy = Layout.BREAK_STRATEGY_HIGH_QUALITY;
|
|
578
586
|
} else if ("simple".equals(textBreakStrategy)) {
|
|
@@ -224,21 +224,26 @@ public class ReactTextShadowNode extends ReactBaseTextShadowNode {
|
|
|
224
224
|
// Is used when the width is not known and the text is not boring, ie. if it contains
|
|
225
225
|
// unicode characters.
|
|
226
226
|
int hintWidth = (int) Math.ceil(desiredWidth);
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
227
|
+
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
|
228
|
+
StaticLayout.Builder builder =
|
|
229
|
+
StaticLayout.Builder.obtain(text, 0, text.length(), textPaint, (int) width)
|
|
230
|
+
.setAlignment(alignment)
|
|
231
|
+
.setLineSpacing(0.f, 1.f)
|
|
232
|
+
.setIncludePad(mIncludeFontPadding)
|
|
233
|
+
.setBreakStrategy(mTextBreakStrategy)
|
|
234
|
+
.setHyphenationFrequency(mHyphenationFrequency);
|
|
235
|
+
|
|
236
|
+
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
|
237
|
+
builder.setJustificationMode(mJustificationMode);
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
|
|
241
|
+
builder.setUseLineSpacingFromFallbacks(true);
|
|
242
|
+
}
|
|
243
|
+
layout = builder.build();
|
|
244
|
+
} else {
|
|
245
|
+
layout = new StaticLayout(text, textPaint, (int) width, alignment, 1.f, 0.f, mIncludeFontPadding);
|
|
240
246
|
}
|
|
241
|
-
layout = builder.build();
|
|
242
247
|
|
|
243
248
|
} else if (boring != null && (unconstrainedWidth || boring.width <= width)) {
|
|
244
249
|
// Is used for single-line, boring text when the width is either unknown or bigger
|
|
@@ -262,22 +267,26 @@ public class ReactTextShadowNode extends ReactBaseTextShadowNode {
|
|
|
262
267
|
width = (float) Math.ceil(width);
|
|
263
268
|
}
|
|
264
269
|
|
|
265
|
-
|
|
270
|
+
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
|
271
|
+
StaticLayout.Builder builder =
|
|
266
272
|
StaticLayout.Builder.obtain(text, 0, text.length(), textPaint, (int) width)
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
273
|
+
.setAlignment(alignment)
|
|
274
|
+
.setLineSpacing(0.f, 1.f)
|
|
275
|
+
.setIncludePad(mIncludeFontPadding)
|
|
276
|
+
.setBreakStrategy(mTextBreakStrategy)
|
|
277
|
+
.setHyphenationFrequency(mHyphenationFrequency);
|
|
278
|
+
|
|
279
|
+
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
|
280
|
+
builder.setJustificationMode(mJustificationMode);
|
|
281
|
+
}
|
|
276
282
|
|
|
277
|
-
|
|
278
|
-
|
|
283
|
+
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
|
|
284
|
+
builder.setUseLineSpacingFromFallbacks(true);
|
|
285
|
+
}
|
|
286
|
+
layout = builder.build();
|
|
287
|
+
} else {
|
|
288
|
+
layout = new StaticLayout(text, textPaint, (int) width, alignment, 1.f, 0.f, mIncludeFontPadding);
|
|
279
289
|
}
|
|
280
|
-
layout = builder.build();
|
|
281
290
|
}
|
|
282
291
|
return layout;
|
|
283
292
|
}
|
|
@@ -377,8 +377,8 @@ public class ReactTextView extends AppCompatTextView implements ReactCompoundVie
|
|
|
377
377
|
mMinimumFontSize,
|
|
378
378
|
mNumberOfLines,
|
|
379
379
|
getIncludeFontPadding(),
|
|
380
|
-
getBreakStrategy(),
|
|
381
|
-
getHyphenationFrequency(),
|
|
380
|
+
(Build.VERSION.SDK_INT < Build.VERSION_CODES.M) ? -1 :getBreakStrategy(),
|
|
381
|
+
(Build.VERSION.SDK_INT < Build.VERSION_CODES.M) ? -1 : getHyphenationFrequency(),
|
|
382
382
|
// always passing ALIGN_NORMAL here should be fine, since this method doesn't depend on
|
|
383
383
|
// how exactly lines are aligned, just their width
|
|
384
384
|
Layout.Alignment.ALIGN_NORMAL,
|
|
@@ -441,7 +441,7 @@ public class ReactTextView extends AppCompatTextView implements ReactCompoundVie
|
|
|
441
441
|
if (nextTextAlign != getGravityHorizontal()) {
|
|
442
442
|
setGravityHorizontal(nextTextAlign);
|
|
443
443
|
}
|
|
444
|
-
if (getBreakStrategy() != update.getTextBreakStrategy()) {
|
|
444
|
+
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M && getBreakStrategy() != update.getTextBreakStrategy()) {
|
|
445
445
|
setBreakStrategy(update.getTextBreakStrategy());
|
|
446
446
|
}
|
|
447
447
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
|
@@ -410,23 +410,26 @@ public class TextLayoutManager {
|
|
|
410
410
|
if (widthYogaMeasureMode == YogaMeasureMode.EXACTLY) {
|
|
411
411
|
desiredWidth = width;
|
|
412
412
|
}
|
|
413
|
-
|
|
414
413
|
int hintWidth = (int) Math.ceil(desiredWidth);
|
|
415
|
-
|
|
414
|
+
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
|
415
|
+
StaticLayout.Builder builder =
|
|
416
416
|
StaticLayout.Builder.obtain(text, 0, spanLength, paint, hintWidth)
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
417
|
+
.setAlignment(alignment)
|
|
418
|
+
.setLineSpacing(0.f, 1.f)
|
|
419
|
+
.setIncludePad(includeFontPadding)
|
|
420
|
+
.setBreakStrategy(textBreakStrategy)
|
|
421
|
+
.setHyphenationFrequency(hyphenationFrequency)
|
|
422
|
+
.setTextDirection(
|
|
423
|
+
isScriptRTL ? TextDirectionHeuristics.RTL : TextDirectionHeuristics.LTR);
|
|
424
|
+
|
|
425
|
+
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
|
|
426
|
+
builder.setUseLineSpacingFromFallbacks(true);
|
|
427
|
+
}
|
|
428
428
|
|
|
429
|
-
|
|
429
|
+
layout = builder.build();
|
|
430
|
+
} else {
|
|
431
|
+
layout = new StaticLayout(text, paint, hintWidth, alignment, 1.0f, 0.0f, includeFontPadding);
|
|
432
|
+
}
|
|
430
433
|
|
|
431
434
|
} else if (boring != null && (unconstrainedWidth || boring.width <= width)) {
|
|
432
435
|
int boringLayoutWidth = boring.width;
|
|
@@ -445,25 +448,29 @@ public class TextLayoutManager {
|
|
|
445
448
|
text, paint, boringLayoutWidth, alignment, 1.f, 0.f, boring, includeFontPadding);
|
|
446
449
|
} else {
|
|
447
450
|
// Is used for multiline, boring text and the width is known.
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
451
|
+
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
|
452
|
+
StaticLayout.Builder builder =
|
|
453
|
+
StaticLayout.Builder.obtain(text, 0, spanLength, paint, (int) Math.ceil(width))
|
|
454
|
+
.setAlignment(alignment)
|
|
455
|
+
.setLineSpacing(0.f, 1.f)
|
|
456
|
+
.setIncludePad(includeFontPadding)
|
|
457
|
+
.setBreakStrategy(textBreakStrategy)
|
|
458
|
+
.setHyphenationFrequency(hyphenationFrequency)
|
|
459
|
+
.setTextDirection(
|
|
460
|
+
isScriptRTL ? TextDirectionHeuristics.RTL : TextDirectionHeuristics.LTR);
|
|
461
|
+
|
|
462
|
+
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
|
463
|
+
builder.setJustificationMode(justificationMode);
|
|
464
|
+
}
|
|
461
465
|
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
466
|
+
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
|
|
467
|
+
builder.setUseLineSpacingFromFallbacks(true);
|
|
468
|
+
}
|
|
465
469
|
|
|
466
|
-
|
|
470
|
+
layout = builder.build();
|
|
471
|
+
} else {
|
|
472
|
+
layout = new StaticLayout(text, paint, (int) Math.ceil(width), alignment, 1.0f, 0.0f, includeFontPadding);
|
|
473
|
+
}
|
|
467
474
|
}
|
|
468
475
|
return layout;
|
|
469
476
|
}
|