react-native-tvos 0.77.0-0rc5 → 0.77.2-0
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/Components/TV/TVFocusGuideView.js +0 -1
- package/Libraries/Components/View/ViewPropTypes.d.ts +4 -2
- package/Libraries/Core/ReactNativeVersion.js +2 -2
- package/Libraries/Core/setUpDeveloperTools.js +2 -3
- package/Libraries/Image/Image.android.js +2 -0
- package/Libraries/Image/ImageViewNativeComponent.js +3 -4
- package/Libraries/Image/RCTImageLoader.mm +9 -1
- package/Libraries/Pressability/Pressability.js +2 -2
- package/Libraries/Text/TextInput/RCTBaseTextInputView.mm +1 -1
- package/Libraries/Utilities/HMRClient.js +0 -28
- package/Libraries/Utilities/HMRClientProdShim.js +0 -1
- package/React/Base/RCTConvert.mm +3 -1
- package/React/Base/RCTVersion.m +2 -2
- package/React/Fabric/Mounting/ComponentViews/ScrollView/RCTScrollViewComponentView.mm +85 -31
- package/React/Fabric/Mounting/ComponentViews/TextInput/RCTTextInputComponentView.mm +1 -7
- package/React/Fabric/Mounting/ComponentViews/View/RCTViewComponentView.mm +5 -2
- package/React/Views/RCTTVView.m +5 -2
- package/React/Views/ScrollView/RCTScrollView.m +63 -26
- package/ReactAndroid/api/ReactAndroid.api +3 -0
- package/ReactAndroid/cmake-utils/ReactNative-application.cmake +13 -3
- package/ReactAndroid/gradle.properties +3 -3
- package/ReactAndroid/src/main/AndroidManifest.xml +1 -1
- package/ReactAndroid/src/main/java/com/facebook/react/ReactActivity.java +8 -0
- package/ReactAndroid/src/main/java/com/facebook/react/ReactActivityDelegate.java +12 -1
- package/ReactAndroid/src/main/java/com/facebook/react/ReactDelegate.java +37 -0
- package/ReactAndroid/src/main/java/com/facebook/react/ReactFragment.java +6 -1
- package/ReactAndroid/src/main/java/com/facebook/react/bridge/BaseJavaModule.java +1 -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/fabric/mounting/MountingManager.java +15 -8
- 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 +141 -158
- 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/modal/ReactModalHostView.kt +22 -2
- 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/TextAttributeProps.java +16 -2
- 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/ReactViewGroup.java +1 -0
- package/ReactAndroid/src/main/java/com/facebook/react/views/view/ReactViewManager.kt +15 -0
- package/ReactCommon/cxxreact/ReactNativeVersion.h +2 -2
- package/ReactCommon/react/nativemodule/core/platform/ios/ReactCommon/RCTInteropTurboModule.mm +22 -4
- package/ReactCommon/react/nativemodule/core/platform/ios/ReactCommon/RCTTurboModule.h +5 -0
- package/ReactCommon/react/nativemodule/core/platform/ios/ReactCommon/RCTTurboModule.mm +51 -22
- package/ReactCommon/react/renderer/attributedstring/TextAttributes.cpp +6 -0
- package/ReactCommon/react/renderer/attributedstring/TextAttributes.h +2 -0
- package/ReactCommon/react/renderer/attributedstring/conversions.h +5 -0
- package/ReactCommon/react/renderer/components/text/BaseTextProps.cpp +12 -0
- package/ReactCommon/react/renderer/textlayoutmanager/TextMeasureCache.h +2 -3
- 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 +6 -46
- package/ReactCommon/react/renderer/textlayoutmanager/platform/ios/react/renderer/textlayoutmanager/RCTTextLayoutManager.mm +4 -5
- package/gradle/libs.versions.toml +1 -1
- package/package.json +15 -12
- 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/hermes-engine/hermes-utils.rb +2 -2
- package/sdks/hermesc/linux64-bin/hermesc +0 -0
- 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
- package/src/private/featureflags/ReactNativeFeatureFlags.js +2 -2
|
@@ -15,7 +15,7 @@ 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.
|
|
18
|
+
import com.facebook.react.uimanager.PixelUtil.dpToPx
|
|
19
19
|
import com.facebook.react.uimanager.style.BorderInsets
|
|
20
20
|
import com.facebook.react.uimanager.style.BorderRadiusStyle
|
|
21
21
|
|
|
@@ -30,10 +30,10 @@ internal class CompositeBackgroundDrawable(
|
|
|
30
30
|
* Any non-react-managed background already part of the view, like one set as Android style on a
|
|
31
31
|
* TextInput
|
|
32
32
|
*/
|
|
33
|
-
|
|
33
|
+
val originalBackground: Drawable? = null,
|
|
34
34
|
|
|
35
35
|
/** Non-inset box shadows */
|
|
36
|
-
outerShadows:
|
|
36
|
+
val outerShadows: List<Drawable> = emptyList(),
|
|
37
37
|
|
|
38
38
|
/**
|
|
39
39
|
* CSS background layer and border rendering
|
|
@@ -41,147 +41,144 @@ internal class CompositeBackgroundDrawable(
|
|
|
41
41
|
* TODO: we should extract path logic from here, and fast-path to using simpler drawables like
|
|
42
42
|
* ColorDrawable in the common cases
|
|
43
43
|
*/
|
|
44
|
-
|
|
44
|
+
val cssBackground: CSSBackgroundDrawable? = null,
|
|
45
45
|
|
|
46
46
|
/** Background rendering Layer */
|
|
47
|
-
background: BackgroundDrawable? = null,
|
|
47
|
+
val background: BackgroundDrawable? = null,
|
|
48
48
|
|
|
49
49
|
/** Border rendering Layer */
|
|
50
|
-
border: BorderDrawable? = null,
|
|
50
|
+
val border: BorderDrawable? = null,
|
|
51
51
|
|
|
52
52
|
/** TouchableNativeFeeback set selection background, like "SelectableBackground" */
|
|
53
|
-
feedbackUnderlay: Drawable? = null,
|
|
53
|
+
val feedbackUnderlay: Drawable? = null,
|
|
54
54
|
|
|
55
55
|
/** Inset box-shadows */
|
|
56
|
-
innerShadows:
|
|
56
|
+
val innerShadows: List<Drawable> = emptyList(),
|
|
57
57
|
|
|
58
58
|
/** Outline */
|
|
59
|
-
outline: OutlineDrawable? = null,
|
|
60
|
-
) : LayerDrawable(emptyArray()) {
|
|
61
|
-
public var outerShadows: LayerDrawable? = outerShadows
|
|
62
|
-
private set
|
|
59
|
+
val outline: OutlineDrawable? = null,
|
|
63
60
|
|
|
64
|
-
|
|
65
|
-
|
|
61
|
+
// Holder value for currently set insets
|
|
62
|
+
var borderInsets: BorderInsets? = null,
|
|
66
63
|
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
public var borderInsets: BorderInsets? = null
|
|
81
|
-
|
|
82
|
-
// Holder value for currently set border radius
|
|
83
|
-
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)) {
|
|
84
77
|
|
|
85
78
|
init {
|
|
86
79
|
// We want to overlay drawables, instead of placing future drawables within the content area of
|
|
87
80
|
// previous ones. E.g. an EditText style may set padding on a TextInput, but we don't want to
|
|
88
81
|
// constrain background color to the area inside of the padding.
|
|
89
82
|
setPaddingMode(LayerDrawable.PADDING_MODE_STACK)
|
|
90
|
-
|
|
91
|
-
addLayer(originalBackground, ORIGINAL_BACKGROUND_ID)
|
|
92
|
-
addLayer(outerShadows, OUTER_SHADOWS_ID)
|
|
93
|
-
addLayer(cssBackground, CSS_BACKGROUND_ID)
|
|
94
|
-
addLayer(background, BACKGROUND_ID)
|
|
95
|
-
addLayer(border, BORDER_ID)
|
|
96
|
-
addLayer(feedbackUnderlay, FEEDBACK_UNDERLAY_ID)
|
|
97
|
-
addLayer(innerShadows, INNER_SHADOWS_ID)
|
|
98
|
-
addLayer(outline, OUTLINE_ID)
|
|
99
83
|
}
|
|
100
84
|
|
|
101
|
-
|
|
102
|
-
cssBackground: CSSBackgroundDrawable?
|
|
103
|
-
): CompositeBackgroundDrawable {
|
|
85
|
+
fun withNewCssBackground(cssBackground: CSSBackgroundDrawable?): CompositeBackgroundDrawable {
|
|
104
86
|
return CompositeBackgroundDrawable(
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
}
|
|
87
|
+
context,
|
|
88
|
+
originalBackground,
|
|
89
|
+
outerShadows,
|
|
90
|
+
cssBackground,
|
|
91
|
+
background,
|
|
92
|
+
border,
|
|
93
|
+
feedbackUnderlay,
|
|
94
|
+
innerShadows,
|
|
95
|
+
outline,
|
|
96
|
+
borderInsets,
|
|
97
|
+
borderRadius,
|
|
98
|
+
)
|
|
118
99
|
}
|
|
119
100
|
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
public fun withNewOutline(outline: OutlineDrawable?): CompositeBackgroundDrawable =
|
|
136
|
-
withNewLayer(outline, OUTLINE_ID, this::outline::set)
|
|
137
|
-
|
|
138
|
-
/** @return true if the layer was updated, false if it was not */
|
|
139
|
-
private fun updateLayer(layer: Drawable?, id: Int): Boolean {
|
|
140
|
-
if (layer == null) {
|
|
141
|
-
return findDrawableByLayerId(id) == null
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
if (findDrawableByLayerId(id) == null) {
|
|
145
|
-
insertNewLayer(layer, id)
|
|
146
|
-
} else {
|
|
147
|
-
setDrawableByLayerId(id, layer)
|
|
148
|
-
}
|
|
149
|
-
invalidateSelf()
|
|
150
|
-
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
|
+
)
|
|
151
115
|
}
|
|
152
116
|
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
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
|
+
}
|
|
160
135
|
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
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
|
+
)
|
|
174
150
|
}
|
|
175
151
|
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
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
|
+
}
|
|
180
167
|
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
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
|
+
)
|
|
185
182
|
}
|
|
186
183
|
|
|
187
184
|
/* Android's elevation implementation requires this to be implemented to know where to draw the
|
|
@@ -200,14 +197,14 @@ internal class CompositeBackgroundDrawable(
|
|
|
200
197
|
pathForOutline.addRoundRect(
|
|
201
198
|
RectF(bounds),
|
|
202
199
|
floatArrayOf(
|
|
203
|
-
it.topLeft.horizontal + (computedBorderInsets?.left ?: 0f),
|
|
204
|
-
it.topLeft.vertical + (computedBorderInsets?.top ?: 0f),
|
|
205
|
-
it.topRight.horizontal + (computedBorderInsets?.right ?: 0f),
|
|
206
|
-
it.topRight.vertical + (computedBorderInsets?.top ?: 0f),
|
|
207
|
-
it.bottomRight.horizontal + (computedBorderInsets?.right ?: 0f),
|
|
208
|
-
it.bottomRight.vertical + (computedBorderInsets?.bottom ?: 0f),
|
|
209
|
-
it.bottomLeft.horizontal + (computedBorderInsets?.left ?: 0f),
|
|
210
|
-
it.bottomLeft.vertical
|
|
200
|
+
(it.topLeft.horizontal + (computedBorderInsets?.left ?: 0f)).dpToPx(),
|
|
201
|
+
(it.topLeft.vertical + (computedBorderInsets?.top ?: 0f)).dpToPx(),
|
|
202
|
+
(it.topRight.horizontal + (computedBorderInsets?.right ?: 0f)).dpToPx(),
|
|
203
|
+
(it.topRight.vertical + (computedBorderInsets?.top ?: 0f)).dpToPx(),
|
|
204
|
+
(it.bottomRight.horizontal + (computedBorderInsets?.right ?: 0f)).dpToPx(),
|
|
205
|
+
(it.bottomRight.vertical + (computedBorderInsets?.bottom ?: 0f)).dpToPx(),
|
|
206
|
+
(it.bottomLeft.horizontal + (computedBorderInsets?.left ?: 0f)).dpToPx(),
|
|
207
|
+
(it.bottomLeft.vertical + (computedBorderInsets?.bottom ?: 0f)).dpToPx()),
|
|
211
208
|
Path.Direction.CW)
|
|
212
209
|
}
|
|
213
210
|
|
|
@@ -221,41 +218,27 @@ internal class CompositeBackgroundDrawable(
|
|
|
221
218
|
}
|
|
222
219
|
}
|
|
223
220
|
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
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()
|
|
234
242
|
}
|
|
235
|
-
return CompositeBackgroundDrawable(
|
|
236
|
-
context,
|
|
237
|
-
originalBackground,
|
|
238
|
-
outerShadows,
|
|
239
|
-
cssBackground,
|
|
240
|
-
background,
|
|
241
|
-
border,
|
|
242
|
-
feedbackUnderlay,
|
|
243
|
-
innerShadows,
|
|
244
|
-
outline)
|
|
245
|
-
.also { composite ->
|
|
246
|
-
composite.borderInsets = this.borderInsets
|
|
247
|
-
composite.borderRadius = this.borderRadius
|
|
248
|
-
}
|
|
249
|
-
}
|
|
250
|
-
|
|
251
|
-
private companion object {
|
|
252
|
-
private const val ORIGINAL_BACKGROUND_ID: Int = 0
|
|
253
|
-
private const val OUTER_SHADOWS_ID: Int = 1
|
|
254
|
-
private const val CSS_BACKGROUND_ID: Int = 2
|
|
255
|
-
private const val BACKGROUND_ID: Int = 3
|
|
256
|
-
private const val BORDER_ID: Int = 4
|
|
257
|
-
private const val FEEDBACK_UNDERLAY_ID: Int = 5
|
|
258
|
-
private const val INNER_SHADOWS_ID: Int = 6
|
|
259
|
-
private const val OUTLINE_ID: Int = 7
|
|
260
243
|
}
|
|
261
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
|
}
|
|
@@ -29,6 +29,7 @@ import android.widget.FrameLayout
|
|
|
29
29
|
import androidx.annotation.UiThread
|
|
30
30
|
import com.facebook.common.logging.FLog
|
|
31
31
|
import com.facebook.react.R
|
|
32
|
+
import com.facebook.react.ReactActivity
|
|
32
33
|
import com.facebook.react.bridge.GuardedRunnable
|
|
33
34
|
import com.facebook.react.bridge.LifecycleEventListener
|
|
34
35
|
import com.facebook.react.bridge.ReactContext
|
|
@@ -275,12 +276,31 @@ public class ReactModalHostView(context: ThemedReactContext) :
|
|
|
275
276
|
// activity expects to receive those events and react to them, ie. in the case of
|
|
276
277
|
// the dev menu
|
|
277
278
|
val innerCurrentActivity =
|
|
278
|
-
(this@ReactModalHostView.context as ReactContext).currentActivity
|
|
279
|
+
(this@ReactModalHostView.context as ReactContext).currentActivity as? ReactActivity
|
|
279
280
|
if (innerCurrentActivity != null) {
|
|
280
|
-
return innerCurrentActivity.
|
|
281
|
+
return innerCurrentActivity.onDialogKeyUp(keyCode, event)
|
|
281
282
|
}
|
|
282
283
|
}
|
|
283
284
|
}
|
|
285
|
+
|
|
286
|
+
// @see https://github.com/react-native-tvos/react-native-tvos/issues/829
|
|
287
|
+
if (event.action == KeyEvent.ACTION_DOWN) {
|
|
288
|
+
// Allow BACK and ESCAPE keys to propagate to the dialog's activity.
|
|
289
|
+
// Returning false ensures these keys are not consumed here, so they
|
|
290
|
+
// can be processed during the ACTION_UP event where their functionality
|
|
291
|
+
// is handled by JavaScript.
|
|
292
|
+
if (keyCode == KeyEvent.KEYCODE_BACK || keyCode == KeyEvent.KEYCODE_ESCAPE) {
|
|
293
|
+
return false
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
// Redirect all other key down events to the current activity.
|
|
297
|
+
val innerCurrentActivity =
|
|
298
|
+
(this@ReactModalHostView.context as ReactContext).currentActivity as? ReactActivity
|
|
299
|
+
if (innerCurrentActivity != null) {
|
|
300
|
+
return innerCurrentActivity.onDialogKeyDown(keyCode, event)
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
|
|
284
304
|
return false
|
|
285
305
|
}
|
|
286
306
|
})
|
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) {
|
|
@@ -61,6 +61,7 @@ public class TextAttributeProps {
|
|
|
61
61
|
public static final short TA_KEY_LINE_BREAK_STRATEGY = 25;
|
|
62
62
|
public static final short TA_KEY_ROLE = 26;
|
|
63
63
|
public static final short TA_KEY_TEXT_TRANSFORM = 27;
|
|
64
|
+
public static final short TA_KEY_MAX_FONT_SIZE_MULTIPLIER = 29;
|
|
64
65
|
|
|
65
66
|
public static final int UNSET = -1;
|
|
66
67
|
|
|
@@ -81,6 +82,7 @@ public class TextAttributeProps {
|
|
|
81
82
|
protected float mLineHeight = Float.NaN;
|
|
82
83
|
protected boolean mIsColorSet = false;
|
|
83
84
|
protected boolean mAllowFontScaling = true;
|
|
85
|
+
protected float mMaxFontSizeMultiplier = Float.NaN;
|
|
84
86
|
protected int mColor;
|
|
85
87
|
protected boolean mIsBackgroundColorSet = false;
|
|
86
88
|
protected int mBackgroundColor;
|
|
@@ -227,6 +229,9 @@ public class TextAttributeProps {
|
|
|
227
229
|
case TA_KEY_TEXT_TRANSFORM:
|
|
228
230
|
result.setTextTransform(entry.getStringValue());
|
|
229
231
|
break;
|
|
232
|
+
case TA_KEY_MAX_FONT_SIZE_MULTIPLIER:
|
|
233
|
+
result.setMaxFontSizeMultiplier((float) entry.getDoubleValue());
|
|
234
|
+
break;
|
|
230
235
|
}
|
|
231
236
|
}
|
|
232
237
|
|
|
@@ -243,6 +248,8 @@ public class TextAttributeProps {
|
|
|
243
248
|
result.setLineHeight(getFloatProp(props, ViewProps.LINE_HEIGHT, ReactConstants.UNSET));
|
|
244
249
|
result.setLetterSpacing(getFloatProp(props, ViewProps.LETTER_SPACING, Float.NaN));
|
|
245
250
|
result.setAllowFontScaling(getBooleanProp(props, ViewProps.ALLOW_FONT_SCALING, true));
|
|
251
|
+
result.setMaxFontSizeMultiplier(
|
|
252
|
+
getFloatProp(props, ViewProps.MAX_FONT_SIZE_MULTIPLIER, Float.NaN));
|
|
246
253
|
result.setFontSize(getFloatProp(props, ViewProps.FONT_SIZE, ReactConstants.UNSET));
|
|
247
254
|
result.setColor(props.hasKey(ViewProps.COLOR) ? props.getInt(ViewProps.COLOR, 0) : null);
|
|
248
255
|
result.setColor(
|
|
@@ -411,7 +418,14 @@ public class TextAttributeProps {
|
|
|
411
418
|
mAllowFontScaling = allowFontScaling;
|
|
412
419
|
setFontSize(mFontSizeInput);
|
|
413
420
|
setLineHeight(mLineHeightInput);
|
|
414
|
-
|
|
421
|
+
}
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
private void setMaxFontSizeMultiplier(float maxFontSizeMultiplier) {
|
|
425
|
+
if (maxFontSizeMultiplier != mMaxFontSizeMultiplier) {
|
|
426
|
+
mMaxFontSizeMultiplier = maxFontSizeMultiplier;
|
|
427
|
+
setFontSize(mFontSizeInput);
|
|
428
|
+
setLineHeight(mLineHeightInput);
|
|
415
429
|
}
|
|
416
430
|
}
|
|
417
431
|
|
|
@@ -420,7 +434,7 @@ public class TextAttributeProps {
|
|
|
420
434
|
if (fontSize != ReactConstants.UNSET) {
|
|
421
435
|
fontSize =
|
|
422
436
|
mAllowFontScaling
|
|
423
|
-
? (float) Math.ceil(PixelUtil.toPixelFromSP(fontSize))
|
|
437
|
+
? (float) Math.ceil(PixelUtil.toPixelFromSP(fontSize, mMaxFontSizeMultiplier))
|
|
424
438
|
: (float) Math.ceil(PixelUtil.toPixelFromDIP(fontSize));
|
|
425
439
|
}
|
|
426
440
|
mFontSize = (int) fontSize;
|