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
|
@@ -608,6 +608,7 @@ public abstract class com/facebook/react/bridge/BaseJavaModule : com/facebook/re
|
|
|
608
608
|
protected final fun getReactApplicationContextIfActiveOrWarn ()Lcom/facebook/react/bridge/ReactApplicationContext;
|
|
609
609
|
public fun initialize ()V
|
|
610
610
|
public fun invalidate ()V
|
|
611
|
+
protected fun setEventEmitterCallback (Lcom/facebook/react/bridge/CxxCallbackImpl;)V
|
|
611
612
|
}
|
|
612
613
|
|
|
613
614
|
public abstract interface class com/facebook/react/bridge/BridgeReactContext$RCTDeviceEventEmitter : com/facebook/react/bridge/JavaScriptModule {
|
|
@@ -7443,6 +7444,7 @@ public class com/facebook/react/views/text/TextAttributeProps {
|
|
|
7443
7444
|
public static final field TA_KEY_LETTER_SPACING S
|
|
7444
7445
|
public static final field TA_KEY_LINE_BREAK_STRATEGY S
|
|
7445
7446
|
public static final field TA_KEY_LINE_HEIGHT S
|
|
7447
|
+
public static final field TA_KEY_MAX_FONT_SIZE_MULTIPLIER S
|
|
7446
7448
|
public static final field TA_KEY_OPACITY S
|
|
7447
7449
|
public static final field TA_KEY_ROLE S
|
|
7448
7450
|
public static final field TA_KEY_TEXT_DECORATION_COLOR S
|
|
@@ -7475,6 +7477,7 @@ public class com/facebook/react/views/text/TextAttributeProps {
|
|
|
7475
7477
|
protected field mLetterSpacingInput F
|
|
7476
7478
|
protected field mLineHeight F
|
|
7477
7479
|
protected field mLineHeightInput F
|
|
7480
|
+
protected field mMaxFontSizeMultiplier F
|
|
7478
7481
|
protected field mNumberOfLines I
|
|
7479
7482
|
protected field mOpacity F
|
|
7480
7483
|
protected field mRole Lcom/facebook/react/uimanager/ReactAccessibilityDelegate$Role;
|
|
@@ -39,9 +39,19 @@ if (PROJECT_ROOT_DIR)
|
|
|
39
39
|
# variable is defined if user need to access it.
|
|
40
40
|
endif ()
|
|
41
41
|
|
|
42
|
-
file(GLOB
|
|
43
|
-
|
|
44
|
-
|
|
42
|
+
file(GLOB override_cpp_SRC CONFIGURE_DEPENDS *.cpp)
|
|
43
|
+
# We check if the user is providing a custom OnLoad.cpp file. If so, we pick that
|
|
44
|
+
# for compilation. Otherwise we fallback to using the `default-app-setup/OnLoad.cpp`
|
|
45
|
+
# file instead.
|
|
46
|
+
if(override_cpp_SRC)
|
|
47
|
+
file(GLOB input_SRC CONFIGURE_DEPENDS
|
|
48
|
+
*.cpp
|
|
49
|
+
${BUILD_DIR}/generated/autolinking/src/main/jni/*.cpp)
|
|
50
|
+
else()
|
|
51
|
+
file(GLOB input_SRC CONFIGURE_DEPENDS
|
|
52
|
+
${REACT_ANDROID_DIR}/cmake-utils/default-app-setup/*.cpp
|
|
53
|
+
${BUILD_DIR}/generated/autolinking/src/main/jni/*.cpp)
|
|
54
|
+
endif()
|
|
45
55
|
|
|
46
56
|
add_library(${CMAKE_PROJECT_NAME} SHARED ${input_SRC})
|
|
47
57
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
VERSION_NAME=0.77.0
|
|
2
|
-
react.internal.publishingGroup=
|
|
1
|
+
VERSION_NAME=0.77.2-0
|
|
2
|
+
react.internal.publishingGroup=io.github.react-native-tvos
|
|
3
3
|
|
|
4
4
|
android.useAndroidX=true
|
|
5
5
|
|
|
@@ -31,4 +31,4 @@ binaryCompatibilityValidator.ignoredPackages=com.facebook.debug,\
|
|
|
31
31
|
binaryCompatibilityValidator.nonPublicMarkers=com.facebook.react.common.annotations.VisibleForTesting,\
|
|
32
32
|
com.facebook.react.common.annotations.UnstableReactNativeAPI
|
|
33
33
|
binaryCompatibilityValidator.validationDisabled=true
|
|
34
|
-
binaryCompatibilityValidator.outputApiFileName=ReactAndroid
|
|
34
|
+
binaryCompatibilityValidator.outputApiFileName=ReactAndroid
|
|
@@ -144,6 +144,14 @@ public abstract class ReactActivity extends AppCompatActivity
|
|
|
144
144
|
mDelegate.onConfigurationChanged(newConfig);
|
|
145
145
|
}
|
|
146
146
|
|
|
147
|
+
public boolean onDialogKeyUp(int keyCode, KeyEvent event) {
|
|
148
|
+
return mDelegate != null && mDelegate.onDialogKeyUp(keyCode, event);
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
public boolean onDialogKeyDown(int keyCode, KeyEvent event) {
|
|
152
|
+
return mDelegate != null && mDelegate.onDialogKeyDown(keyCode, event);
|
|
153
|
+
}
|
|
154
|
+
|
|
147
155
|
protected final ReactNativeHost getReactNativeHost() {
|
|
148
156
|
return mDelegate.getReactNativeHost();
|
|
149
157
|
}
|
|
@@ -199,6 +199,14 @@ public class ReactActivityDelegate {
|
|
|
199
199
|
return mReactDelegate.onBackPressed();
|
|
200
200
|
}
|
|
201
201
|
|
|
202
|
+
public boolean onDialogKeyUp(int keyCode, KeyEvent event) {
|
|
203
|
+
return mReactDelegate != null && mReactDelegate.onDialogKeyUp(keyCode, event);
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
public boolean onDialogKeyDown(int keyCode, KeyEvent event) {
|
|
207
|
+
return mReactDelegate != null && mReactDelegate.onDialogKeyDown(keyCode, event);
|
|
208
|
+
}
|
|
209
|
+
|
|
202
210
|
public boolean onNewIntent(Intent intent) {
|
|
203
211
|
return mReactDelegate.onNewIntent(intent);
|
|
204
212
|
}
|
|
@@ -214,7 +222,10 @@ public class ReactActivityDelegate {
|
|
|
214
222
|
public void requestPermissions(
|
|
215
223
|
String[] permissions, int requestCode, PermissionListener listener) {
|
|
216
224
|
mPermissionListener = listener;
|
|
217
|
-
|
|
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
|
+
}
|
|
218
229
|
}
|
|
219
230
|
|
|
220
231
|
public void onRequestPermissionsResult(
|
|
@@ -247,6 +247,43 @@ public class ReactDelegate {
|
|
|
247
247
|
return false;
|
|
248
248
|
}
|
|
249
249
|
|
|
250
|
+
/**
|
|
251
|
+
* Handles key up events for a dialog.
|
|
252
|
+
* <p>
|
|
253
|
+
* This method currently does not perform any action and always returns {@code false}. Subclasses
|
|
254
|
+
* can override this method to provide custom behavior.
|
|
255
|
+
* </p>
|
|
256
|
+
*
|
|
257
|
+
* @param keyCode the code of the key that was released
|
|
258
|
+
* @param event the {@link KeyEvent} object containing full information about the event
|
|
259
|
+
* @return {@code true} if the event was handled, {@code false} otherwise
|
|
260
|
+
*
|
|
261
|
+
* @see KeyEvent
|
|
262
|
+
* @see <a href="https://github.com/react-native-tvos/react-native-tvos/issues/829">GitHub Issue #829</a>
|
|
263
|
+
*/
|
|
264
|
+
public boolean onDialogKeyUp(int keyCode, KeyEvent event) {
|
|
265
|
+
return false;
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
/**
|
|
269
|
+
* Handles key down events for a dialog.
|
|
270
|
+
* <p>
|
|
271
|
+
* This method currently does not perform any action and always returns {@code false}. Subclasses
|
|
272
|
+
* can override this method to provide custom behavior.
|
|
273
|
+
* </p>
|
|
274
|
+
*
|
|
275
|
+
* @param keyCode the code of the key that was pressed
|
|
276
|
+
* @param event the {@link KeyEvent} object containing full information about the event
|
|
277
|
+
* @return {@code false} indicating the event was not handled
|
|
278
|
+
*
|
|
279
|
+
* @see KeyEvent
|
|
280
|
+
* @see <a href="https://github.com/react-native-tvos/react-native-tvos/issues/829">GitHub Issue #829</a>
|
|
281
|
+
*/
|
|
282
|
+
public boolean onDialogKeyDown(int keyCode, KeyEvent event) {
|
|
283
|
+
return false;
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
|
|
250
287
|
public void reload() {
|
|
251
288
|
DevSupportManager devSupportManager = getDevSupportManager();
|
|
252
289
|
if (devSupportManager == null) {
|
|
@@ -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
|
|
@@ -134,7 +134,7 @@ public abstract class BaseJavaModule implements NativeModule {
|
|
|
134
134
|
}
|
|
135
135
|
|
|
136
136
|
@DoNotStrip
|
|
137
|
-
|
|
137
|
+
protected void setEventEmitterCallback(CxxCallbackImpl eventEmitterCallback) {
|
|
138
138
|
mEventEmitterCallback = eventEmitterCallback;
|
|
139
139
|
}
|
|
140
140
|
}
|
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
|
/**
|
|
@@ -330,14 +330,11 @@ public class MountingManager {
|
|
|
330
330
|
@AnyThread
|
|
331
331
|
@ThreadConfined(ANY)
|
|
332
332
|
public @Nullable EventEmitterWrapper getEventEmitter(int surfaceId, int reactTag) {
|
|
333
|
-
SurfaceMountingManager
|
|
334
|
-
|
|
335
|
-
? getSurfaceManagerForView(reactTag)
|
|
336
|
-
: getSurfaceManager(surfaceId));
|
|
337
|
-
if (surfaceMountingManager == null) {
|
|
333
|
+
SurfaceMountingManager smm = getSurfaceMountingManager(surfaceId, reactTag);
|
|
334
|
+
if (smm == null) {
|
|
338
335
|
return null;
|
|
339
336
|
}
|
|
340
|
-
return
|
|
337
|
+
return smm.getEventEmitter(reactTag);
|
|
341
338
|
}
|
|
342
339
|
|
|
343
340
|
/**
|
|
@@ -434,11 +431,21 @@ public class MountingManager {
|
|
|
434
431
|
boolean canCoalesceEvent,
|
|
435
432
|
@Nullable WritableMap params,
|
|
436
433
|
@EventCategoryDef int eventCategory) {
|
|
437
|
-
|
|
434
|
+
SurfaceMountingManager smm = getSurfaceMountingManager(surfaceId, reactTag);
|
|
438
435
|
if (smm == null) {
|
|
439
|
-
|
|
436
|
+
FLog.d(
|
|
437
|
+
TAG,
|
|
438
|
+
"Cannot queue event without valid surface mounting manager for tag: %d, surfaceId: %d",
|
|
439
|
+
reactTag,
|
|
440
|
+
surfaceId);
|
|
440
441
|
return;
|
|
441
442
|
}
|
|
442
443
|
smm.enqueuePendingEvent(reactTag, eventName, canCoalesceEvent, params, eventCategory);
|
|
443
444
|
}
|
|
445
|
+
|
|
446
|
+
private @Nullable SurfaceMountingManager getSurfaceMountingManager(int surfaceId, int reactTag) {
|
|
447
|
+
return (surfaceId == ViewUtil.NO_SURFACE_ID
|
|
448
|
+
? getSurfaceManagerForView(reactTag)
|
|
449
|
+
: getSurfaceManager(surfaceId));
|
|
450
|
+
}
|
|
444
451
|
}
|
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;
|