react-native 0.80.0-rc.2 → 0.80.0-rc.3

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.
@@ -17,5 +17,5 @@ export const version: $ReadOnly<{
17
17
  major: 0,
18
18
  minor: 80,
19
19
  patch: 0,
20
- prerelease: 'rc.2',
20
+ prerelease: 'rc.3',
21
21
  };
@@ -24,7 +24,7 @@ NSDictionary* RCTGetReactNativeVersion(void)
24
24
  RCTVersionMajor: @(0),
25
25
  RCTVersionMinor: @(80),
26
26
  RCTVersionPatch: @(0),
27
- RCTVersionPrerelease: @"rc.2",
27
+ RCTVersionPrerelease: @"rc.3",
28
28
  };
29
29
  });
30
30
  return __rnVersion;
@@ -5123,13 +5123,13 @@ public final class com/facebook/react/uimanager/events/TouchEventType$Companion
5123
5123
  public final fun getJSEventName (Lcom/facebook/react/uimanager/events/TouchEventType;)Ljava/lang/String;
5124
5124
  }
5125
5125
 
5126
- public final class com/facebook/react/uimanager/layoutanimation/LayoutAnimationController {
5126
+ public class com/facebook/react/uimanager/layoutanimation/LayoutAnimationController {
5127
5127
  public fun <init> ()V
5128
- public final fun applyLayoutUpdate (Landroid/view/View;IIII)V
5129
- public final fun deleteView (Landroid/view/View;Lcom/facebook/react/uimanager/layoutanimation/LayoutAnimationListener;)V
5128
+ public fun applyLayoutUpdate (Landroid/view/View;IIII)V
5129
+ public fun deleteView (Landroid/view/View;Lcom/facebook/react/uimanager/layoutanimation/LayoutAnimationListener;)V
5130
5130
  public final fun initializeFromConfig (Lcom/facebook/react/bridge/ReadableMap;Lcom/facebook/react/bridge/Callback;)V
5131
- public final fun reset ()V
5132
- public final fun shouldAnimateLayout (Landroid/view/View;)Z
5131
+ public fun reset ()V
5132
+ public fun shouldAnimateLayout (Landroid/view/View;)Z
5133
5133
  }
5134
5134
 
5135
5135
  public abstract interface class com/facebook/react/uimanager/layoutanimation/LayoutAnimationListener {
@@ -6565,7 +6565,6 @@ public class com/facebook/react/views/textinput/ReactEditText : androidx/appcomp
6565
6565
  public fun addTextChangedListener (Landroid/text/TextWatcher;)V
6566
6566
  protected final fun applyTextAttributes ()V
6567
6567
  public final fun canUpdateWithEventCount (I)Z
6568
- public fun clearFocus ()V
6569
6568
  protected final fun finalize ()V
6570
6569
  public final fun getBorderColor (I)I
6571
6570
  protected final fun getContainsImages ()Z
@@ -1,4 +1,4 @@
1
- VERSION_NAME=0.80.0-rc.2
1
+ VERSION_NAME=0.80.0-rc.3
2
2
  react.internal.publishingGroup=com.facebook.react
3
3
 
4
4
  android.useAndroidX=true
@@ -15,6 +15,6 @@ public object ReactNativeVersion {
15
15
  "major" to 0,
16
16
  "minor" to 80,
17
17
  "patch" to 0,
18
- "prerelease" to "rc.2"
18
+ "prerelease" to "rc.3"
19
19
  )
20
20
  }
@@ -29,7 +29,7 @@ import javax.annotation.concurrent.NotThreadSafe
29
29
  */
30
30
  @NotThreadSafe
31
31
  @LegacyArchitecture
32
- public class LayoutAnimationController {
32
+ public open class LayoutAnimationController {
33
33
  private val layoutCreateAnimation: AbstractLayoutAnimation = LayoutCreateAnimation()
34
34
  private val layoutUpdateAnimation: AbstractLayoutAnimation = LayoutUpdateAnimation()
35
35
  private val layoutDeleteAnimation: AbstractLayoutAnimation = LayoutDeleteAnimation()
@@ -68,7 +68,7 @@ public class LayoutAnimationController {
68
68
  }
69
69
  }
70
70
 
71
- public fun reset() {
71
+ public open fun reset() {
72
72
  layoutCreateAnimation.reset()
73
73
  layoutUpdateAnimation.reset()
74
74
  layoutDeleteAnimation.reset()
@@ -83,7 +83,7 @@ public class LayoutAnimationController {
83
83
  }
84
84
  }
85
85
 
86
- public fun shouldAnimateLayout(viewToAnimate: View?): Boolean {
86
+ public open fun shouldAnimateLayout(viewToAnimate: View?): Boolean {
87
87
  // if view parent is null, skip animation: view have been clipped, we don't want animation to
88
88
  // resume when view is re-attached to parent, which is the standard android animation behavior.
89
89
  // If there's a layout handling animation going on, it should be animated nonetheless since the
@@ -106,7 +106,7 @@ public class LayoutAnimationController {
106
106
  * @param width the new width value for the view
107
107
  * @param height the new height value for the view
108
108
  */
109
- public fun applyLayoutUpdate(view: View, x: Int, y: Int, width: Int, height: Int) {
109
+ public open fun applyLayoutUpdate(view: View, x: Int, y: Int, width: Int, height: Int) {
110
110
  assertOnUiThread()
111
111
 
112
112
  val reactTag = view.id
@@ -167,7 +167,7 @@ public class LayoutAnimationController {
167
167
  * @param listener Called once the animation is finished, should be used to completely remove the
168
168
  * view.
169
169
  */
170
- public fun deleteView(view: View, listener: LayoutAnimationListener) {
170
+ public open fun deleteView(view: View, listener: LayoutAnimationListener) {
171
171
  assertOnUiThread()
172
172
 
173
173
  val animation =
@@ -35,6 +35,7 @@ import android.view.Menu
35
35
  import android.view.MenuItem
36
36
  import android.view.MotionEvent
37
37
  import android.view.View
38
+ import android.view.ViewGroup
38
39
  import android.view.accessibility.AccessibilityNodeInfo
39
40
  import android.view.inputmethod.EditorInfo
40
41
  import android.view.inputmethod.InputConnection
@@ -359,11 +360,26 @@ public open class ReactEditText public constructor(context: Context) : AppCompat
359
360
  super.onTextContextMenuItem(
360
361
  if (id == android.R.id.paste) android.R.id.pasteAsPlainText else id)
361
362
 
362
- override fun clearFocus() {
363
- super.clearFocus()
363
+ internal fun clearFocusAndMaybeRefocus() {
364
+ if (Build.VERSION.SDK_INT > Build.VERSION_CODES.P || !isInTouchMode) {
365
+ super.clearFocus()
366
+ } else {
367
+ // Avoid refocusing to a new view on old versions of Android by default
368
+ // by preventing `requestFocus()` on the rootView from moving focus to any child.
369
+ // https://cs.android.com/android/_/android/platform/frameworks/base/+/bdc66cb5a0ef513f4306edf9156cc978b08e06e4
370
+ val rootViewGroup = rootView as ViewGroup
371
+ val oldDescendantFocusability = rootViewGroup.descendantFocusability
372
+ rootViewGroup.descendantFocusability = ViewGroup.FOCUS_BLOCK_DESCENDANTS
373
+ super.clearFocus()
374
+ rootViewGroup.descendantFocusability = oldDescendantFocusability
375
+ }
364
376
  hideSoftKeyboard()
365
377
  }
366
378
 
379
+ internal fun clearFocusFromJS() {
380
+ clearFocusAndMaybeRefocus()
381
+ }
382
+
367
383
  // For cases like autoFocus, or ref.focus() where we request focus programmatically and not
368
384
  // through
369
385
  // interacting with the EditText directly (like clicking on it). We cannot use stock
@@ -598,10 +614,6 @@ public open class ReactEditText public constructor(context: Context) : AppCompat
598
614
  requestFocusProgrammatically()
599
615
  }
600
616
 
601
- internal fun clearFocusFromJS() {
602
- clearFocus()
603
- }
604
-
605
617
  public fun incrementAndGetEventCounter(): Int = ++nativeEventCount
606
618
 
607
619
  public fun maybeSetTextFromJS(reactTextUpdate: ReactTextUpdate) {
@@ -926,7 +926,7 @@ public open class ReactTextInputManager public constructor() :
926
926
  }
927
927
 
928
928
  if (shouldBlur) {
929
- editText.clearFocus()
929
+ editText.clearFocusAndMaybeRefocus()
930
930
  }
931
931
 
932
932
  // Prevent default behavior except when we want it to insert a newline.
@@ -22,7 +22,7 @@ constexpr struct {
22
22
  int32_t Major = 0;
23
23
  int32_t Minor = 80;
24
24
  int32_t Patch = 0;
25
- std::string_view Prerelease = "rc.2";
25
+ std::string_view Prerelease = "rc.3";
26
26
  } ReactNativeVersion;
27
27
 
28
28
  } // namespace facebook::react
@@ -242,8 +242,9 @@ void TimerManager::attachGlobals(jsi::Runtime& runtime) {
242
242
  }
243
243
 
244
244
  if (!args[0].isObject() || !args[0].asObject(rt).isFunction(rt)) {
245
- // Do not throw any error to match web spec
246
- return timerIndex_++;
245
+ // Do not throw any error to match web spec; instead return 0, an
246
+ // invalid timer id
247
+ return 0;
247
248
  }
248
249
 
249
250
  auto callback = args[0].getObject(rt).getFunction(rt);
@@ -300,8 +301,9 @@ void TimerManager::attachGlobals(jsi::Runtime& runtime) {
300
301
  }
301
302
 
302
303
  if (!args[0].isObject() || !args[0].asObject(rt).isFunction(rt)) {
303
- throw jsi::JSError(
304
- rt, "The first argument to setInterval must be a function.");
304
+ // Do not throw any error to match web spec; instead return 0, an
305
+ // invalid timer id
306
+ return 0;
305
307
  }
306
308
  auto callback = args[0].getObject(rt).getFunction(rt);
307
309
  auto delay = count > 1
@@ -93,7 +93,9 @@ class TimerManager {
93
93
 
94
94
  // Each timeout that is registered on this queue gets a sequential id. This
95
95
  // is the global count from which those are assigned.
96
- TimerHandle timerIndex_{0};
96
+ // As per WHATWG HTML 8.6.1 (Timers) ids must be greater than zero, i.e. start
97
+ // at 1
98
+ TimerHandle timerIndex_{1};
97
99
 
98
100
  // The React Native microtask queue is used to back public APIs including
99
101
  // `queueMicrotask`, `clearImmediate`, and `setImmediate` (which is used by
@@ -267,7 +267,9 @@ TEST_F(ReactInstanceTest, testSetTimeoutWithoutDelay) {
267
267
  EXPECT_CALL(
268
268
  *mockRegistry_,
269
269
  createTimer(_, 0)); // If delay is not provided, it should use 0
270
- eval("setTimeout(() => {});");
270
+ auto val = eval("setTimeout(() => {});");
271
+ expectNoError();
272
+ EXPECT_EQ(val.asNumber(), 1); // First timer id should start at 1
271
273
  }
272
274
 
273
275
  TEST_F(ReactInstanceTest, testSetTimeoutWithPassThroughArgs) {
@@ -299,8 +301,9 @@ TEST_F(ReactInstanceTest, testSetTimeoutWithInvalidArgs) {
299
301
  getErrorMessage("setTimeout();"),
300
302
  "setTimeout must be called with at least one argument (the function to call).");
301
303
 
302
- eval("setTimeout('invalid');");
304
+ auto val = eval("setTimeout('invalid')");
303
305
  expectNoError();
306
+ EXPECT_EQ(val.asNumber(), 0);
304
307
 
305
308
  eval("setTimeout(() => {}, 'invalid');");
306
309
  expectNoError();
@@ -417,9 +420,10 @@ TEST_F(ReactInstanceTest, testSetIntervalWithInvalidArgs) {
417
420
  EXPECT_EQ(
418
421
  getErrorMessage("setInterval();"),
419
422
  "setInterval must be called with at least one argument (the function to call).");
420
- EXPECT_EQ(
421
- getErrorMessage("setInterval('invalid', 100);"),
422
- "The first argument to setInterval must be a function.");
423
+
424
+ auto val = eval("setInterval('invalid', 100)");
425
+ expectNoError();
426
+ EXPECT_EQ(val.asNumber(), 0);
423
427
  }
424
428
 
425
429
  TEST_F(ReactInstanceTest, testClearInterval) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native",
3
- "version": "0.80.0-rc.2",
3
+ "version": "0.80.0-rc.3",
4
4
  "description": "A framework for building native apps using React",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -155,13 +155,13 @@
155
155
  },
156
156
  "dependencies": {
157
157
  "@jest/create-cache-key-function": "^29.7.0",
158
- "@react-native/assets-registry": "0.80.0-rc.2",
159
- "@react-native/codegen": "0.80.0-rc.2",
160
- "@react-native/community-cli-plugin": "0.80.0-rc.2",
161
- "@react-native/gradle-plugin": "0.80.0-rc.2",
162
- "@react-native/js-polyfills": "0.80.0-rc.2",
163
- "@react-native/normalize-colors": "0.80.0-rc.2",
164
- "@react-native/virtualized-lists": "0.80.0-rc.2",
158
+ "@react-native/assets-registry": "0.80.0-rc.3",
159
+ "@react-native/codegen": "0.80.0-rc.3",
160
+ "@react-native/community-cli-plugin": "0.80.0-rc.3",
161
+ "@react-native/gradle-plugin": "0.80.0-rc.3",
162
+ "@react-native/js-polyfills": "0.80.0-rc.3",
163
+ "@react-native/normalize-colors": "0.80.0-rc.3",
164
+ "@react-native/virtualized-lists": "0.80.0-rc.3",
165
165
  "abort-controller": "^3.0.0",
166
166
  "anser": "^1.4.9",
167
167
  "ansi-regex": "^5.0.0",
Binary file
Binary file
Binary file
package/types/index.d.ts CHANGED
@@ -68,7 +68,7 @@
68
68
  /// <reference path="modules/BatchedBridge.d.ts" />
69
69
  /// <reference path="modules/Codegen.d.ts" />
70
70
  /// <reference path="modules/Devtools.d.ts" />
71
- /// <reference types="../src/types/globals.d.ts" />
71
+ /// <reference path="../src/types/globals.d.ts" />
72
72
 
73
73
  export * from '../Libraries/ActionSheetIOS/ActionSheetIOS';
74
74
  export * from '../Libraries/Alert/Alert';
@@ -0,0 +1,16 @@
1
+ {
2
+ "compilerOptions": {
3
+ "module": "commonjs",
4
+ "lib": ["es6"],
5
+ "noImplicitAny": true,
6
+ "noImplicitThis": true,
7
+ "strictFunctionTypes": true,
8
+ "strictNullChecks": true,
9
+ "types": [],
10
+ "jsx": "react",
11
+ "noEmit": true,
12
+ "forceConsistentCasingInFileNames": true,
13
+ "paths": {"react-native": ["."]}
14
+ },
15
+ "include": ["../**/*.d.ts", "__typetests__/**/*"]
16
+ }