react-native-tvos 0.77.1-0 → 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/Core/ReactNativeVersion.js +1 -1
- package/Libraries/Image/Image.android.js +2 -0
- package/Libraries/Image/ImageViewNativeComponent.js +3 -4
- package/React/Base/RCTVersion.m +1 -1
- 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 +1 -1
- 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/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 +1 -1
- 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
|
@@ -133,6 +133,7 @@ let BaseImage: AbstractImageAndroid = React.forwardRef(
|
|
|
133
133
|
width: undefined,
|
|
134
134
|
height: undefined,
|
|
135
135
|
};
|
|
136
|
+
const defaultSource = resolveAssetSource(props.defaultSource);
|
|
136
137
|
const loadingIndicatorSource = resolveAssetSource(
|
|
137
138
|
props.loadingIndicatorSource,
|
|
138
139
|
);
|
|
@@ -178,6 +179,7 @@ let BaseImage: AbstractImageAndroid = React.forwardRef(
|
|
|
178
179
|
/* $FlowFixMe(>=0.78.0 site=react_native_android_fb) This issue was found
|
|
179
180
|
* when making Flow check .android.js files. */
|
|
180
181
|
headers: (source?.[0]?.headers || source?.headers: ?{[string]: string}),
|
|
182
|
+
defaultSource: defaultSource ? defaultSource.uri : null,
|
|
181
183
|
loadingIndicatorSrc: loadingIndicatorSource
|
|
182
184
|
? loadingIndicatorSource.uri
|
|
183
185
|
: null,
|
|
@@ -21,6 +21,7 @@ import type {
|
|
|
21
21
|
} from '../StyleSheet/StyleSheet';
|
|
22
22
|
import type {ResolvedAssetSource} from './AssetSourceResolver';
|
|
23
23
|
import type {ImageProps} from './ImageProps';
|
|
24
|
+
import type {ImageSource} from './ImageSource';
|
|
24
25
|
|
|
25
26
|
import * as NativeComponentRegistry from '../NativeComponent/NativeComponentRegistry';
|
|
26
27
|
import {ConditionallyIgnoredEventHandlers} from '../NativeComponent/ViewConfigIgnore';
|
|
@@ -42,7 +43,7 @@ type Props = $ReadOnly<{
|
|
|
42
43
|
| ?ResolvedAssetSource
|
|
43
44
|
| ?$ReadOnlyArray<?$ReadOnly<{uri?: ?string, ...}>>,
|
|
44
45
|
headers?: ?{[string]: string},
|
|
45
|
-
|
|
46
|
+
defaultSource?: ?ImageSource | ?string,
|
|
46
47
|
loadingIndicatorSrc?: ?string,
|
|
47
48
|
}>;
|
|
48
49
|
|
|
@@ -82,9 +83,7 @@ export const __INTERNAL_VIEW_CONFIG: PartialViewConfig =
|
|
|
82
83
|
},
|
|
83
84
|
validAttributes: {
|
|
84
85
|
blurRadius: true,
|
|
85
|
-
defaultSource:
|
|
86
|
-
process: require('./resolveAssetSource'),
|
|
87
|
-
},
|
|
86
|
+
defaultSource: true,
|
|
88
87
|
internal_analyticTag: true,
|
|
89
88
|
resizeMethod: true,
|
|
90
89
|
resizeMode: true,
|
package/React/Base/RCTVersion.m
CHANGED
|
@@ -101,11 +101,7 @@ static NSSet<NSNumber *> *returnKeyTypesSet;
|
|
|
101
101
|
NSMutableDictionary<NSAttributedStringKey, id> *defaultAttributes =
|
|
102
102
|
[_backedTextInputView.defaultTextAttributes mutableCopy];
|
|
103
103
|
|
|
104
|
-
|
|
105
|
-
RCTWeakEventEmitterWrapper *eventEmitterWrapper = [RCTWeakEventEmitterWrapper new];
|
|
106
|
-
eventEmitterWrapper.eventEmitter = _eventEmitter;
|
|
107
|
-
defaultAttributes[RCTAttributedStringEventEmitterKey] = eventEmitterWrapper;
|
|
108
|
-
#endif
|
|
104
|
+
defaultAttributes[RCTAttributedStringEventEmitterKey] = RCTWrapEventEmitter(_eventEmitter);
|
|
109
105
|
|
|
110
106
|
_backedTextInputView.defaultTextAttributes = defaultAttributes;
|
|
111
107
|
}
|
|
@@ -266,10 +262,8 @@ static NSSet<NSNumber *> *returnKeyTypesSet;
|
|
|
266
262
|
if (newTextInputProps.textAttributes != oldTextInputProps.textAttributes) {
|
|
267
263
|
NSMutableDictionary<NSAttributedStringKey, id> *defaultAttributes =
|
|
268
264
|
RCTNSTextAttributesFromTextAttributes(newTextInputProps.getEffectiveTextAttributes(RCTFontSizeMultiplier()));
|
|
269
|
-
#if !TARGET_OS_MACCATALYST
|
|
270
265
|
defaultAttributes[RCTAttributedStringEventEmitterKey] =
|
|
271
266
|
_backedTextInputView.defaultTextAttributes[RCTAttributedStringEventEmitterKey];
|
|
272
|
-
#endif
|
|
273
267
|
_backedTextInputView.defaultTextAttributes = defaultAttributes;
|
|
274
268
|
}
|
|
275
269
|
|
|
@@ -222,7 +222,10 @@ public class ReactActivityDelegate {
|
|
|
222
222
|
public void requestPermissions(
|
|
223
223
|
String[] permissions, int requestCode, PermissionListener listener) {
|
|
224
224
|
mPermissionListener = listener;
|
|
225
|
-
|
|
225
|
+
// For Android API < 23, permissions are granted at install time.
|
|
226
|
+
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
|
227
|
+
getPlainActivity().requestPermissions(permissions, requestCode);
|
|
228
|
+
}
|
|
226
229
|
}
|
|
227
230
|
|
|
228
231
|
public void onRequestPermissionsResult(
|
|
@@ -9,6 +9,7 @@ package com.facebook.react;
|
|
|
9
9
|
|
|
10
10
|
import android.app.Activity;
|
|
11
11
|
import android.content.Intent;
|
|
12
|
+
import android.os.Build;
|
|
12
13
|
import android.os.Bundle;
|
|
13
14
|
import android.view.KeyEvent;
|
|
14
15
|
import android.view.LayoutInflater;
|
|
@@ -213,7 +214,11 @@ public class ReactFragment extends Fragment implements PermissionAwareActivity {
|
|
|
213
214
|
|
|
214
215
|
@Override
|
|
215
216
|
public int checkSelfPermission(String permission) {
|
|
216
|
-
|
|
217
|
+
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
|
218
|
+
return getActivity().checkSelfPermission(permission);
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
return getContext().checkPermission(permission, android.os.Process.myPid(), android.os.Process.myUid());
|
|
217
222
|
}
|
|
218
223
|
|
|
219
224
|
@Override
|
package/ReactAndroid/src/main/java/com/facebook/react/devsupport/DebugOverlayController.java
CHANGED
|
@@ -13,6 +13,7 @@ import android.content.pm.PackageInfo;
|
|
|
13
13
|
import android.content.pm.PackageManager;
|
|
14
14
|
import android.graphics.PixelFormat;
|
|
15
15
|
import android.net.Uri;
|
|
16
|
+
import android.os.Build;
|
|
16
17
|
import android.provider.Settings;
|
|
17
18
|
import android.view.WindowManager;
|
|
18
19
|
import android.widget.FrameLayout;
|
|
@@ -30,7 +31,7 @@ import com.facebook.react.common.ReactConstants;
|
|
|
30
31
|
|
|
31
32
|
public static void requestPermission(Context context) {
|
|
32
33
|
// Get permission to show debug overlay in dev builds.
|
|
33
|
-
if (!Settings.canDrawOverlays(context)) {
|
|
34
|
+
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M && !Settings.canDrawOverlays(context)) {
|
|
34
35
|
Intent intent =
|
|
35
36
|
new Intent(
|
|
36
37
|
Settings.ACTION_MANAGE_OVERLAY_PERMISSION,
|
|
@@ -49,7 +50,11 @@ import com.facebook.react.common.ReactConstants;
|
|
|
49
50
|
private static boolean permissionCheck(Context context) {
|
|
50
51
|
// Get permission to show debug overlay in dev builds.
|
|
51
52
|
// overlay permission not yet granted
|
|
52
|
-
|
|
53
|
+
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
|
54
|
+
return Settings.canDrawOverlays(context);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
return true;
|
|
53
58
|
}
|
|
54
59
|
|
|
55
60
|
private static boolean hasPermission(Context context, String permission) {
|
|
@@ -445,12 +445,18 @@ public class FabricUIManager
|
|
|
445
445
|
|
|
446
446
|
@Override
|
|
447
447
|
public void markActiveTouchForTag(int surfaceId, int reactTag) {
|
|
448
|
-
mMountingManager.getSurfaceManager(surfaceId)
|
|
448
|
+
SurfaceMountingManager surfaceMountingManager = mMountingManager.getSurfaceManager(surfaceId);
|
|
449
|
+
if (surfaceMountingManager != null) {
|
|
450
|
+
surfaceMountingManager.markActiveTouchForTag(reactTag);
|
|
451
|
+
}
|
|
449
452
|
}
|
|
450
453
|
|
|
451
454
|
@Override
|
|
452
455
|
public void sweepActiveTouchForTag(int surfaceId, int reactTag) {
|
|
453
|
-
mMountingManager.getSurfaceManager(surfaceId)
|
|
456
|
+
SurfaceMountingManager surfaceMountingManager = mMountingManager.getSurfaceManager(surfaceId);
|
|
457
|
+
if (surfaceMountingManager != null) {
|
|
458
|
+
surfaceMountingManager.sweepActiveTouchForTag(reactTag);
|
|
459
|
+
}
|
|
454
460
|
}
|
|
455
461
|
|
|
456
462
|
/**
|
package/ReactAndroid/src/main/java/com/facebook/react/modules/i18nmanager/I18nManagerModule.kt
CHANGED
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
|
|
8
8
|
package com.facebook.react.modules.i18nmanager
|
|
9
9
|
|
|
10
|
+
import android.os.Build
|
|
10
11
|
import com.facebook.fbreact.specs.NativeI18nManagerSpec
|
|
11
12
|
import com.facebook.react.bridge.ReactApplicationContext
|
|
12
13
|
import com.facebook.react.module.annotations.ReactModule
|
|
@@ -16,7 +17,11 @@ import com.facebook.react.module.annotations.ReactModule
|
|
|
16
17
|
public class I18nManagerModule(context: ReactApplicationContext?) : NativeI18nManagerSpec(context) {
|
|
17
18
|
override public fun getTypedExportedConstants(): Map<String, Any> {
|
|
18
19
|
val context = getReactApplicationContext()
|
|
19
|
-
val locale =
|
|
20
|
+
val locale = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
|
|
21
|
+
context.resources.configuration.locales[0]
|
|
22
|
+
} else {
|
|
23
|
+
context.resources.configuration.locale
|
|
24
|
+
}
|
|
20
25
|
|
|
21
26
|
return mapOf(
|
|
22
27
|
"isRTL" to I18nUtil.instance.isRTL(context),
|
package/ReactAndroid/src/main/java/com/facebook/react/modules/permissions/PermissionsModule.kt
CHANGED
|
@@ -8,7 +8,10 @@
|
|
|
8
8
|
package com.facebook.react.modules.permissions
|
|
9
9
|
|
|
10
10
|
import android.app.Activity
|
|
11
|
+
import android.content.Context
|
|
11
12
|
import android.content.pm.PackageManager
|
|
13
|
+
import android.os.Build
|
|
14
|
+
import android.os.Process
|
|
12
15
|
import android.util.SparseArray
|
|
13
16
|
import com.facebook.common.logging.FLog
|
|
14
17
|
import com.facebook.fbreact.specs.NativePermissionsAndroidSpec
|
|
@@ -20,7 +23,7 @@ import com.facebook.react.bridge.WritableNativeMap
|
|
|
20
23
|
import com.facebook.react.module.annotations.ReactModule
|
|
21
24
|
import com.facebook.react.modules.core.PermissionAwareActivity
|
|
22
25
|
import com.facebook.react.modules.core.PermissionListener
|
|
23
|
-
|
|
26
|
+
|
|
24
27
|
|
|
25
28
|
/** Module that exposes the Android M Permission system to JS. */
|
|
26
29
|
@ReactModule(name = NativePermissionsAndroidSpec.NAME)
|
|
@@ -33,13 +36,21 @@ public class PermissionsModule(reactContext: ReactApplicationContext?) :
|
|
|
33
36
|
private val DENIED = "denied"
|
|
34
37
|
private val NEVER_ASK_AGAIN = "never_ask_again"
|
|
35
38
|
|
|
39
|
+
private fun checkSelfPermission(context: Context, permission: String): Int {
|
|
40
|
+
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
|
41
|
+
return context.checkSelfPermission(permission)
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
return context.checkPermission(permission, Process.myPid(), Process.myUid())
|
|
45
|
+
}
|
|
46
|
+
|
|
36
47
|
/**
|
|
37
48
|
* Check if the app has the permission given. successCallback is called with true if the
|
|
38
49
|
* permission had been granted, false otherwise. See [Activity.checkSelfPermission].
|
|
39
50
|
*/
|
|
40
51
|
override public fun checkPermission(permission: String, promise: Promise): Unit {
|
|
41
52
|
val context = getReactApplicationContext().getBaseContext()
|
|
42
|
-
promise.resolve(
|
|
53
|
+
promise.resolve(checkSelfPermission(context, permission) == PackageManager.PERMISSION_GRANTED)
|
|
43
54
|
}
|
|
44
55
|
|
|
45
56
|
/**
|
|
@@ -69,7 +80,7 @@ public class PermissionsModule(reactContext: ReactApplicationContext?) :
|
|
|
69
80
|
*/
|
|
70
81
|
override public fun requestPermission(permission: String, promise: Promise): Unit {
|
|
71
82
|
val context = getReactApplicationContext().getBaseContext()
|
|
72
|
-
if (
|
|
83
|
+
if (checkSelfPermission(context, permission) == PackageManager.PERMISSION_GRANTED) {
|
|
73
84
|
promise.resolve(GRANTED)
|
|
74
85
|
return
|
|
75
86
|
}
|
|
@@ -109,7 +120,7 @@ public class PermissionsModule(reactContext: ReactApplicationContext?) :
|
|
|
109
120
|
val context = getReactApplicationContext().getBaseContext()
|
|
110
121
|
for (i in 0 until permissions.size()) {
|
|
111
122
|
val perm = permissions.getString(i) ?: continue
|
|
112
|
-
if (
|
|
123
|
+
if (checkSelfPermission(context, perm) == PackageManager.PERMISSION_GRANTED) {
|
|
113
124
|
grantedPermissions.putString(perm, GRANTED)
|
|
114
125
|
checkedPermissionsCount++
|
|
115
126
|
} else {
|
package/ReactAndroid/src/main/java/com/facebook/react/uimanager/BackgroundStyleApplicator.kt
CHANGED
|
@@ -13,7 +13,6 @@ import android.graphics.Path
|
|
|
13
13
|
import android.graphics.Rect
|
|
14
14
|
import android.graphics.RectF
|
|
15
15
|
import android.graphics.drawable.Drawable
|
|
16
|
-
import android.graphics.drawable.LayerDrawable
|
|
17
16
|
import android.os.Build
|
|
18
17
|
import android.view.View
|
|
19
18
|
import android.widget.ImageView
|
|
@@ -106,14 +105,10 @@ public object BackgroundStyleApplicator {
|
|
|
106
105
|
|
|
107
106
|
composite.borderInsets = composite.borderInsets ?: BorderInsets()
|
|
108
107
|
composite.borderInsets?.setBorderWidth(edge, width)
|
|
108
|
+
|
|
109
109
|
if (Build.VERSION.SDK_INT >= MIN_INSET_BOX_SHADOW_SDK_VERSION) {
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
for (i in 0 until innerShadows.numberOfLayers) {
|
|
113
|
-
val shadow = innerShadows.getDrawable(i)
|
|
114
|
-
(shadow as InsetBoxShadowDrawable).borderInsets = composite.borderInsets
|
|
115
|
-
shadow.invalidateSelf()
|
|
116
|
-
}
|
|
110
|
+
for (shadow in composite.innerShadows.filterIsInstance<InsetBoxShadowDrawable>()) {
|
|
111
|
+
shadow.borderInsets = composite.borderInsets
|
|
117
112
|
}
|
|
118
113
|
}
|
|
119
114
|
}
|
|
@@ -174,30 +169,16 @@ public object BackgroundStyleApplicator {
|
|
|
174
169
|
}
|
|
175
170
|
|
|
176
171
|
if (Build.VERSION.SDK_INT >= MIN_OUTSET_BOX_SHADOW_SDK_VERSION) {
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
val shadow = outerShadows.getDrawable(i)
|
|
181
|
-
if (shadow is OutsetBoxShadowDrawable) {
|
|
182
|
-
shadow.borderRadius = shadow.borderRadius ?: BorderRadiusStyle()
|
|
183
|
-
shadow.borderRadius?.set(corner, radius)
|
|
184
|
-
shadow.invalidateSelf()
|
|
185
|
-
}
|
|
186
|
-
}
|
|
172
|
+
for (shadow in
|
|
173
|
+
compositeBackgroundDrawable.outerShadows.filterIsInstance<OutsetBoxShadowDrawable>()) {
|
|
174
|
+
shadow.borderRadius = compositeBackgroundDrawable.borderRadius
|
|
187
175
|
}
|
|
188
176
|
}
|
|
189
177
|
|
|
190
178
|
if (Build.VERSION.SDK_INT >= MIN_INSET_BOX_SHADOW_SDK_VERSION) {
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
val shadow = innerShadows.getDrawable(i)
|
|
195
|
-
if (shadow is InsetBoxShadowDrawable) {
|
|
196
|
-
shadow.borderRadius = shadow.borderRadius ?: BorderRadiusStyle()
|
|
197
|
-
shadow.borderRadius?.set(corner, radius)
|
|
198
|
-
shadow.invalidateSelf()
|
|
199
|
-
}
|
|
200
|
-
}
|
|
179
|
+
for (shadow in
|
|
180
|
+
compositeBackgroundDrawable.innerShadows.filterIsInstance<InsetBoxShadowDrawable>()) {
|
|
181
|
+
shadow.borderRadius = compositeBackgroundDrawable.borderRadius
|
|
201
182
|
}
|
|
202
183
|
}
|
|
203
184
|
|
|
@@ -291,14 +272,18 @@ public object BackgroundStyleApplicator {
|
|
|
291
272
|
return
|
|
292
273
|
}
|
|
293
274
|
|
|
294
|
-
var innerShadows
|
|
295
|
-
var outerShadows
|
|
275
|
+
var innerShadows = mutableListOf<InsetBoxShadowDrawable>()
|
|
276
|
+
var outerShadows = mutableListOf<OutsetBoxShadowDrawable>()
|
|
296
277
|
|
|
297
278
|
val compositeBackgroundDrawable = ensureCompositeBackgroundDrawable(view)
|
|
298
279
|
val borderInsets = compositeBackgroundDrawable.borderInsets
|
|
299
280
|
val borderRadius = compositeBackgroundDrawable.borderRadius
|
|
300
281
|
|
|
301
|
-
|
|
282
|
+
/**
|
|
283
|
+
* z-ordering of user-provided shadow-list is opposite direction of LayerDrawable z-ordering
|
|
284
|
+
* https://drafts.csswg.org/css-backgrounds/#shadow-layers
|
|
285
|
+
*/
|
|
286
|
+
for (boxShadow in shadows) {
|
|
302
287
|
val offsetX = boxShadow.offsetX
|
|
303
288
|
val offsetY = boxShadow.offsetY
|
|
304
289
|
val color = boxShadow.color ?: Color.BLACK
|
|
@@ -307,10 +292,7 @@ public object BackgroundStyleApplicator {
|
|
|
307
292
|
val inset = boxShadow.inset ?: false
|
|
308
293
|
|
|
309
294
|
if (inset && Build.VERSION.SDK_INT >= MIN_INSET_BOX_SHADOW_SDK_VERSION) {
|
|
310
|
-
|
|
311
|
-
innerShadows = LayerDrawable(emptyArray())
|
|
312
|
-
}
|
|
313
|
-
innerShadows.addLayer(
|
|
295
|
+
innerShadows.add(
|
|
314
296
|
InsetBoxShadowDrawable(
|
|
315
297
|
context = view.context,
|
|
316
298
|
borderRadius = borderRadius,
|
|
@@ -321,10 +303,7 @@ public object BackgroundStyleApplicator {
|
|
|
321
303
|
blurRadius = blurRadius,
|
|
322
304
|
spread = spreadDistance))
|
|
323
305
|
} else if (!inset && Build.VERSION.SDK_INT >= MIN_OUTSET_BOX_SHADOW_SDK_VERSION) {
|
|
324
|
-
|
|
325
|
-
outerShadows = LayerDrawable(emptyArray())
|
|
326
|
-
}
|
|
327
|
-
outerShadows.addLayer(
|
|
306
|
+
outerShadows.add(
|
|
328
307
|
OutsetBoxShadowDrawable(
|
|
329
308
|
context = view.context,
|
|
330
309
|
borderRadius = borderRadius,
|
|
@@ -336,8 +315,9 @@ public object BackgroundStyleApplicator {
|
|
|
336
315
|
}
|
|
337
316
|
}
|
|
338
317
|
|
|
339
|
-
view.background =
|
|
340
|
-
|
|
318
|
+
view.background =
|
|
319
|
+
ensureCompositeBackgroundDrawable(view)
|
|
320
|
+
.withNewShadows(outerShadows = outerShadows, innerShadows = innerShadows)
|
|
341
321
|
}
|
|
342
322
|
|
|
343
323
|
@JvmStatic
|
package/ReactAndroid/src/main/java/com/facebook/react/uimanager/drawable/BackgroundDrawable.kt
CHANGED
|
@@ -19,7 +19,6 @@ import android.graphics.PorterDuff
|
|
|
19
19
|
import android.graphics.Rect
|
|
20
20
|
import android.graphics.RectF
|
|
21
21
|
import android.graphics.Shader
|
|
22
|
-
import android.graphics.drawable.Drawable
|
|
23
22
|
import com.facebook.react.uimanager.PixelUtil.dpToPx
|
|
24
23
|
import com.facebook.react.uimanager.PixelUtil.pxToDp
|
|
25
24
|
import com.facebook.react.uimanager.style.BackgroundImageLayer
|
|
@@ -20,7 +20,6 @@ import android.graphics.PointF
|
|
|
20
20
|
import android.graphics.Rect
|
|
21
21
|
import android.graphics.RectF
|
|
22
22
|
import android.graphics.Region
|
|
23
|
-
import android.graphics.drawable.Drawable
|
|
24
23
|
import android.os.Build
|
|
25
24
|
import com.facebook.react.uimanager.FloatUtil.floatsEqual
|
|
26
25
|
import com.facebook.react.uimanager.LengthPercentage
|
package/ReactAndroid/src/main/java/com/facebook/react/uimanager/drawable/CSSBackgroundDrawable.java
CHANGED
|
@@ -25,7 +25,6 @@ import android.graphics.Rect;
|
|
|
25
25
|
import android.graphics.RectF;
|
|
26
26
|
import android.graphics.Region;
|
|
27
27
|
import android.graphics.Shader;
|
|
28
|
-
import android.graphics.drawable.Drawable;
|
|
29
28
|
import android.view.View;
|
|
30
29
|
import androidx.annotation.Nullable;
|
|
31
30
|
import androidx.core.graphics.ColorUtils;
|