Граф коммитов

6976 Коммитов

Автор SHA1 Сообщение Дата
Genki Kondo 8858c21124 Make sure that AnimatedTracking is started when CompositeAnimation.start is called
Summary:
In Animated, when a toValue of AnimatedValue (as opposed to a number) is passed in, the [AnimatedValue starts tracking via AnimatedTracking](https://www.internalfb.com/code/fbsource/[b688f3747a706236fce300636978ed1ca5e4081a]/xplat/js/react-native-github/Libraries/Animated/AnimatedImplementation.js?lines=142) but it doesn't actually start animating even if start() is called on the animation.

This behavior is inconsistent with a toValue of a number, which executes immediately on start(). This diff adds a call to AnimatedTracking.update within AnimatedValue.track, which starts the tracking animation.

Changelog:
[General][Fixed] - Fixes execution of animation when a toValue of AnimatedValue is used.

Reviewed By: JoshuaGross

Differential Revision: D33800373

fbshipit-source-id: 85ee6f51bc2bb2e078b586b076a8d1dfe92c1155
2022-01-26 21:23:54 -08:00
Chiara Mooney 3d1d4ee457 Update RN Version Expected Structure (#32892)
Summary:
Current syntax options for RN version values break Windows. Following change to nightly build format to be 0.0.0-X-X-X, prerelease value is now a string (X-X-X).

https://github.com/microsoft/react-native-windows/issues/9223

## Changelog

[General] [Fixed] - Fix RN version syntax to match new nightly build structure.

Pull Request resolved: https://github.com/facebook/react-native/pull/32892

Reviewed By: cortinico

Differential Revision: D33712950

Pulled By: lunaleaps

fbshipit-source-id: 9e47cae34930ee624a863c832430962354ebb5be
2022-01-25 22:23:30 -08:00
Marshall Roch 203a82e90a fix flow suppression in VirtualizedList
Summary:
flow 0.146 became more conservative about refinement invalidation, no longer accepting that `this.props.onViewableItemsChanged` is truthy. this was suppressed at the time.

instead, we can assign to a const to restore typechecking.

Changelog: [Internal]

Reviewed By: motiz88

Differential Revision: D33743126

fbshipit-source-id: 0b1f0b83c2fe812e88b027c3b1d3d8aca7b09277
2022-01-25 15:23:47 -08:00
Marshall Roch 851e87a1a6 make Easing an object, not a class
Summary:
`Easing` only has static properties and is never constructed or subclassed, so there doesn't seem to be any reason for it to be a class instead of an object.

as a class, Flow errors about `method-unbinding` on every single use of it.

Changelog: [Internal]

Reviewed By: motiz88

Differential Revision: D33774944

fbshipit-source-id: c0bd2e3d7a78e538f95b88b2b1b12d301c8f590c
2022-01-25 15:23:46 -08:00
Paige Sun 0567fd0e91 4/4 Fix RNHostComponentDetailsRoute to display differences between SVCs and NVCs
Summary: Changelog: [Internal]

Reviewed By: RSNara

Differential Revision: D33718142

fbshipit-source-id: d3a05503e7cc2b76a66a26376a47e4acdc30d514
2022-01-25 15:23:46 -08:00
Paige Sun 63605323b0 2/4 Fix RNHostListComponentListRoute to validate SVCs with NVCs
Summary: Changelog: [Internal]

Reviewed By: RSNara

Differential Revision: D33715385

fbshipit-source-id: d8d31e92dd934648f8431a508a78e2813c462f8f
2022-01-25 15:23:46 -08:00
MaeIg 8b5a5d4645 Fix capitalize Text style on IOS (#32774)
Summary:
On my project, I realized that capitalize style doesn't work with dates on IOS. I found [this issue](https://github.com/facebook/react-native/issues/32697) and tried to solve it.

(code example: https://snack.expo.dev/maelg/capitalize-demo)
| Android | IOS | Web |
| ------------- | ------------- | ------------- |
| ![image](https://user-images.githubusercontent.com/40902940/146158714-c658a83e-d8f3-41c9-92c8-4fc1f722f942.png) | ![image](https://user-images.githubusercontent.com/40902940/146159059-3cec1f7b-9bc7-4060-8164-79c47694b86b.png) | ![image](https://user-images.githubusercontent.com/40902940/146158095-0f94f25f-f245-4e45-9191-73520a0f6568.png) |

As we can see, the behavior is different on IOS, Android and web:
- **Android**: Capitalize the first letter of each word, unless it begins with a number. And put the rest in lowercase.
- **IOS**: Capitalize the first letter of each word, ~~unless it begins with a number~~. And put the rest in lowercase.
- **Web**: Capitalize the first letter of each word, unless it begins with a number. ~~And put the rest in lowercase.~~

This PR aims to unify behavior on Android and Ios. I am not changing the behavior which differs from the web because I don't know if it is desirable to align with the web.

## Changelog

[IOS] [Changed] - Don't capitalize the first letter of a word that is starting by a number

Pull Request resolved: https://github.com/facebook/react-native/pull/32774

Test Plan:
I manually tested my changes on a POC app (same code: https://snack.expo.dev/maelg/capitalize-demo) on react-native v0.66.4 and react-native main branch.

You can see the result here:
| Android | IOS |
| ------------- | ------------- |
| ![image](https://user-images.githubusercontent.com/40902940/146191361-e2de26d1-3915-47dc-8707-480504af24d6.png) | ![image](https://user-images.githubusercontent.com/40902940/146161660-c869202a-104e-4d16-8f5e-db1c72b2ea5e.png) |

~~I tried to use rn-tester but it was not taking my code. I think it is because fabric was enabled so it was using other code.
I tried to disable fabric but I was not able to build the app on my IOS simulator anymore:~~

On rn-tester:
<image src="https://user-images.githubusercontent.com/40902940/146457851-864b2962-5e9c-4c7e-83fd-7686e27cb996.png" width=50% height=50% />

Reviewed By: philIip

Differential Revision: D33165963

Pulled By: yungsters

fbshipit-source-id: c3bf32bf33d2f109a119798eefdbb9077e904252
2022-01-25 09:08:18 -08:00
Tim Yung 23717c6381 RN: Remove DeprecatedPropTypes
Summary:
Removes all of the `DeprecatedPropTypes` modules from React Native.

Any call sites that were deep-linking to these modules and still requires them can instead import them from the `deprecated-react-native-prop-types` package.

Since this also removes the last reference to `prop-types`, this diff also removes the `prop-types` dependency from `react-native`. 🥳

Changelog:
[General][Removed] DeprecatedPropTypes (deep-link) modules removed from React Native.

Reviewed By: kacieb

Differential Revision: D33671645

fbshipit-source-id: 91829a556b272bbd17ee94806fc548af753593db
2022-01-20 18:17:03 -08:00
Moses DeJong f12c8fba60 Avoid self capture in blocks that would extend ImageView instance lifetime.
Summary:
Avoid self capture in blocks that would extend ImageView instance lifetime.

Changelog:
[iOS][Fixed] - Use weakSelf in objc block instead of self.

Reviewed By: RSNara

Differential Revision: D33639088

fbshipit-source-id: b6e5200d9410ddd9e0683ea6d3cc3116591dd31c
2022-01-20 15:39:52 -08:00
Michelle Laurenti 86db62b7a8 fix race condition in iOS websocket implementation (#32847)
Summary:
The iOS WebSocket implementation has a race condition that causes WebSocket frame payloads to be processed incorrectly.
This can cause errors on RFC6455 compliant WebSocket servers:
- the server sends a ping frame with no payload
- the server sends a text frame with a payload longer than 125 bytes
- the client answers the ping with a pong frame echoing back the contents of the text frame

This is caused by concurrent modification of the current frame contents, that is passed by reference to the handlers. The concurrent modification happens [here](https://github.com/facebook/react-native/blob/main/Libraries/WebSocket/RCTSRWebSocket.m#L1162).

The bug was detected and fixed in the original SocketRocket repository in [this PR](https://github.com/facebookincubator/SocketRocket/pull/371). The relevant part of the fix is applied in this PR.

Resolves https://github.com/facebook/react-native/issues/30020.

## Changelog

<!-- Help reviewers and the release process by writing your own changelog entry. For an example, see:
https://github.com/facebook/react-native/wiki/Changelog
-->

[iOS] [Fixed] - Fix WebSocket control frames having payloads longer than 125 bytes

Pull Request resolved: https://github.com/facebook/react-native/pull/32847

Test Plan:
The bug is not easily and consistently reproduced, being a race condition.
We were able to reproduce it by connecting a react native app to a websocket server that sent ~100 pings per second and ~100 text frames per second. After a couple of seconds, the server receives an invalid pong message, with a payload equal to the payload of the text frame. The following is a node server that can replicate the problem on a react-native app running on iOS.

<details>

```
const { WebSocketServer } = require('ws');

const wss = new WebSocketServer({ port: 8080 });

wss.on('connection', function connection(ws) {
  const pingInterval = setInterval(() => {
    ws.ping();
  }, 10);

  const sendInterval = setInterval(() => {
    const arr = new Array(100);
    for (let i = 0; i < arr.length; i++) {
      arr[i] = Math.random();
    }
    ws.send('message with payload longer than 125 bytes: ' + arr.join(','));
  }, 10);

  ws.on('close', () => {
    clearInterval(pingInterval);
    clearInterval(sendInterval);
  });

  ws.on('error', (err) => {
    console.error(err);
    process.exit(1);
  });
});
```

</details>

Reviewed By: hramos

Differential Revision: D33486828

Pulled By: sota000

fbshipit-source-id: ba52958a584d633813e0d623d29b19999d0c617b
2022-01-20 13:56:26 -08:00
Ramanpreet Nara 0343e697fd Fix NVC for RCTTextInlineImage
Summary:
This diff fixes the Static/Native ViewConfigs for RCTTextInlineImage.

Changelog: [Internal]

Reviewed By: p-sun, sshic

Differential Revision: D33674127

fbshipit-source-id: 8cf5ffeaca635b4afd30c437dc0f87ea1fdc15a8
2022-01-20 13:52:03 -08:00
Eric Rozell 4a227ce2ab Add platformConfig to native animations and nodes (#32736)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/32736

The ability to pass an additional property bag to further configure NativeAnimated is useful for a few reasons, e.g., experimentation with multiple implementations of the NativeAnimated module.

The specific use case this solves is on react-native-windows, where there are two underlying animation graph options, one "optimized" animation graph that uses UI.Composition, and another similar to the approach to iOS and Android that uses a frame rendering callback.

The platform configuration can be supplied to the animation node when `useNativeDriver` is set to `true`, and we pass the platform configuration object to the connected AnimatedValue and all it's children.

Changelog:
[General][Added] - Option to supply `platformConfig` to NativeAnimated

Reviewed By: yungsters

Differential Revision: D32988285

fbshipit-source-id: ab8a7bbf197573fc9e9a4737c255f124321295ac
2022-01-19 19:45:21 -08:00
Brad Zacher c0e489b729 remove duplicate class members
Summary:
Flow currently allows duplicate members on classes. At runtime the "last" member wins out and all previous values for the member are discarded.
This diff manually removes duplicate members, and fixes resulting flow errors by converting methods to arrow function properties.

Reviewed By: pieterv

Differential Revision: D33664966

fbshipit-source-id: 0f712ac96af4df593c0918fcbadd70624ddde4a6
2022-01-19 15:35:57 -08:00
Andrei Shikov 0a5481924c React Native sync for revisions fe905f1...51947a1
Summary:
This sync includes the following changes:
- **[51947a14b](https://github.com/facebook/react/commit/51947a14b )**: Refactored how React/DevTools log Timeline performance data ([#23102](https://github.com/facebook/react/pull/23102)) //<Brian Vaughn>//
- **[c09596cc6](https://github.com/facebook/react/commit/c09596cc6 )**: Add RN_FB bundles for react-is ([#23101](https://github.com/facebook/react/pull/23101)) //<Moti Zilberman>//
- **[9a7e6bf0d](https://github.com/facebook/react/commit/9a7e6bf0d )**: Add --no-show-signature to "git show" commands ([#23038](https://github.com/facebook/react/pull/23038)) //<Stefan Sundin>//
- **[2f26eb85d](https://github.com/facebook/react/commit/2f26eb85d )**: Add exports field to react-refresh's package.json ([#23087](https://github.com/facebook/react/pull/23087)) //<Gray Zhang>//
- **[811634762](https://github.com/facebook/react/commit/811634762 )**: add enableTransitionTracing feature flag ([#23079](https://github.com/facebook/react/pull/23079)) //<Luna Ruan>//

Changelog:
[General][Changed] - React Native sync for revisions fe905f1...51947a1

jest_e2e[run_all_tests]

Reviewed By: rickhanlonii, kacieb

Differential Revision: D33634332

fbshipit-source-id: a83b663a122a2cb79225ca33a007fe1774728c03
2022-01-18 20:09:38 -08:00
Gabriel Donadel Dall'Agnol 0cc80b4d0c fix: KeyboardAvoidingView _updateBottomIfNecessary typo (#32894)
Summary:
While working on a fix for https://github.com/facebook/react-native/issues/29974 I notice that the `_updateBottomIfNecessary` function inside `KeyboardAvoidingView` was misspelled, so I decided to open a PR fixing it.

## Changelog

[General] [Fixed] - Fix typo in _updateBottomIfNecessary function on KeyboardAvoidingView component

Pull Request resolved: https://github.com/facebook/react-native/pull/32894

Test Plan: Shouldn't require much testing as this is just renaming a private function of `KeyboardAvoidingView`

Reviewed By: philIip

Differential Revision: D33620554

Pulled By: cortinico

fbshipit-source-id: 69b8969bef09cf58b9b1c8a9154dc52686187f8a
2022-01-17 11:36:57 -08:00
Ramanpreet Nara 28f5abc717 Fix NVC for RCTSlider
Summary:
## Android Failures
```
LOG  SVC RCTSlider Invalid
 LOG  {
  "missing": {
    "directEventTypes": {
      "topSlidingComplete": {
        "registrationName": "onSlidingComplete"
      }
    }
  },
  "unexpected": {
    "bubblingEventTypes": {
      "paperValueChange": {
        "phasedRegistrationNames": {
          "captured": "onValueChangeCapture",
          "bubbled": "onValueChange"
        }
      },
      "topValueChange": {
        "phasedRegistrationNames": {
          "captured": "onValueChangeCapture",
          "bubbled": "onValueChange"
        }
      }
    },
    "directEventTypes": {
      "paperSlidingComplete": {
        "registrationName": "onSlidingComplete"
      }
    },
    "validAttributes": {
      "disabled": true,
      "maximumTrackImage": {
        "process": "[Function resolveAssetSource]"
      },
      "minimumTrackImage": {
        "process": "[Function resolveAssetSource]"
      },
      "thumbImage": {
        "process": "[Function resolveAssetSource]"
      },
      "trackImage": {
        "process": "[Function resolveAssetSource]"
      }
    }
  },
  "unequal": {}
}
```

## iOS Failures
```
 LOG  SVC RCTSlider Invalid
 LOG  {
  "missing": {},
  "unexpected": {
    "bubblingEventTypes": {
      "paperValueChange": {
        "phasedRegistrationNames": {
          "captured": "onValueChangeCapture",
          "bubbled": "onValueChange"
        }
      }
    },
    "directEventTypes": {
      "paperSlidingComplete": {
        "registrationName": "onSlidingComplete"
      }
    },
    "validAttributes": {
      "enabled": true
    }
  },
  "unequal": []
}
```

Reviewed By: yungsters

Differential Revision: D33409401

fbshipit-source-id: 519b6e35246e6671dbea1f374435d92937d96c1d
2022-01-14 16:31:50 -08:00
Ramanpreet Nara 4ac209ca1d Fix NVC for RCTMap
Summary: Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D33354718

fbshipit-source-id: 76f837a552c043be75933eea018e0db8ee1ae238
2022-01-14 16:31:50 -08:00
Paige Sun 5e07347948 6/6 Style: Improve flow typing for UIManagerInjection
Summary: Changelog: [JS] Style: Improve flow typing for UIManagerInjection for static view configs

Reviewed By: yungsters

Differential Revision: D33522890

fbshipit-source-id: 4b0d4da4932473e2316abf25b00896c33f285b63
2022-01-14 13:44:57 -08:00
Marshall Roch 66dc211436 truncate JSTimers errors array instead of making it nullable
Summary:
instead of `errors: ?Array<Error>` and setting it back to `null` to clear errors, which Flow is not very happy with, we can make it always an array and truncate it with `errors.length = 0`.

Changelog: [Internal]

Reviewed By: motiz88

Differential Revision: D33584184

fbshipit-source-id: 81b424e69e60203c645bafbac12177ffcdc0c6ef
2022-01-14 09:06:56 -08:00
Ramanpreet Nara 0ee66889e0 Fix SVC for AndroidHorizontalScrollView
Summary:
## Failure
```
 LOG  {
  "missing": {
    "validAttributes": {
      "borderBottomLeftRadius": true,
      "borderRightColor": {
        "process": "[Function processColor]"
      },
      "borderRadius": true,
      "borderLeftColor": {
        "process": "[Function processColor]"
      },
      "borderColor": {
        "process": "[Function processColor]"
      },
      "borderTopRightRadius": true,
      "borderBottomColor": {
        "process": "[Function processColor]"
      },
      "borderTopColor": {
        "process": "[Function processColor]"
      },
      "borderStyle": true,
      "borderBottomRightRadius": true,
      "borderTopLeftRadius": true,
      "removeClippedSubviews": true
    }
  },
  "unexpected": {},
  "unequal": []
}
```

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D33341777

fbshipit-source-id: c44661411e690b4536d9e979b79f34e200c3720b
2022-01-11 14:22:15 -08:00
Ramanpreet Nara 5bc7b02fc7 Fix SVC for AndroidHorizontalScrollContentView
Summary:
## Failure
```
 LOG  SVC AndroidHorizontalScrollContentView Invalid
 LOG  {
  "missing": {
    "validAttributes": {
      "removeClippedSubviews": true
    }
  },
  "unexpected": {},
  "unequal": []
}
```

Changelog: [Internal]

Reviewed By: yungsters

Differential Revision: D33341774

fbshipit-source-id: 8f287ba00252f8456ad642eaedf38fa3aa2a11ff
2022-01-11 14:22:15 -08:00
Ramanpreet Nara fcf01b8c7a Fix SVC for RCTImageView
Summary: Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D33341778

fbshipit-source-id: fb51664706febce570808b6018e98637d5f0d42a
2022-01-11 14:22:15 -08:00
Ramanpreet Nara 067bcb5325 Fix SVC for RCT{Multiline,Singleline}TextInput
Summary:
See title.

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D33341775

fbshipit-source-id: be1c876375b1106d51e871805c23d345906b4631
2022-01-11 14:22:14 -08:00
Ramanpreet Nara 9022849505 Fix SVC for RCTScrollView
Summary:
## Failure
```
 LOG  SVC RCTScrollView Invalid
 LOG  {
  "missing": {
    "validAttributes": {
      "borderBottomLeftRadius": true,
      "borderRightColor": {
        "process": "[Function processColor]"
      },
      "borderRadius": true,
      "borderLeftColor": {
        "process": "[Function processColor]"
      },
      "borderColor": {
        "process": "[Function processColor]"
      },
      "borderTopRightRadius": true,
      "borderBottomColor": {
        "process": "[Function processColor]"
      },
      "borderTopColor": {
        "process": "[Function processColor]"
      },
      "borderStyle": true,
      "borderBottomRightRadius": true,
      "borderTopLeftRadius": true,
      "removeClippedSubviews": true
    }
  },
  "unexpected": {
    "directEventTypes": {
      "topScrollToTop": {
        "registrationName": "onScrollToTop"
      }
    },
    "validAttributes": {
      "alwaysBounceHorizontal": true,
      "alwaysBounceVertical": true,
      "automaticallyAdjustContentInsets": true,
      "automaticallyAdjustKeyboardInsets": true,
      "automaticallyAdjustsScrollIndicatorInsets": true,
      "bounces": true,
      "bouncesZoom": true,
      "canCancelContentTouches": true,
      "centerContent": true,
      "contentInset": {
        "diff": "[Function pointsDiffer]"
      },
      "contentInsetAdjustmentBehavior": true,
      "directionalLockEnabled": true,
      "indicatorStyle": true,
      "inverted": true,
      "keyboardDismissMode": true,
      "maintainVisibleContentPosition": true,
      "maximumZoomScale": true,
      "minimumZoomScale": true,
      "onMomentumScrollBegin": true,
      "onMomentumScrollEnd": true,
      "onScroll": true,
      "onScrollBeginDrag": true,
      "onScrollEndDrag": true,
      "onScrollToTop": true,
      "pinchGestureEnabled": true,
      "scrollEventThrottle": true,
      "scrollIndicatorInsets": {
        "diff": "[Function pointsDiffer]"
      },
      "scrollToOverflowEnabled": true,
      "scrollsToTop": true,
      "showsHorizontalScrollIndicator": true,
      "zoomScale": true
    }
  },
  "unequal": []
}
```

Changelog: [Internal]

Reviewed By: yungsters

Differential Revision: D32225225

fbshipit-source-id: 0f236256dcbcab4fe66165b5e36df2b5f785d94e
2022-01-11 14:22:14 -08:00
grgr-dkrk 36037fa81b feat: add `accessibilityLabelledBy` props (#32470)
Summary:
related: https://github.com/facebook/react-native/issues/30846, https://github.com/facebook/react-native/issues/26739

Added `accessibilityLabelledBy` props to find the nativeID of the associated label, it mainly for` <TextInput> `.

The reason for implementing it as `labelledBy` instead of `labelFor` is as follows.
- It was difficult to find a component with `labelFor` because the `<Text>` component does not add the `labelFor` received from her Props to the View's tag.
- The use case looks like the HTML `aria-labelledby`, which is intuitive for web developers. It also seems easy to convert to a web platform.

## Changelog

<!-- Help reviewers and the release process by writing your own changelog entry. For an example, see:
https://github.com/facebook/react-native/wiki/Changelog
-->

[Android] [Added] - add `accessibilityLabelledBy` props

Pull Request resolved: https://github.com/facebook/react-native/pull/32470

Test Plan:
I checked it with RNTester using an Android11.

https://user-images.githubusercontent.com/40130327/138666856-891d9f4d-52cf-4181-a81f-13b033037db4.mp4

Reviewed By: lunaleaps, kacieb

Differential Revision: D31897112

Pulled By: ShikaSD

fbshipit-source-id: 66361735679560c01834b3a4483adf264098b3e3
2022-01-11 06:51:39 -08:00
Ramanpreet Nara 8487470476 Fix SVC for AndroidTextInput
Summary:
## SVC != NVC Failure
```
 LOG  SVC AndroidTextInput Invalid
 LOG  {
  "missing": {
    "validAttributes": {
      "borderBottomLeftRadius": true,
      "borderBottomColor": {
        "process": "[Function processColor]"
      },
      "borderRightColor": {
        "process": "[Function processColor]"
      },
      "borderLeftColor": {
        "process": "[Function processColor]"
      },
      "borderTopRightRadius": true,
      "borderColor": {
        "process": "[Function processColor]"
      },
      "borderBottomRightRadius": true,
      "borderRadius": true,
      "borderStyle": true,
      "borderTopColor": {
        "process": "[Function processColor]"
      },
      "borderTopLeftRadius": true
    }
  },
  "unexpected": {
    "validAttributes": {
      "autoCompleteType": true
    }
  },
  "unequal": []
}
```

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D33341773

fbshipit-source-id: a3c7f043d6b2ba0e2a4253739826e6f7f68e7ca5
2022-01-11 00:24:41 -08:00
Ramanpreet Nara cb3321e3b0 Refactor: Inline AndroidTextInputViewConfig
Summary:
Putting the static view config into its own file creates the uncertainty that n > 1 files import the static view config. This isn't true for AndroidTextViewConfig. So, let's just inline this static view config in the NativeComponent that uses it.

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D33341776

fbshipit-source-id: 6fb710b8776d7b9276022c5226acefd7cf8395fb
2022-01-11 00:24:41 -08:00
Ramanpreet Nara 848e34e753 Fix SVC/NVC for AndroidDrawerLayout
Summary:
## Failures
```
 LOG  SVC AndroidDrawerLayout Invalid
 LOG  {
  "missing": {},
  "unexpected": {
    "directEventTypes": {
      "topDrawerOpened": {
        "registrationName": "onDrawerOpen"
      },
      "topDrawerClosed": {
        "registrationName": "onDrawerClose"
      }
    },
    "validAttributes": {
      "keyboardDismissMode": true,
      "drawerBackgroundColor": {
        "process": "[Function processColor]"
      },
      "statusBarBackgroundColor": {
        "process": "[Function processColor]"
      }
    }
  },
  "unequal": []
}
```

Changelog: [Internal]

Reviewed By: JoshuaGross

Differential Revision: D33409393

fbshipit-source-id: 9fa5b6cd5c8fc9bc01d825eb8fb7965c5cb691d2
2022-01-11 00:24:41 -08:00
Paige Sun b3a34194c0 5/5 Hook up Bridgeless' UIManager.hasViewManagerConfig with Fabric's native component registry
Summary:
Allow JS to detect if a native UI component is registered to `RCTComponentViewFactory.mm` with JS `UIManager.hasViewManagerConfig(componentName)`.

Fyi, `UIManager.js` is
- `DummyUIManager.js` for Bridgeless,
- `LazyUIManager.js` for Fabric with SVC enabled,
- and `PaperUIManager.js`. for Fabric with SVC disabled.

# How it works in Bridgeless
- `DummyUIManager.hasViewManagerConfig()` checks whether a component exists in the binary. It is hooked up to `unstable_hasComponent()`,
- which is hooked up to the native function `RCTInstallNativeComponentRegistryBinding()`,
- which returns whether a component has been registered to `RCTComponentViewFactory`
- (and also registers the native component if hasn't been registered yet).

Changelog: [Bridgeless][JS] Hook up Venice's UIManager.hasViewManagerConfig with Fabric's native component registry

Reviewed By: RSNara

Differential Revision: D33511659

fbshipit-source-id: 14519378ce3e4247516fcf5a6f83a82aa87c7919
2022-01-10 17:26:37 -08:00
Paige Sun a620d7dc85 4/5 Minor: Move unstable_hasComponent out of NativeComponentRegistry
Summary:
Without moving this, we would get this warning about a require cycle on the next diff, because DummyUIManager and LazyUIManager both need unstable_hasComponent.

```
(NOBRIDGE) WARN  Require cycle: react-native-github/Libraries/NativeComponent/NativeComponentRegistry.js -> react-native-github/Libraries/ReactNative/UIManager.js -> react-native-github/Libraries/ReactNative/DummyUIManager.js -> react-native-github/Libraries/NativeComponent/NativeComponentRegistry.js

Require cycles are allowed, but can result in uninitialized values. Consider refactoring to remove the need for a cycle.
```

Changelog: [Internal]

Reviewed By: philIip, RSNara

Differential Revision: D33511566

fbshipit-source-id: fd8c9732408d08ab17335273f86168bf30747929
2022-01-10 17:26:37 -08:00
Kacie Bawiec 85ecb0043f React Native sync for revisions a049aa0...fe905f1
Summary:
This sync includes the following changes:
- **[fe905f152](https://github.com/facebook/react/commit/fe905f152 )**: Update package.json ([#22954](https://github.com/facebook/react/pull/22954)) //<Jack Works>//
- **[3dc41d8a2](https://github.com/facebook/react/commit/3dc41d8a2 )**: fix: parseExportNamesInto specifiers typo ([#22537](https://github.com/facebook/react/pull/22537)) //<btea>//
- **[bd0a5dd68](https://github.com/facebook/react/commit/bd0a5dd68 )**: #22988 - Fix Bug: license header in React 18 bundles contains vundefined ([#23004](https://github.com/facebook/react/pull/23004)) //<Vitalie>//
- **[ceee524a8](https://github.com/facebook/react/commit/ceee524a8 )**: Remove unnecessary clearContainer call ([#22979](https://github.com/facebook/react/pull/22979)) //<Sebastian Markbåge>//
- **[cd1a3e9b5](https://github.com/facebook/react/commit/cd1a3e9b5 )**: Build both a partial renderer and fizz renderer of the legacy API for FB ([#22933](https://github.com/facebook/react/pull/22933)) //<Sebastian Markbåge>//

Changelog:
[General][Changed] - React Native sync for revisions a049aa0...fe905f1

jest_e2e[run_all_tests]

Reviewed By: rickhanlonii

Differential Revision: D33512179

fbshipit-source-id: c2df06c8af6bb674ea0c5524538259e6d6d98f78
2022-01-10 14:30:56 -08:00
Paige Sun 6be46b0bb5 Comments only. Clarify a few Venice and SVC methods
Summary: Changelog: [Internal]

Reviewed By: fkgozali

Differential Revision: D33468276

fbshipit-source-id: bcc62ba1e728bba2492dbbbb0e4569285effeca7
2022-01-07 17:41:55 -08:00
Paige Sun 9daae5a5f2 For Fabric with StaticViewConfigs, fix UIManager to use LazyUImanager, not PaperUIManager
Summary: Changelog: [JS] For Fabric with StaticViewConfigs, fix UIManager to use LazyUImanager, not PaperUIManager

Reviewed By: fkgozali

Differential Revision: D33459937

fbshipit-source-id: 4298be7e1e455856cbcf3162b100099cd8c9ce09
2022-01-07 16:16:16 -08:00
Pieter De Baets 78614de1cb Revert D32559015: Support setting hitSlop with single value (JS changes)
Differential Revision:
D32559015 (589b129581)

Original commit changeset: c0409e6e5dd9

Original Phabricator Diff: D32559015 (589b129581)

fbshipit-source-id: 91cfcc86582c4716fc531a73bd8e06dea1406abd
2022-01-05 14:06:54 -08:00
Ramanpreet Nara d016766303 Attach "default events" to all ViewConfigs
Summary:
## Context
Default events are only attached to the first-loaded component.

## Problem
This complicates SVC == NVC reconciliation:
- The Static ViewConfigs of all components contain these default events.
- The native ViewConfig of *only the first component that loads* has these default events.

## FAQ
**Question:** If default events were only attached to the first loaded component, how come all components could emit these default events?

In short, if one component declares an event, React Native can dispatch that event to **all** components:
1. The ReactFabric-dev renderer invokes [ReactNativeViewConfigRegistry.get](https://fburl.com/code/468l3zp7) to get the ViewConfig of a component.
2. ReactNativeViewConfigRegistry.get inserts a component's the Bubbling/Direct events into [two **global** maps: ReactNativeViewConfigRegistry.customBubblingEventTypes, ReactNativeViewConfigRegistry.customDirectEventTypes](https://www.internalfb.com/code/fbsource/[00ccc3c7a1b76e55986a6d753b8748327397e5eb]/xplat/js/react-native-github/Libraries/Renderer/shims/ReactNativeViewConfigRegistry.js?lines=20-34%2C57-72%2C117).
3. When the ReactFabric-dev renderer needs to dispatch events, it just [does a lookup on these two **global** maps](https://www.internalfb.com/code/fbsource/[2de1e1d59f6e0316868a6c4d9bca5fe673210106]/xplat/js/react-native-github/Libraries/Renderer/implementations/ReactFabric-dev.js?lines=2426%2C2439-2440) to create/dispatch the SyntheticEvents.

**Question:** Should we gate these changes?
This change should be safe to land without gating. This diff just creates duplicate entries for bubbling/direct events across components, which should [just get ignored by ReactNativeViewConfigRegistry](https://www.internalfb.com/code/fbsource/[4c57b02a0edccfd8a5fcc3a63ed2dd622efea320]/xplat/js/react-native-github/Libraries/Renderer/shims/ReactNativeViewConfigRegistry.js?lines=42%2C57-72%2C117).

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D33303417

fbshipit-source-id: fa777ca92e57b82eafb94f7d05ef4064ed5060ed
2022-01-04 16:04:16 -08:00
Pieter De Baets 589b129581 Support setting hitSlop with single value (JS changes)
Summary:
JS changes to support D32138347 (a96bdb7154)

Changelog: [Android][Fixed] Enable hitSlop to be set using a single number.

Reviewed By: yungsters

Differential Revision: D32559015

fbshipit-source-id: c0409e6e5dd95b35a2a4605b16cfb48104be2858
2022-01-04 10:39:43 -08:00
Andres Suarez 8bd3edec88 Update copyright headers from Facebook to Meta
Reviewed By: aaronabramov

Differential Revision: D33367752

fbshipit-source-id: 4ce94d184485e5ee0a62cf67ad2d3ba16e285c8f
2021-12-30 15:11:21 -08:00
Samuel Susla 8c6a98400e Introduce TextInput.onChangeSync
Summary:
changelog: [internal]

Add experimental `TextInput.onChangeSync` which delivers onChange event synchronously.

Reviewed By: ShikaSD

Differential Revision: D33188083

fbshipit-source-id: 1e1dcd0d71c7eec98d3d5f69967659e07ac4e6a6
2021-12-30 06:38:50 -08:00
David Vacca 3e8934b49b Enable ConcurrentRoot in RN VR apps
Summary:
This diff is a prototype to enable ConcurrentRoot in RN VR apps

changelog: [internal] internal

Reviewed By: sammy-SC

Differential Revision: D33200238

fbshipit-source-id: 45f700808cdc3a970bcddef858944e764a7260bd
2021-12-22 03:00:45 -08:00
Luna Wei a63fccc259 Remove unused eslint-disable
Summary: Changelog: [Internal] - Fix the eslint warning of an unused disable

Reviewed By: philIip

Differential Revision: D33201539

fbshipit-source-id: a0ad449f77facaacf85ecfdc6a95cf19100f1e77
2021-12-21 12:34:28 -08:00
Luna Wei 3204c55981 Remove usages of bump-oss-version from generated scripts
Summary: Changelog: [Internal] - Update the source of the changes in generated files, no longer bump-oss-version but set-rn-version

Reviewed By: sota000

Differential Revision: D33110408

fbshipit-source-id: 8cd5004f5d40dde82fe4d6271d5b8598cd27ca31
2021-12-17 18:37:37 -08:00
Panagiotis Vekris abbb4b5bb9 new-merge fixes
Summary:
Some final fixes to enable Flow [new-merge](https://fb.workplace.com/groups/floweng/permalink/7366473803401171/) mode.

Changelog: [internal]

Reviewed By: samwgoldman

Differential Revision: D33110844

fbshipit-source-id: 96755262af44e48269cd64473412ed0b6dd9cfcf
2021-12-14 20:39:14 -08:00
Kacie Bawiec 312efd01c8 React Native sync for revisions c1220eb...a049aa0
Summary:
This sync includes the following changes:
- **[f2a59df48](https://github.com/facebook/react/commit/f2a59df48 )**: Remove unstableAvoidThisFallback from OSS ([#22884](https://github.com/facebook/react/pull/22884)) //<salazarm>//
- **[24dd07bd2](https://github.com/facebook/react/commit/24dd07bd2 )**: Add custom element property support behind a flag ([#22184](https://github.com/facebook/react/pull/22184)) //<Joey Arhar>//
- **[72e48b8e1](https://github.com/facebook/react/commit/72e48b8e1 )**: Fix: Don't skip writing updated package.json //<Andrew Clark>//
- **[e39b2c899](https://github.com/facebook/react/commit/e39b2c899 )**: Fix peer deps for use-sync-external-store //<Andrew Clark>//
- **[ec78b135f](https://github.com/facebook/react/commit/ec78b135f )**: Don't override use-sync-external-store peerDeps ([#22882](https://github.com/facebook/react/pull/22882)) //<Andrew Clark>//
- **[5041c37d2](https://github.com/facebook/react/commit/5041c37d2 )**: Remove hydrate option from createRoot ([#22878](https://github.com/facebook/react/pull/22878)) //<salazarm>//
- **[3f9480f0f](https://github.com/facebook/react/commit/3f9480f0f )**: enable continuous replay flag ([#22863](https://github.com/facebook/react/pull/22863)) //<salazarm>//
- **[4729ff6d1](https://github.com/facebook/react/commit/4729ff6d1 )**: Implement identifierPrefix option for useId ([#22855](https://github.com/facebook/react/pull/22855)) //<Andrew Clark>//
- **[ed00d2c3d](https://github.com/facebook/react/commit/ed00d2c3d )**: Remove unused flag ([#22854](https://github.com/facebook/react/pull/22854)) //<Dan Abramov>//
- **[0cc724c77](https://github.com/facebook/react/commit/0cc724c77 )**: update ReactFlightWebpackPlugin to be compatiable with webpack v5 ([#22739](https://github.com/facebook/react/pull/22739)) //<Michelle Chen>//
- **[4e6eec69b](https://github.com/facebook/react/commit/4e6eec69b )**: fix: document can be `null`, not just `undefined` ([#22695](https://github.com/facebook/react/pull/22695)) //<Simen Bekkhus>//

Changelog:
[General][Changed] - React Native sync for revisions c1220eb...a049aa0

jest_e2e[run_all_tests]

Reviewed By: rickhanlonii

Differential Revision: D33062386

fbshipit-source-id: 37e497947efad5696c251096da8a92ccdc6dcea7
2021-12-14 09:26:09 -08:00
Gijs Weterings 34efaab3a8 Back out "Fix Static View Config for RCTView"
Summary: Changelog: [internal]

Reviewed By: arushikesarwani94

Differential Revision: D33042498

fbshipit-source-id: 42667f0fb17d502494139645a42dc54dea9904b7
2021-12-11 06:58:07 -08:00
Gijs Weterings 0c744dea56 Back out "Introduce a PlatformBaseViewConfig for all HostComponents"
Summary: Changelog: [Internal]

Reviewed By: arushikesarwani94

Differential Revision: D33042499

fbshipit-source-id: 603fbfa4e2f482c5d002532745a29170daded184
2021-12-11 06:58:07 -08:00
Ramanpreet Nara cab16352c7 Introduce a PlatformBaseViewConfig for all HostComponents
Summary:
## iOS
On iOS:
- All props come from ViewManagers
- All HostComponent ViewManagers extend <View/> ViewManager

https://pxl.cl/1SxdF

Therefore, it's safe to have all HostComponent Static View Configs extend <View/> Static View Config.

## Android

On Android, the model is a bit more complicated:

https://pxl.cl/1Vmp5

Takeaways:
- Props come from Shadow Nodes **and** ViewManagers
- Nearly all HostComponent ViewManagers extend BaseViewManager. But, that's not <View/>'s ViewManager.
- <View/>'s ViewManager is [ReactViewManager](https://fburl.com/code/0zalv8zk), which is a descendent of BaseViewManager, and declares its own ReactProps.

So, it's not safe to have all Android HostComponent Static View Configs to extend <View/>'s Static View Config:
1. No components actualy incorportate <View/>'s props
2. Some components don't even incorporate BaseViewManager's props.

## Changes
In this diff, I removed ReactNativeViewViewConfig, and introduced a new view config called PlatformBaseViewConfig. This ViewConfig partial will capture all the props available on all HostComponents on **both** platforms. This may not necessarily be the props made available on <View/>.

The only components that don't extend the base platform props are: RCTTextInlineImage. What we do with these components is TBD.

Changelog: [Internal]

Reviewed By: yungsters

Differential Revision: D32187832

fbshipit-source-id: 9a057abb3f58801615891c21e42ad4cfa5c69f21
2021-12-10 23:19:52 -08:00
Ramanpreet Nara 8f3e188426 Fix Static View Config for RCTView
Summary:
- Fix the StaticViewConfig violations for RCTView

Changelog: [Internal]

Reviewed By: yungsters

Differential Revision: D32187835

fbshipit-source-id: c8c926817a9245b1e8671e5a2e8965ab7ffecace
2021-12-10 23:19:52 -08:00
Amy Huyen 9b0ed920ef Export flow type for ScrollView Deceleration Rate
Summary:
## Changelog:
[General] [Changed] Export Flow type for deceleration rate for use in other files to keep deceleration rate prop values consistently typed

Reviewed By: lunaleaps

Differential Revision: D32989199

fbshipit-source-id: 2e2fef0721de0d0eb60aaefdbb635788bfc8c1f1
2021-12-10 11:43:08 -08:00
Eric Rozell fe53cae954 Deduct offset from `getValue` result when detaching
Summary:
The NativeAnimated `getValue` API returns `value + offset`:
Android:
iOS: https://github.com/facebook/react-native/blob/main/Libraries/NativeAnimation/Nodes/RCTValueAnimatedNode.m#L44
Android: https://github.com/facebook/react-native/blob/main/ReactAndroid/src/main/java/com/facebook/react/animated/ValueAnimatedNode.java#L36

When we store the value after detaching the NativeAnimated node, it stores the result of the NativeAnimated `getValue` call to the `_value` property, so if we call `__getValue` at some later point on the `AnimatedValue`, we will count the offset twice.

This change deducts the offset value from the result returned from `getValue` when storing the latest value.

Changelog:
[General][Fixed] - AnimatedValue.__detach should store getValue result with offset deducted

Reviewed By: yungsters

Differential Revision: D32987003

fbshipit-source-id: 488d1fe512f886c7a9de1e5a4de8f19441ebd81e
2021-12-10 08:07:38 -08:00
Eric Rozell 8ba771c3dd Fire `AnimatedValue.stopAnimation` callback with correct native value
Summary:
AnimatedValue fires a callback with the current value (raw value + offset) after calling it's `stopAnimation` method. The `_value` field on the `AnimatedValue` node is not necessarily kept in sync with the NativeAnimated value node, so the value provided to the callback may be out of sync.

This change checks if the `AnimatedValue` is a native node and passes the callback to the `NativeAnimatedAPI.getValue` callback, defaulting to the previous current JS node state if the node is not native.

Changelog:
[General][Fixed] - AnimatedValue.stopAnimation callback with correct value for NativeAnimated

Reviewed By: yungsters

Differential Revision: D32968572

fbshipit-source-id: b83f86eabe5456f762a15bc29cacb43f84513f6c
2021-12-09 11:40:13 -08:00
Samuel Susla f5f6fd70f2 Introduce TextInput.onKeyPressSync
Summary:
changelog: [internal]

Introduce a way to execute `onKeyPress` synchronously. This feature is experimental and will be changed in the future. It is not decided if marking native events as "sync" is going to be path forward with synchronous access.

NOTE: This is experimental API.

Reviewed By: ShikaSD

Differential Revision: D32882092

fbshipit-source-id: 68c66a9bb7c97758219e085c88a77f3c475c1eb3
2021-12-07 13:42:18 -08:00
Samuel Susla fcda1ac514 Add support for synchronous completeRoot
Summary:
changelog: [internal]

Exposes a new flag on RuntimeScheduler: `unstable_getIsSynchronous`. Flag indicates if the current code is run synchronously and therefore commit phase should be synchronous.

Unit tests will be added later, to keep this diff short. This code path is not executed yet.

Reviewed By: mdvacca, ShikaSD

Differential Revision: D32677814

fbshipit-source-id: e01d4fff7e716d627ff99fe104965851138c3aef
2021-12-07 12:11:24 -08:00
Ramanpreet Nara 39a35feff7 Fix uiViewClassName for TextInlineImageNativeComponent
Summary:
See title.

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D32811821

fbshipit-source-id: 2c6fad21cd1e094162a12a4056ddeab948231c57
2021-12-06 15:44:23 -08:00
Marc Rousavy 49a1460a37 Feature: ScrollView `automaticallyAdjustKeyboardInsets` (#31402)
Summary:
Retrying D30015799 (6e903b07fa) with a fix where ScrollViewNativeComponent was missing the automaticallyAdjustKeyboardInsets prop.
----- Original Summary
Currently, ScrollViews provide the prop `keyboardDismissMode` which lets you choose `"interactive"`. However when the keyboard is shown, it will be rendered above the ScrollView, potentially blocking content.

With the `automaticallyAdjustKeyboardInsets` prop the ScrollView will automatically adjust it's `contentInset`, `scrollIndicatorInsets` and `contentOffset` (scroll Y) props to push the content up so nothing gets blocked.

* The animation curve and duration of the Keyboard is exactly matched.
* The absolute position of the ScrollView is respected, so if the Keyboard only overlaps 10 pixels of the ScrollView, it will only get inset by 10 pixels.
* By respecting the absolute position on screen, this automatically makes it fully compatible with phones with notches (custom safe areas)
* By using the keyboard frame, this also works for different sized keyboards and even `<InputAccessoryView>`s
* This also supports `maintainVisibleContentPosition` and `autoscrollToTopThreshold`.
* I also fixed an issue with the `maintainVisibleContentPosition` (`autoscrollToTopThreshold`) prop(s), so they behave more reliably when `contentInset`s are applied. (This makes automatically scrolling to new items fully compatible with `automaticallyAdjustKeyboardInsets`)

## Changelog

* [iOS] [Added] - ScrollView: `automaticallyAdjustKeyboardInsets` prop: Automatically animate `contentInset`, `scrollIndicatorInsets` and `contentOffset` (scroll Y) to avoid the Keyboard. (respecting absolute position on screen and safe-areas)
* [iOS] [Fixed] - ScrollView: Respect `contentInset` when animating new items with `autoscrollToTopThreshold`, make `automaticallyAdjustKeyboardInsets` work with `autoscrollToTopThreshold` (includes vertical, vertical-inverted, horizontal and horizontal-inverted ScrollViews)

Pull Request resolved: https://github.com/facebook/react-native/pull/31402

Test Plan:
<table>
<tr>
<th>Before</th>
<th>After</th>
</tr>
<tr>
<td>

https://user-images.githubusercontent.com/15199031/115708680-9700aa80-a370-11eb-8016-e75d81a92cd7.MP4

</td>

<td>

https://user-images.githubusercontent.com/15199031/115708699-9b2cc800-a370-11eb-976f-c4010cd96d55.MP4

</td>
</table>

### "Why not just use `<KeyboardAvoidingView>`?"

<table>
<tr>
<th>Before (with <code>&lt;KeyboardAvoidingView&gt;</code>)</th>
<th>After (with <code>automaticallyAdjustKeyboardInsets</code>)</th>
</tr>
<tr>
<td>

https://user-images.githubusercontent.com/15199031/115708749-abdd3e00-a370-11eb-8e09-a27ffaef12b8.MP4

</td>

<td>

https://user-images.githubusercontent.com/15199031/115708777-b3044c00-a370-11eb-9b7a-e040ccb3ef8c.MP4

</td>
</table>

> Also notice how the `<KeyboardAvoidingView>` does not match the animation curve of the Keyboard

### Usage

```jsx
export const ChatPage = ({
  flatListProps,
  textInputProps
}: Props): React.ReactElement => (
  <>
    <FlatList
      {...flatListProps}
      keyboardDismissMode="interactive"
      automaticallyAdjustContentInsets={false}
      contentInsetAdjustmentBehavior="never"
      maintainVisibleContentPosition={{ minIndexForVisible: 0, autoscrollToTopThreshold: 100 }}
      automaticallyAdjustKeyboardInsets={true}
    />
    <InputAccessoryView backgroundColor={colors.white}>
      <ChatInput {...textInputProps} />
    </InputAccessoryView>
  </>
);
```

## Related Issues

* Fixes https://github.com/facebook/react-native/issues/31394
* Fixes https://github.com/facebook/react-native/issues/13073

Reviewed By: yungsters

Differential Revision: D32578661

Pulled By: sota000

fbshipit-source-id: 45985e2844275fe96304eccfd1901907dc4f9279
2021-12-06 13:31:13 -08:00
Liron Yahdav 771ca921b5 Add TextInput.setSelection method
Summary:
Adds a `setSelection` imperative method to `TextInput`.

Changelog:
[General][Added] - Adds a setSelection imperative method to TextInput

Reviewed By: JoshuaGross

Differential Revision: D32186514

fbshipit-source-id: 549a7d93b1c55363cf01d804b1e3d735e55c4481
2021-12-03 11:54:01 -08:00
Peter Carpenter 4d1357918a feat: support queuing accessibility announcements on ios (#32637)
Summary:
The current implementation of `AccessibilityInfo.announceForAccessibility` will immediately interrupt any existing in progress speech with the announcement. Sometimes this is desirable behaviour, but often you will want to wait until existing speech is finished before reading the new announcement. This change gives us that option.

My personal use case for this feature is a custom text input. When typing on iOS with voiceover enabled, each character is read out after being selected. I wanted to add some additional information after each character to help with the context of what has changed in the input, but I didn't want to override the reading of the character itself.

This feature is supported natively on iOS by constructing an `NSAttributedString` with the property [`accessibilitySpeechQueueAnnouncement`](https://developer.apple.com/documentation/foundation/nsattributedstring/key/2865770-accessibilityspeechqueueannounce), so this change just adds an extra parameter to `AccessibilityInfo.announceForAccessibility` which controls the value of that property on the native side. Adding this as an extra optional parameter with false as the default ensures that existing uses of the function won't be affected.

Unfortunately, this feature doesn't appear to be supported on Android, so the new second property will be iOS only.

## Changelog

[iOS] [Added] - add new argument to announceForAccessibility to allow queueing on iOS

Pull Request resolved: https://github.com/facebook/react-native/pull/32637

Test Plan:
I've updated the `announceForAccessibility` section in RNTester with multiple buttons to demonstrate the difference between `queue: false` (default) and `queue: true` and show they work as intended.

Here's the expectation for each button:

- "Announce for Accessibility Immediately": on press, should start reading the button label, then be interrupted by the announcement
- "Announce for Accessibility Queued": on press, should read the button label then read the announcement afterwards
- "Announce for Accessibility Queue Multiple": on press, should read the button label, then read three announcements sequentially, no interruptions

You can see the realisation of those expectations in the following video recorded on an iPhone 12 running iOS 15.0.2:

https://user-images.githubusercontent.com/14826539/142770536-d57bfd69-eba5-444d-9c89-4bf4851ea062.mov

I've also tested the same way on an iPhone 8 running iOS 13.4 and it works exactly the same.

Reviewed By: yungsters

Differential Revision: D32637989

Pulled By: philIip

fbshipit-source-id: 3e90add523f11eb0eb34ea623211249263f257e2
2021-12-02 00:34:05 -08:00
Eric Rozell f3bf2e4f51 Add isPressable native prop to Text
Summary:
react-native-windows currently needs to maintain a fork of TextNativeComponent to wire through a native-only prop for `isPressable`.

The reason we do this on Windows is that we implement an optimization so we only attempt to hit test a virtual Text node if it is actually pressable, leading to significant perf improvement for pointer events (e.g., onMouseEnter / onMouseLeave) on Text.

Changelog:
[General][Added] - Native-only prop to optimize text hit testing on some RN platforms

Reviewed By: JoshuaGross

Differential Revision: D32564637

fbshipit-source-id: bf47c68d94a930d2c620cb3b1584355c5e412bd4
2021-11-30 21:55:39 -08:00
Andrei Shikov a596e98611 React Native sync for revisions c0c71a8...c1220eb
Summary:
This sync includes the following changes:
- **[c1220ebdd](https://github.com/facebook/react/commit/c1220ebdd )**: treat empty string as null ([#22807](https://github.com/facebook/react/pull/22807)) //<salazarm>//
- **[09d9b1775](https://github.com/facebook/react/commit/09d9b1775 )**: Update deprecated features in ESLint configuration files. ([#22767](https://github.com/facebook/react/pull/22767)) //<Esteban>//
- **[bddbfb86d](https://github.com/facebook/react/commit/bddbfb86d )**: Revert "Fix Node package.json ./ exports deprecation warning ([#22783](https://github.com/facebook/react/pull/22783))" ([#22792](https://github.com/facebook/react/pull/22792)) //<Sebastian Silbermann>//
- **[b831aec48](https://github.com/facebook/react/commit/b831aec48 )**: chore(fast-refresh): double check wasMounted ([#22740](https://github.com/facebook/react/pull/22740)) //<anc95>//
- **[8edeb787b](https://github.com/facebook/react/commit/8edeb787b )**: Fix Node package.json ./ exports deprecation warning ([#22783](https://github.com/facebook/react/pull/22783)) //<Rin Arakaki>//
- **[fdc1d617a](https://github.com/facebook/react/commit/fdc1d617a )**: Flag for client render fallback behavior on hydration mismatch ([#22787](https://github.com/facebook/react/pull/22787)) //<salazarm>//
- **[aa19d569b](https://github.com/facebook/react/commit/aa19d569b )**: Add test selectors to experimental build ([#22760](https://github.com/facebook/react/pull/22760)) //<Brian Vaughn>//
- **[520ffc77a](https://github.com/facebook/react/commit/520ffc77a )**: Use globalThis if possible for native fetch in browser build ([#22777](https://github.com/facebook/react/pull/22777)) //<Jiachi Liu>//
- **[afbc2d08f](https://github.com/facebook/react/commit/afbc2d08f )**: Remove unused react-internal/invariant-args ESLint rule. ([#22778](https://github.com/facebook/react/pull/22778)) //<Esteban>//
- **[ca94e2680](https://github.com/facebook/react/commit/ca94e2680 )**: Remove 'packages/shared/invariant.js' ([#22779](https://github.com/facebook/react/pull/22779)) //<Esteban>//
- **[83564712b](https://github.com/facebook/react/commit/83564712b )**: Move SuspenseList to experimental channel ([#22765](https://github.com/facebook/react/pull/22765)) //<Andrew Clark>//
- **[d4144e6e5](https://github.com/facebook/react/commit/d4144e6e5 )**: fix : grammatical typo for test description ([#22764](https://github.com/facebook/react/pull/22764)) //<Brijesh Prasad>//
- **[0b329511b](https://github.com/facebook/react/commit/0b329511b )**: chore: fix comment typo ([#22657](https://github.com/facebook/react/pull/22657)) //<Han Han>//
- **[e6f60d2ad](https://github.com/facebook/react/commit/e6f60d2ad )**: fix typos ([#22715](https://github.com/facebook/react/pull/22715)) //<180909>//

Changelog:
[General][Changed] - React Native sync for revisions c0c71a8...c1220eb

jest_e2e[run_all_tests]

Reviewed By: yungsters

Differential Revision: D32646433

fbshipit-source-id: c534ee7a17141634700c90fc2c7b34bfbe17887a
2021-11-29 04:37:28 -08:00
Phillip Pan b8f0e975b7 use NSInteger for NS_ENUM instead of NSUInteger
Summary:
as title

in practice, this doesn't make any difference, but this is to follow the apple recommendation and for us to have a more consistent codebase.

https://developer.apple.com/library/content/releasenotes/ObjectiveC/ModernizationObjC/AdoptingModernObjective-C/AdoptingModernObjective-C.html

>The NS_ENUM macro helps define both the name and type of the enumeration, in this case named UITableViewCellStyle of type NSInteger. The type for enumerations should be NSInteger.
>Like enumerations, the NS_OPTIONS macro defines both a name and a type. However, the type for options should usually be NSUInteger.

Changelog: [Internal]

Reviewed By: sammy-SC

Differential Revision: D32641990

fbshipit-source-id: 56e4cd44cdefe54f61c90844665a685ee2d6ffad
2021-11-24 15:45:23 -08:00
Jeffrey Hyer 9c5e177a79 Fix how KeyboardAvoidingView handles the onLayout prop. (#32609)
Summary:
Resolves https://github.com/facebook/react-native/issues/32608

This PR updates the `KeyboardAvoidingView` to correctly handle the `onLayout` prop.

## Changelog

<!-- Help reviewers and the release process by writing your own changelog entry. For an example, see:
https://github.com/facebook/react-native/wiki/Changelog
-->

[General] [Fixed] - `onLayout` prop is handled correctly in `<KeyboardAvoidingView>`

Pull Request resolved: https://github.com/facebook/react-native/pull/32609

Test Plan:
| Current Behavior with the `onLayout` prop specified | After applying fix |
|---|---|
| ![Simulator Screen Recording - iPhone 11 - 2021-11-17 at 14 44 09](https://user-images.githubusercontent.com/1406082/142287541-0dbcf137-4d72-4ab6-9367-ac42bdf5aed9.gif) | ![Simulator Screen Recording - iPhone 11 - 2021-11-17 at 14 44 28](https://user-images.githubusercontent.com/1406082/142287611-c7424a6c-b590-48f7-8d74-e96543eab41c.gif) |

Reviewed By: kacieb

Differential Revision: D32481315

Pulled By: philIip

fbshipit-source-id: 2f65440f4996152e4133211136f2920026149ee9
2021-11-23 18:15:35 -08:00
Jesse Katsumata 00bb2ba62d Fix Dead links to documents in the comments (#32619)
Summary:
Links under `reactnative.dev` that ended with `.html` lead to Page not found.
Fixed the url so that users get sent to the appropriate url.

## Changelog

<!-- Help reviewers and the release process by writing your own changelog entry. For an example, see:
https://github.com/facebook/react-native/wiki/Changelog
-->

[General] [Fixed] - Fixed dead links in the comments.

Pull Request resolved: https://github.com/facebook/react-native/pull/32619

Test Plan: - Changed links are accessible

Reviewed By: lunaleaps

Differential Revision: D32528978

Pulled By: cortinico

fbshipit-source-id: e039d18188371cf5240b37049e431329e28b1b8b
2021-11-22 03:31:10 -08:00
David Vacca 44143b50fd Update ViewConfigs to support onEnter/onExit/onMove events
Summary:
This diff updates the ViewConfigs in RN Android to add support for onEnter/onExit/onMove events.

Open questions:

- Should we just remove the override for RN VR: https://www.internalfb.com/code/ovrsource/[c82b81893393ad0c6f8c6e7f347e82bba39dc8cc]/arvr/js/libraries/reactvr/VrShellPanelLib/rn-support/setUpViewConfigOverrides.js

- Should we use w3c naming now (e.g. onPointerEnter / onPointerExit / onPointerMove) ? or should we migrate to it later? what would be the effort for VR to migrate now to onPointerEnter / onPointerExit / onPointerMove?

changelog: [Android][Changed] Add ViewConfigs to support onEnter/onExit/onMove events

Reviewed By: RSNara

Differential Revision: D32253129

fbshipit-source-id: 539d8672825c7f18f0b6a2570764a5988cd936bc
2021-11-19 15:48:14 -08:00
Phillip Pan b735cdf09d add scrollTo metadata RCTBackedTextInputViewProtocol
Summary:
fixing oncall issue: https://fb.workplace.com/groups/rn.support/permalink/7241260632589156/

in this diff, we add the properties to the native views that are needed for the `onScroll` event.

`UITextField` is not a `UIScrollView` unlike `UITextView`, so we need to add these dummy properties

Changelog: [Internal]

Reviewed By: sammy-SC

Differential Revision: D32523147

fbshipit-source-id: 1d4f227f498fa1c333e2d6c457484b559ca18f7e
2021-11-19 11:41:26 -08:00
Genki Kondo f8fc90546c Fix reference URLs in Animated
Summary:
Fix reference URLs in Animated library

Changelog: [Internal]

Reviewed By: yungsters

Differential Revision: D32507849

fbshipit-source-id: ec10202b0f07305e74c787d818fa1f288b775673
2021-11-17 20:35:19 -08:00
Andrei Shikov 55663ec99d React Native sync for revisions afcb9cd...c0c71a8
Summary:
This sync includes the following changes:
- **[c0c71a868](https://github.com/facebook/react/commit/c0c71a868 )**: Re-enable useMutableSource in internal RN ([#22750](https://github.com/facebook/react/pull/22750)) //<Ricky>//
- **[cb11155c8](https://github.com/facebook/react/commit/cb11155c8 )**: Add runtime type checks around module boundary code ([#22748](https://github.com/facebook/react/pull/22748)) //<Brian Vaughn>//
- **[a04f13d29](https://github.com/facebook/react/commit/a04f13d29 )**: react-refresh@0.11.0 //<Dan Abramov>//
- **[ff9897d23](https://github.com/facebook/react/commit/ff9897d23 )**: [React Refresh] support typescript namespace syntax ([#22621](https://github.com/facebook/react/pull/22621)) //<irinakk>//
- **[0ddd69d12](https://github.com/facebook/react/commit/0ddd69d12 )**: Throw on hydration mismatch and force client rendering if boundary hasn't suspended within concurrent root ([#22629](https://github.com/facebook/react/pull/22629)) //<salazarm>//
- **[c3f34e4be](https://github.com/facebook/react/commit/c3f34e4be )**: eslint-plugin-react-hooks@4.3.0 //<Dan Abramov>//
- **[827021c4e](https://github.com/facebook/react/commit/827021c4e )**: Changelog for eslint-plugin-react-hooks@4.3.0 //<Dan Abramov>//
- **[8ca3f567b](https://github.com/facebook/react/commit/8ca3f567b )**: Fix module-boundary wrappers ([#22688](https://github.com/facebook/react/pull/22688)) //<Brian Vaughn>//
- **[1bf6deb86](https://github.com/facebook/react/commit/1bf6deb86 )**: Renamed packages/react-devtools-scheduling-profiler to packages/react-devtools-timeline ([#22691](https://github.com/facebook/react/pull/22691)) //<Brian Vaughn>//
- **[51c558aeb](https://github.com/facebook/react/commit/51c558aeb )**: Rename (some) "scheduling profiler" references to "timeline" ([#22690](https://github.com/facebook/react/pull/22690)) //<Brian Vaughn>//
- **[00ced1e2b](https://github.com/facebook/react/commit/00ced1e2b )**: Fix useId in strict mode ([#22681](https://github.com/facebook/react/pull/22681)) //<Andrew Clark>//
- **[5cccacd13](https://github.com/facebook/react/commit/5cccacd13 )**: Upgrade useId to alpha channel ([#22674](https://github.com/facebook/react/pull/22674)) //<Andrew Clark>//
- **[75f3ddebf](https://github.com/facebook/react/commit/75f3ddebf )**: Remove experimental useOpaqueIdentifier API ([#22672](https://github.com/facebook/react/pull/22672)) //<Andrew Clark>//
- **[8c4a05b8f](https://github.com/facebook/react/commit/8c4a05b8f )**: Remove flow pragma comment from module registration start/stop templates ([#22670](https://github.com/facebook/react/pull/22670)) //<Brian Vaughn>//
- **[ebf9ae857](https://github.com/facebook/react/commit/ebf9ae857 )**: useId ([#22644](https://github.com/facebook/react/pull/22644)) //<Andrew Clark>//
- **[a0d991fe6](https://github.com/facebook/react/commit/a0d991fe6 )**: Re-land #22292 (remove uMS from open source build) ([#22664](https://github.com/facebook/react/pull/22664)) //<Andrew Clark>//
- **[6bce0355c](https://github.com/facebook/react/commit/6bce0355c )**: Upgrade useSyncExternalStore to alpha channel ([#22662](https://github.com/facebook/react/pull/22662)) //<Andrew Clark>//
- **[7034408ff](https://github.com/facebook/react/commit/7034408ff )**: Follow-up improvements to error code extraction infra ([#22516](https://github.com/facebook/react/pull/22516)) //<Andrew Clark>//
- **[90e5d3638](https://github.com/facebook/react/commit/90e5d3638 )**: chore: fix comment typo ([#22615](https://github.com/facebook/react/pull/22615)) //<btea>//
- **[3c4c1c470](https://github.com/facebook/react/commit/3c4c1c470 )**: Remove warning for dangling passive effects ([#22609](https://github.com/facebook/react/pull/22609)) //<Andrew Clark>//
- **[d5b6b4b86](https://github.com/facebook/react/commit/d5b6b4b86 )**: Expand act warning to cover all APIs that might schedule React work ([#22607](https://github.com/facebook/react/pull/22607)) //<Andrew Clark>//
- **[fa9bea0c4](https://github.com/facebook/react/commit/fa9bea0c4 )**: Initial implementation of cache cleanup ([#22510](https://github.com/facebook/react/pull/22510)) //<Joseph Savona>//
- **[0e8a5aff3](https://github.com/facebook/react/commit/0e8a5aff3 )**: Scheduling Profiler: Add marks for component effects (mount and unmount) ([#22578](https://github.com/facebook/react/pull/22578)) //<Brian Vaughn>//
- **[4ba20579d](https://github.com/facebook/react/commit/4ba20579d )**: Scheduling Profiler: De-emphasize React internal frames ([#22588](https://github.com/facebook/react/pull/22588)) //<Brian Vaughn>//
- **[cdb8a1d19](https://github.com/facebook/react/commit/cdb8a1d19 )**: [Fizz] Add option to inject bootstrapping script tags after the shell is injected ([#22594](https://github.com/facebook/react/pull/22594)) //<Sebastian Markbåge>//
- **[34e4c9756](https://github.com/facebook/react/commit/34e4c9756 )**: Clear extra nodes if there's a hydration mismatch within a suspense boundary  ([#22592](https://github.com/facebook/react/pull/22592)) //<Sebastian Markbåge>//
- **[02f411578](https://github.com/facebook/react/commit/02f411578 )**: Upgrade useInsertionEffect to stable ([#22589](https://github.com/facebook/react/pull/22589)) //<Andrew Clark>//
- **[2af4a7933](https://github.com/facebook/react/commit/2af4a7933 )**: Hydrate using SuspenseComponent as the parent ([#22582](https://github.com/facebook/react/pull/22582)) //<Sebastian Markbåge>//
- **[b1acff0cc](https://github.com/facebook/react/commit/b1acff0cc )**: Enable cache in test renderer ([#22580](https://github.com/facebook/react/pull/22580)) //<Joseph Savona>//
- **[996da67b2](https://github.com/facebook/react/commit/996da67b2 )**: Replace global `jest` heuristic with `IS_REACT_ACT_ENVIRONMENT` ([#22562](https://github.com/facebook/react/pull/22562)) //<Andrew Clark>//
- **[163e81c1f](https://github.com/facebook/react/commit/163e81c1f )**: Support disabling spurious act warnings with a global environment flag ([#22561](https://github.com/facebook/react/pull/22561)) //<Andrew Clark>//
- **[23b7dfeff](https://github.com/facebook/react/commit/23b7dfeff )**: Enable scheduling profiler for RN FB profiling builds ([#22566](https://github.com/facebook/react/pull/22566)) //<Brian Vaughn>//
- **[61455a25b](https://github.com/facebook/react/commit/61455a25b )**: Enable experimental Cache API in www TestRenderer ([#22554](https://github.com/facebook/react/pull/22554)) //<Joseph Savona>//
- **[7142d110b](https://github.com/facebook/react/commit/7142d110b )**: Bugfix: Nested useOpaqueIdentifier references ([#22553](https://github.com/facebook/react/pull/22553)) //<Andrew Clark>//
- **[1e247ff89](https://github.com/facebook/react/commit/1e247ff89 )**: Enabled scheduling profiler marks for React Native FB target ([#22544](https://github.com/facebook/react/pull/22544)) //<Brian Vaughn>//
- **[c16b005f2](https://github.com/facebook/react/commit/c16b005f2 )**: Update test and stack frame code to support newer V8 stack formats ([#22477](https://github.com/facebook/react/pull/22477)) //<Brian Vaughn>//
- **[55d75005b](https://github.com/facebook/react/commit/55d75005b )**: duplicate value in variable ([#22390](https://github.com/facebook/react/pull/22390)) //<BIKI DAS>//

Changelog:
[General][Changed] - React Native sync for revisions afcb9cd...c0c71a8

jest_e2e[run_all_tests]

Reviewed By: yungsters

Differential Revision: D32395873

fbshipit-source-id: 3afd158f167b1eedcc244e29aba1a2c502d3c9d9
2021-11-15 06:01:03 -08:00
Marcel Lasaj 9eb0881c8f fix(android): Updated TextInput prop types to accomodate for new autoComplete values (#32575)
Summary:
<!-- Explain the **motivation** for making this change. What existing problem does the pull request solve? -->
This fixes the "Failed prop type: Invalid prop `autoComplete` of value `[any-of-the-new-values]`" warning, as mentioned in https://github.com/facebook/react-native/issues/32557.

[This commit](d9e0ea77f0) introduced new HintConstants for autofill, but added those only to [`TextInput.js`](https://github.com/facebook/react-native/blob/main/Libraries/Components/TextInput/TextInput.js#L331) and forgot to add them (and the new docs' description) to either [`AndroidTextInputNativeComponent`](https://github.com/facebook/react-native/blob/main/Libraries/Components/TextInput/AndroidTextInputNativeComponent.js#L99) or [`DeprecatedTextInputPropTypes.js`](https://github.com/facebook/react-native/blob/main/Libraries/DeprecatedPropTypes/DeprecatedTextInputPropTypes.js#L67). I know, the latter has clearly been deprecated, but until it is actually being removed, it shouldn't throw warnings like that.

## Changelog

<!-- Help reviewers and the release process by writing your own changelog entry. For an example, see:
https://github.com/facebook/react-native/wiki/Changelog
-->

[Android] [Fixed] - Updated TextInput prop types to accomodate for new autoComplete values

Pull Request resolved: https://github.com/facebook/react-native/pull/32575

Test Plan: There is no warning after these changes.

Reviewed By: yungsters

Differential Revision: D32324108

Pulled By: lunaleaps

fbshipit-source-id: df27cbbd54788f26471029c9201c6a27ca8b7893
2021-11-11 15:41:44 -08:00
Liron Yahdav f249d21da0 Native changes for TextInput.setSelection method
Summary:
Native changes in preparation for adding a `setSelection` imperative method to `TextInput`.

Changelog: [Internal]

Reviewed By: JoshuaGross

Differential Revision: D31590771

fbshipit-source-id: eed40d1c2803fec713f2008ab8053a2812249715
2021-11-11 13:35:46 -08:00
Gijs Weterings 5050e7eaa1 Pass testID down in Modal
Summary:
Changelog:
[General][Fixed] - Modal accepts a testID but didn't forward it to RCTModalHostView, therefore not making it show up for e2e tests depending on viewhierarchy.

Reviewed By: motiz88

Differential Revision: D32354377

fbshipit-source-id: 51df3a1f81c4b77240e83101b367b033ce98b0c7
2021-11-11 07:07:11 -08:00
Niklas Mischkulnig 91728e2266 Remove unused and incorrect type declarations (#32570)
Summary:
See https://github.com/facebook/react-native/pull/32566

This file doesn't have a `flow` comment, and the types that I removed here are incorrect anyway (missing a generic type parameter) because Flow didn't check them.

## Changelog

<!-- Help reviewers and the release process by writing your own changelog entry. For an example, see:
https://github.com/facebook/react-native/wiki/Changelog
-->

[General] [Fixed] - Remove unused and incorrect type declarations in WebSocketInterceptor

Pull Request resolved: https://github.com/facebook/react-native/pull/32570

Test Plan: See https://github.com/facebook/react-native/pull/32566

Reviewed By: lunaleaps

Differential Revision: D32315077

Pulled By: GijsWeterings

fbshipit-source-id: d3b826a01a0bb8e38380de5b79cb6b5d13db2ef1
2021-11-11 04:44:00 -08:00
Evan Yeung 037e346197 Add LTI annotations to xplat/js
Summary:
This diff runs the codemod to add type annotations to function parameters in preparation for Flow's local type inference (LTI) project. I ran the codemod over xplat/js and reverted any files that had flow errors in them. See the list of commands run to see the regeneration of various files.

Changelog:
[Internal][Changed] - Added type annotations

Reviewed By: yungsters

Differential Revision: D32075270

fbshipit-source-id: 6a9cd85aab120b4d9e690bac142a415525dbf298
2021-11-10 15:40:15 -08:00
Evan Yeung 83a1791991 Manually fix types for LTI annotations in xplat/js
Summary:
This diff makes the manual changes necessary to fix many of the errors in the stacked diff codemod.

See https://fb.workplace.com/groups/flowlang/posts/917522612186736 for details on this effort.

Reviewed By: bradzacher

Differential Revision: D31615035

fbshipit-source-id: 179b2df516833d59873b9003350f81eb4a6b4e9d
2021-11-10 15:40:15 -08:00
Niklas Mischkulnig 98abf1b02f Complete missing Flow declarations in URL (#32566)
Summary:
When transpiling flow with a Babel config like
```
{
	plugins:  [['babel/plugin-transform-flow-strip-types', {requireDirective: true}]]
}
```
all files containing Flow syntax need to have `flow` at the top of the file.
```
node_modules/react-native/Libraries/Blob/URL.js: A flow directive is required when using Flow annotations with the `requireDirective` option.
  55 |   _searchParams = [];
  56 |
> 57 |   constructor(params: any) {
     |                     ^^^^^
  58 |     if (typeof params === 'object') {
  59 |       Object.keys(params).forEach(key => this.append(key, params[key]));
  60 |     }
```

In URL, it was removed (mistakenly I think) by 63038500a2 (diff-552f9731d5c9bc329105a5f4224319966395e59b5bb23202b756c5d152e0f007). Only the `strict-local´ part should have been removed, not the whole line.

## Changelog

<!-- Help reviewers and the release process by writing your own changelog entry. For an example, see:
https://github.com/facebook/react-native/wiki/Changelog
-->

[General] [Fixed] - Complete missing Flow declarations in URL

Pull Request resolved: https://github.com/facebook/react-native/pull/32566

Test Plan: See above

Reviewed By: yungsters

Differential Revision: D32295816

Pulled By: lunaleaps

fbshipit-source-id: 1ad19a032e3399434f4e6a8eebbf37071a0f97be
2021-11-10 13:15:10 -08:00
Tim Yung 36bbd8fa31 RN: Eliminate Jest Log Spew
Summary:
Eliminates all of the console logs that appear when successfully running Jest tests for React Native.

Changelog:
[Internal]

Reviewed By: lunaleaps

Differential Revision: D32304619

fbshipit-source-id: 8bc8ef9337ae6af588238cec7cfb874ac6067340
2021-11-09 23:42:28 -08:00
Tim Yung 148c98ec80 RN: Resolve Outstanding ESLint Warnings
Summary:
Resolves outstanding ESLint warnings in React Native.

Changelog:
[Internal]

Reviewed By: lunaleaps

Differential Revision: D32291912

fbshipit-source-id: 61337d5a5a0e6ed55f732675e029f4b76d850af9
2021-11-09 21:46:21 -08:00
Tim Yung 10f9ab4d69 RN: Follow-up Format w/ Prettier v2.x
Summary:
When I upgraded React Native to Prettier v2.x, I removed `format` from a few files to reduce the number of changes.

This is a follow-up to bring back `format` and fix any remaining issues.

Changelog:
[Internal]

Reviewed By: zertosh

Differential Revision: D32287259

fbshipit-source-id: 37ea6d2c973b1db5d37c46d73675bdf436fb9a9d
2021-11-09 13:16:43 -08:00
Tim Yung 8880c09076 RN: Rename `Keyboard.remove{Event =>}Listener`
Summary:
Renames `Keyboard.removeEventListener` to `Keyboard.removeListener`.

When I implemented the compatibility layer in {D26589441 (035718ba97)}, I accidentally used the wrong name. Since `Keyboard.removeEventListener` was always deprecated, this removes it completely.

Changelog:
[General][Changed] - Rename deprecated `Keyboard.removeEventListener` to `Keyboard.removeListener`.

Reviewed By: lunaleaps

Differential Revision: D32282743

fbshipit-source-id: 309382af3269f85f781d38367d115a2ce3690efb
2021-11-09 12:57:40 -08:00
Rubén Norte 74b91c5073 Revert changes in RN preprocessor
Summary: Changelog: [General][Fixed] Revert changes in Jest preprocessor to fix tests in external projects

Reviewed By: yungsters

Differential Revision: D32250044

fbshipit-source-id: 0ed4c9f7bcfa82349b5c2ec7af2ccda970bbb0ef
2021-11-09 01:15:14 -08:00
Tim Yung 280e4ce4fe RN: Change `@{ => no}format` in React Files
Summary:
Instead of using `.prettierrc` to ignore the files sync'd from React, replace `format` with `noformat`.

This is necessary because currently, the version of Prettier used in React Native (v2.4.1) differs from the version used in React (v1.19.1). We can revert this when React is upgraded.

Changelog:
[Internal]

Reviewed By: ShikaSD

Differential Revision: D32129937

fbshipit-source-id: ca3b379edd732670a9a0b1b20b3f31bdad4b74aa
2021-11-09 00:33:12 -08:00
Tim Yung 32f36fe105 RN: Fix Prettier Formatting Errors (#32524)
Summary:
Ignores the `Libraries/Renderer/` directory of files which are synchronized from React (and should not be modified).

Also, formats some EventEmitter modules that for some reason were missed when I upgraded to Prettier v2.x.

## Changelog

[Internal]

Pull Request resolved: https://github.com/facebook/react-native/pull/32524

Test Plan:
```
yarn run format-check
```

Reviewed By: javache

Differential Revision: D32129837

Pulled By: yungsters

fbshipit-source-id: 1cb42cec210508db499850e13f77beefdb35eb25
2021-11-09 00:33:12 -08:00
Ramanpreet Nara f1f88b02e8 Stop unnecessarily spreading ReactNativeViewViewConfig
Summary:
There's no need to spread ReactNativeViewViewConfig props into ViewConfig partials ourselves. createViewConfig does this for us:

https://www.internalfb.com/code/fbsource/[b319a947b3e5]/xplat/js/react-native-github/Libraries/NativeComponent/ViewConfig.js?lines=20-50

Changelog: [Internal]

Reviewed By: yungsters

Differential Revision: D32187833

fbshipit-source-id: 6d7ea3fc808ccfc98e067f8f52334f7b3417d7a7
2021-11-09 00:29:13 -08:00
Ramanpreet Nara d29a6a116e Make sizesDiffer and matricesDiffer type-safe
Summary: Changelog: [Internal]

Reviewed By: philIip

Differential Revision: D32159547

fbshipit-source-id: 5223814cbb85c58219b99686b0b527768410e3ac
2021-11-09 00:29:13 -08:00
Ramanpreet Nara 73b243acbc Refactor: Make StaticViewConfigValidator.validate() output objects
Summary:
## Changes
- StaticViewConfigValidator.validate() now outputs a ValidationOutput object, that contains a Array<Differences>, if invalid
- The Difference type now contains the nativeValue and the staticValue. This makes the validate() function more useful in reconciling ViewConfigs.
- Nothing should change in NativeComponentRegistry.

Changelog: [Internal]

Reviewed By: yungsters

Differential Revision: D32139973

fbshipit-source-id: a9556fa370d2c14f9e5d0540b44824cd61773958
2021-11-09 00:29:13 -08:00
Ramanpreet Nara 36612a8060 Default {bubbling,direct}EventTypes to {} in Native VCs
Summary:
## Rationale
**Consistency with Static View Configs:** Static view config will default bubblingEventTypes or directEventTypesto to an empty object, if the any of them are undefined.

https://www.internalfb.com/code/fbsource/[a73d46ab4052838e46e0f3aab8508025795aec1f]/xplat/js/react-native-github/Libraries/NativeComponent/ViewConfig.js?lines=20-23%2C26-33%2C41%2C43-50

Changelog: [Internal]

Reviewed By: yungsters

Differential Revision: D32159393

fbshipit-source-id: fefb3509b9b7c7374d2c3d8962afa5402daf6f72
2021-11-09 00:29:13 -08:00
Paige Sun 77ce91822d Minor Style: Make RCTNativeAnimatedNodesManager a non-null class
Summary:
For native animations,
* Add NS_ASSUME_NONNULL_BEGIN / END to RCTNativeAnimatedNodesManager since most of its params are nonnull.

* Explicitly mark nullable params.

Reviewed By: philIip

Differential Revision: D32209819

fbshipit-source-id: c881294d8ba8c2cdcaa931801c977cd5bbe764f4
2021-11-05 14:15:59 -07:00
Paige Sun 698a936e4d Minor Style: Make viewName nullable in native animated modules for Fabric
Summary:
Make viewName in native animations nullable, because viewName is not used when the RCTAnimationNode is managed by Fabric.

Changelog: [Internal] Minor: Make viewName nullable in native animated modules for Fabric

Reviewed By: philIip

Differential Revision: D32196270

fbshipit-source-id: 76d05dc7fd2850efb097f953ccd22fd3f6d80599
2021-11-05 14:15:58 -07:00
Paige Sun e9ed115bab Remove RCTUIManagerObserver from RCTNativeAnimatedTurboModule
Reviewed By: philIip

Differential Revision: D32115902

fbshipit-source-id: 27a35ff4b4dad5f6364af6b91a6de9e467c068d0
2021-11-05 14:15:58 -07:00
Andrei Shikov f0947a78af Back out "React Native sync for revisions afcb9cd...3fcd81d"
Summary: Changelog: [Internal] - Reverting React sync due to Recoil being broken

Reviewed By: yungsters

Differential Revision: D32148092

fbshipit-source-id: 276b33d3c9c9059472590cd6a987c2f5a658910c
2021-11-03 16:10:15 -07:00
Ramanpreet Nara d03b4f9ee2 Omit null process/diff functions from native VC attributes
Summary:
## Rationale
- **Consistency with Static View Configs**: In Static View Configs, if there isn't a diff or process function, we do not generate a property for it.
- **Type-safety**: The [Flow type for attributes](https://fburl.com/code/tafncg5c), doesn't allow null diff/process functions.

Changelog: [Internal]

Reviewed By: yungsters

Differential Revision: D32152924

fbshipit-source-id: 4156158c5fe09868feec1a0c55aa411d2bd72a27
2021-11-03 15:58:30 -07:00
Tim Yung fba1ae1643 RN: Temporarily Disable Prettier for Some Files
Summary:
We are in the middle of a Prettier upgrade and some of the files which disagree between Prettier v1.x and v2.x are now being flagged by `eslint-plugin-prettier` as lint errors.

The correct fix here is probably to update `eslint-config-prettier` and `eslint-plugin-prettier`, but I am landing this first to unbreak CI.

Reviewed By: mendoncakeegan

Differential Revision: D32129458

fbshipit-source-id: a5206a5ef58f1d7614f9459c99b9e39109be6de9
2021-11-02 23:09:38 -07:00
Tim Yung 77ecc7ede1 JS: Format with Prettier v2.4.1 [3/n]
Summary:
Changelog:
[General][Internal]

Reviewed By: zertosh

Differential Revision: D31883447

fbshipit-source-id: cbbf85e4bf935096d242336f41bf0cc5d6f92359
2021-11-02 22:14:16 -07:00
Paige Sun 6fd3bc2175 Fix Gemstone Profile Swiping Animations by fixing Animated.Value for Animated.event
Reviewed By: RSNara

Differential Revision: D32037021

fbshipit-source-id: 41da68706e6c752bf480d11112f70692f7234756
2021-11-02 17:32:03 -07:00
Andrei Shikov e161598c40 React Native sync for revisions afcb9cd...3fcd81d
Summary:
This sync includes the following changes:
- **[5cccacd13](https://github.com/facebook/react/commit/5cccacd13 )**: Upgrade useId to alpha channel ([#22674](https://github.com/facebook/react/pull/22674)) //<Andrew Clark>//
- **[75f3ddebf](https://github.com/facebook/react/commit/75f3ddebf )**: Remove experimental useOpaqueIdentifier API ([#22672](https://github.com/facebook/react/pull/22672)) //<Andrew Clark>//
- **[8c4a05b8f](https://github.com/facebook/react/commit/8c4a05b8f )**: Remove flow pragma comment from module registration start/stop templates ([#22670](https://github.com/facebook/react/pull/22670)) //<Brian Vaughn>//
- **[ebf9ae857](https://github.com/facebook/react/commit/ebf9ae857 )**: useId ([#22644](https://github.com/facebook/react/pull/22644)) //<Andrew Clark>//
- **[a0d991fe6](https://github.com/facebook/react/commit/a0d991fe6 )**: Re-land #22292 (remove uMS from open source build) ([#22664](https://github.com/facebook/react/pull/22664)) //<Andrew Clark>//
- **[6bce0355c](https://github.com/facebook/react/commit/6bce0355c )**: Upgrade useSyncExternalStore to alpha channel ([#22662](https://github.com/facebook/react/pull/22662)) //<Andrew Clark>//
- **[7034408ff](https://github.com/facebook/react/commit/7034408ff )**: Follow-up improvements to error code extraction infra ([#22516](https://github.com/facebook/react/pull/22516)) //<Andrew Clark>//
- **[90e5d3638](https://github.com/facebook/react/commit/90e5d3638 )**: chore: fix comment typo ([#22615](https://github.com/facebook/react/pull/22615)) //<btea>//
- **[3c4c1c470](https://github.com/facebook/react/commit/3c4c1c470 )**: Remove warning for dangling passive effects ([#22609](https://github.com/facebook/react/pull/22609)) //<Andrew Clark>//
- **[d5b6b4b86](https://github.com/facebook/react/commit/d5b6b4b86 )**: Expand act warning to cover all APIs that might schedule React work ([#22607](https://github.com/facebook/react/pull/22607)) //<Andrew Clark>//
- **[fa9bea0c4](https://github.com/facebook/react/commit/fa9bea0c4 )**: Initial implementation of cache cleanup ([#22510](https://github.com/facebook/react/pull/22510)) //<Joseph Savona>//
- **[0e8a5aff3](https://github.com/facebook/react/commit/0e8a5aff3 )**: Scheduling Profiler: Add marks for component effects (mount and unmount) ([#22578](https://github.com/facebook/react/pull/22578)) //<Brian Vaughn>//
- **[4ba20579d](https://github.com/facebook/react/commit/4ba20579d )**: Scheduling Profiler: De-emphasize React internal frames ([#22588](https://github.com/facebook/react/pull/22588)) //<Brian Vaughn>//
- **[cdb8a1d19](https://github.com/facebook/react/commit/cdb8a1d19 )**: [Fizz] Add option to inject bootstrapping script tags after the shell is injected ([#22594](https://github.com/facebook/react/pull/22594)) //<Sebastian Markbåge>//
- **[34e4c9756](https://github.com/facebook/react/commit/34e4c9756 )**: Clear extra nodes if there's a hydration mismatch within a suspense boundary  ([#22592](https://github.com/facebook/react/pull/22592)) //<Sebastian Markbåge>//
- **[02f411578](https://github.com/facebook/react/commit/02f411578 )**: Upgrade useInsertionEffect to stable ([#22589](https://github.com/facebook/react/pull/22589)) //<Andrew Clark>//
- **[2af4a7933](https://github.com/facebook/react/commit/2af4a7933 )**: Hydrate using SuspenseComponent as the parent ([#22582](https://github.com/facebook/react/pull/22582)) //<Sebastian Markbåge>//
- **[b1acff0cc](https://github.com/facebook/react/commit/b1acff0cc )**: Enable cache in test renderer ([#22580](https://github.com/facebook/react/pull/22580)) //<Joseph Savona>//
- **[996da67b2](https://github.com/facebook/react/commit/996da67b2 )**: Replace global `jest` heuristic with `IS_REACT_ACT_ENVIRONMENT` ([#22562](https://github.com/facebook/react/pull/22562)) //<Andrew Clark>//
- **[163e81c1f](https://github.com/facebook/react/commit/163e81c1f )**: Support disabling spurious act warnings with a global environment flag ([#22561](https://github.com/facebook/react/pull/22561)) //<Andrew Clark>//
- **[23b7dfeff](https://github.com/facebook/react/commit/23b7dfeff )**: Enable scheduling profiler for RN FB profiling builds ([#22566](https://github.com/facebook/react/pull/22566)) //<Brian Vaughn>//
- **[61455a25b](https://github.com/facebook/react/commit/61455a25b )**: Enable experimental Cache API in www TestRenderer ([#22554](https://github.com/facebook/react/pull/22554)) //<Joseph Savona>//
- **[7142d110b](https://github.com/facebook/react/commit/7142d110b )**: Bugfix: Nested useOpaqueIdentifier references ([#22553](https://github.com/facebook/react/pull/22553)) //<Andrew Clark>//
- **[1e247ff89](https://github.com/facebook/react/commit/1e247ff89 )**: Enabled scheduling profiler marks for React Native FB target ([#22544](https://github.com/facebook/react/pull/22544)) //<Brian Vaughn>//
- **[c16b005f2](https://github.com/facebook/react/commit/c16b005f2 )**: Update test and stack frame code to support newer V8 stack formats ([#22477](https://github.com/facebook/react/pull/22477)) //<Brian Vaughn>//
- **[55d75005b](https://github.com/facebook/react/commit/55d75005b )**: duplicate value in variable ([#22390](https://github.com/facebook/react/pull/22390)) //<BIKI DAS>//

Changelog:
[General][Changed] - React Native sync for revisions afcb9cd...3fcd81d

jest_e2e[run_all_tests]

Reviewed By: yungsters

Differential Revision: D32065987

fbshipit-source-id: ef2d402835c981aab68ca40a894c66c1630864e9
2021-11-02 12:06:32 -07:00
grgr-dkrk c8b83d4e0b feat: add `isAccessibilityServiceEnabled` (#31396)
Summary:
fix https://github.com/facebook/react-native/issues/30863

This PR adds `isAccessibilityServiceEnabled` to get if accessibility services are enabled on Android.

## Changelog

<!-- Help reviewers and the release process by writing your own changelog entry. For an example, see:
https://github.com/facebook/react-native/wiki/Changelog
-->

[Android] [Added] - Added `isAccessibilityServiceEnabled` to get if accessibility services are enabled

Pull Request resolved: https://github.com/facebook/react-native/pull/31396

Test Plan: ![accessibilityService](https://user-images.githubusercontent.com/40130327/115560972-11d5b100-a2f0-11eb-8aa2-7c52dc71ca59.gif)

Reviewed By: yungsters

Differential Revision: D31911880

Pulled By: lunaleaps

fbshipit-source-id: 9ae294999a6d46bf051ab658507bf97764a945d2
2021-10-29 18:40:59 -07:00
Pieter De Baets d1439e8b85 Remove unused ensureComponentIsNative mock
Summary: Changelog: [Internal]

Reviewed By: philIip

Differential Revision: D31893181

fbshipit-source-id: 63204b818465f8ae06135f42c63e1340f6abb351
2021-10-26 03:24:01 -07:00
Sota Ogo f7e4c07c84 Move codegen output out of node_modules
Summary:
In this diff, it moves the codegen output location out of node_modules and to build/generated/ios folder.

A temp pod spec will be created so that those files will be included in the Xcode project.

Changelog: [Internal]

Reviewed By: hramos, cortinico

Differential Revision: D31809012

fbshipit-source-id: ba1c884c8024306ba0fd2102837b7dbebc6e18ac
2021-10-25 20:48:24 -07:00
Saad Najmi 1b30dd074b Expose Pressability Hover config props in Pressable (#32405)
Summary:
Several desktop forks (`react-native-macos`, `react-native-windows`, `react-native-web`) support mouse events, and while the stock Pressable component has the ability to support mouse events, it seems we aren't forwarding some props properly from Pressable -> Pressability.

Pressability will calculate onMouseEnter / onMouseLeave event handlers based on the `onHoverIn/onHoverOut` callbacks passed into PressabilityConfig.
ad0d4534a7/Libraries/Pressability/Pressability.js (L552)
 However, Pressable does not pass take in onHoverIn/onHoverOut props to pass to PressabilityConfig, so we can't take advantage of this functionality. This change should simply address that by passing the props through.

## Changelog

<!-- Help reviewers and the release process by writing your own changelog entry. For an example, see:
https://github.com/facebook/react-native/wiki/Changelog
-->

[General] [Fixed] - Pressabel not passing hover props and event handlers to PressabilityConfig

Pull Request resolved: https://github.com/facebook/react-native/pull/32405

Test Plan: I fixed a similar issue in `react-native-macos` that I am now trying to contribute back upstream. https://github.com/microsoft/react-native-macos/pull/855

Reviewed By: yungsters

Differential Revision: D31667737

Pulled By: sota000

fbshipit-source-id: f0bbe48302703bb2c45280d2afeec8d7a4586b6a
2021-10-25 19:49:21 -07:00
Andrew Scherkus b2415c4866 Update XMLHttpRequest.getAllResponseHeaders() implementation (#32353) (#32363)
Summary:
As per the XMLHttpRequest specification [1], getAllResponseHeaders() should return a string of headers with lowercased names and sorted by their uppercase representation, with each header ending with '\r\n'.

[1] https://xhr.spec.whatwg.org/#the-getallresponseheaders()-method

## Changelog

[General] [Changed] XMLHttpRequest.getAllResponseHeaders() now returns headers with names lowercased and sorted in ascending order, as per specification

Pull Request resolved: https://github.com/facebook/react-native/pull/32363

Test Plan:
Test derived from Web Platform Test repository:
https://github.com/web-platform-tests/wpt/tree/master/xhr

Reviewed By: yungsters

Differential Revision: D31626217

Pulled By: sota000

fbshipit-source-id: 299d005facbe1c15b8cda5eed6750db75addca80
2021-10-25 19:45:51 -07:00
Connor Tumbleson 4b25a0aaa0 feat: add missing Android dangerous permissions (#32445)
Summary:
This PR adds all missing `dangerous` permissions in Android. I recently updated these for Android 12 and found many more missing dating all the way back to API 26. After this PR, it will be in sync with ALL dangerous permissions as of the recently released Android 12.

https://developer.android.com/reference/android/Manifest.permission.html#ACCEPT_HANDOVER - 28
https://developer.android.com/reference/android/Manifest.permission.html#ACTIVITY_RECOGNITION - 29
https://developer.android.com/reference/android/Manifest.permission.html#ANSWER_PHONE_CALLS - 26
https://developer.android.com/reference/android/Manifest.permission.html#READ_PHONE_NUMBERS - 26
https://developer.android.com/reference/android/Manifest.permission.html#UWB_RANGING - 31

## Changelog

[Android] [Changed] - Add ACCEPT_HANDOVER, ACTIVITY_RECOGNITION, ANSWER_PHONE_CALLS, READ_PHONE_NUMBERS & UWB_RANGING to PermissionsAndroid

Pull Request resolved: https://github.com/facebook/react-native/pull/32445

Test Plan:
```
PermissionsAndroid.ACCEPT_HANDOVER === 'android.permission.ACCEPT_HANDOVER'
PermissionsAndroid.ACTIVITY_RECOGNITION === 'android.permission.ACTIVITY_RECOGNITION'
PermissionsAndroid.ANSWER_PHONE_CALLS === 'android.permission.ANSWER_PHONE_CALLS'
PermissionsAndroid.READ_PHONE_NUMBERS === 'android.permission.READ_PHONE_NUMBERS'
PermissionsAndroid.UWB_RANGING === 'android.permission.UWB_RANGING'
```

Reviewed By: yungsters

Differential Revision: D31793802

Pulled By: sshic

fbshipit-source-id: 4a2e5086e92ccd223e74db451c4ccd87485ffb63
2021-10-22 06:57:24 -07:00
Pieter De Baets b03e824c52 Mock composite animations when testing
Summary:
Single and composite animations were handled inconsistently in AnimatedMock. Also added a guard to prevent callbacks from triggering additional animations, since we had a test-scenario that did exactly that.

Changelog:
[General][Fixed] - Composite animations will now be ran immediately when the app is in testing mode

Reviewed By: yungsters

Differential Revision: D31826967

fbshipit-source-id: a6416b42e227fe79f5c3a55a9c51beb8451874f8
2021-10-22 06:38:17 -07:00
Tim Yung 3f629049ba RN: Deprecate Prop Types
Summary:
Deprecates `prop-types` from React Native.

Existing use cases will be presented with a warning to migrate to the newly published `deprecated-react-native-prop-types` module.

In a subsequent release, these will be removed from React Native.

Changelog:
[General][Changed] - Accessing `Image.propTypes`, `Text.propTypes`, `TextInput.propTypes`, `ColorPropType`, `EdgeInsetsPropType`, `PointPropType`, or `ViewPropTypes` now emits a deprecation warning.

Reviewed By: kacieb

Differential Revision: D29019309

fbshipit-source-id: 21e518e588fa05c498cc75ba81f69cfa8a9d0613
2021-10-21 17:45:47 -07:00
Tim Yung 70dcba9994 JS: Remove Unused Flow Suppressions
Summary:
Cleans up all unused Flow suppressions.

Changelog:
[Internal]

Reviewed By: kacieb

Differential Revision: D31754978

fbshipit-source-id: 951e28a245782b9bc9e93a6417d88b19ba0c8f1c
2021-10-21 14:26:00 -07:00
Rubén Norte eccbf9b5cb Back out "Re-apply: [RN] Make runtime initialization from React renderers a no-op"
Summary:
Changelog: [internal]

This change had to be reverted because it caused some issues internally at Facebook. After we solved those we re-applied the changes but this also has issues in OSS apps. Specifically, the option in Metro to inject modules to execute before the EntryPoint (in this case `InitializeCore`) doesn't work if those modules aren't part of the bundle in the first place.

This reverts again so we can think about a long-term solution for this.

Original commit changeset: ba145a30ead5

Reviewed By: ShikaSD

Differential Revision: D31825736

fbshipit-source-id: 393b3d5d2a726951a9ac386dc2b1c19ef4a916a5
2021-10-21 04:29:07 -07:00
Phillip Pan def7dd857d use new instead of alloc init
Summary:
i saw this a lot in the codebase, it's not optimal bc we're using two selectors when we only need one.

  fastmod --extensions m,mm '\[\[(.*) alloc] init]' '[${1} new]' --dir xplat/js/react-native-github/*

i manually updated the callsites that this codemod couldn't handle (e.g., where there were more than one of these instances in a single line)

Changelog: [Internal]

Reviewed By: RSNara

Differential Revision: D31776561

fbshipit-source-id: 1b16da240e8a79b54da67383d548921b82b05a9f
2021-10-20 22:18:38 -07:00
David Vacca 928519e4bd Remove extra invariant
Summary:
Remove extra invariant in Text.js

changelog: [internal] internal

Reviewed By: philIip

Differential Revision: D31628462

fbshipit-source-id: ec703c7b77dc842890865d79095b357a80dfa33d
2021-10-20 08:22:28 -07:00
Rubén Norte 1486b31b2b Re-apply: [RN] Make runtime initialization from React renderers a no-op
Summary: Changelog: [internal]

Reviewed By: yungsters

Differential Revision: D31760907

fbshipit-source-id: ba145a30ead52abeb8affca84c3dec21dfefe30c
2021-10-20 04:06:20 -07:00
Tim Yung addf4dab51 RN: Strict Static View Config Validator
Summary:
Creates a new `StaticViewConfigValidator` module that does strict, bidirectional validation. This is notably different from `verifyComponentAttributeEquivalence`, which is undirectional validation.

This will enforce that two configs are equivalent so we can start addressing the inconsistencies (especially per platform). It also improves upon the reporting format by providing more details about the invalidations.

It is hidden behind a `strict` runtime configuration parameter.

Changelog:
[Internal]

Reviewed By: RSNara

Differential Revision: D29024229

fbshipit-source-id: 10271945e089183f505205bd41de5e01faea7568
2021-10-19 00:25:00 -07:00
luism3861 1121ed94ab remove accessibilityStates validAttributes config from ReactNativeViewViewConfig.js (#29656)
Summary:
this little PR remove `accesibilityStates` config in validAttributes, like comment says it can be removed after next release.

## Changelog
[General][Removed] - `accessibilityStates` no longer passed through to RCTView.

Pull Request resolved: https://github.com/facebook/react-native/pull/29656

Reviewed By: philIip

Differential Revision: D31732866

Pulled By: yungsters

fbshipit-source-id: 83b6eb223e76537a09c13ccdb382317421ab4585
2021-10-18 14:34:21 -07:00
Nicola Corti 63f66fce49 Fixes documantion for back Easing
Summary:
The documentation of back easing contains a old link that
is now stale. I'm updating it to link to https://easings.net/#easeInBack

Fixes https://github.com/facebook/react-native/issues/32419

Changelog:
[Android] [Fixed] - Fixes documentation for back Easing animation

Reviewed By: hramos

Differential Revision: D31728560

fbshipit-source-id: 99f7aa60d3748af5429b4ae1aa6cbd79326c5fe6
2021-10-18 13:35:11 -07:00
Jordan Becker e1b698c5f2 fix(RCTBlobManager): Prevent RCTConvert error for allowed null blob types (#32397)
Summary:
While reworking our media picker, I ended up replacing the RNFetchBlob library to use `fetch()`, leveraging React Native's file resolver (especially to interpret `photos://` URI paths).

The migration process was pretty straightforward, however I kept getting RCTConvert errors when calling `fetch` with a `PUT` method and a blob body:

```
JSON value '<null>' of type NSNull cannot be converted to NSString

+[RCTConvert NSString:]
    RCTConvert.m:59
-[RCTBlobManager handleNetworkingRequest:]
-[RCTNetworking processDataForHTTPQuery:callback:]
-[RCTNetworking buildRequest:completionBlock:]
-[RCTNetworking sendRequest:callback:]
__invoking___
-[NSInvocation invoke]
-[NSInvocation invokeWithTarget:]
-[RCTModuleMethod invokeWithBridge:module:arguments:]

Test Plan:
I'll put my `fetch` snippet here. This is using a third-party library in order to get a signed URL, but it is otherwise pretty straightforward.

This snippet would trigger an error before the changes introduced by this PR.

```js
// Setup (specific to third-party lib)
const key = `file/path/in/bucket`
const params = {
  Key: key,
  Bucket: 'my.awesome.bucket',
}
const s3url = await s3.getSignedUrl('putObject', params)

// Letting RN handle how to retrieve a platform-specific resource URI
const localFetch = await fetch(localPath)
// Getting the blob to upload as octet-stream
const blob = await localFetch.blob()

// Actually uploading
await fetch(s3url, {
  method: 'PUT',
  headers: {
    'Accept': 'application/json',
    'Content-Type': 'application/octet-stream',
  },
  body: blob,
})
```

Reviewed By: RSNara

Differential Revision: D31625636

Pulled By: sota000

fbshipit-source-id: a7770018bc3ff2f41321b1bd26ec145b86b18784
2021-10-15 18:56:17 -07:00
David Vacca 4790146374 Fix link in View.js
Summary:
https://reactnative.dev/docs/view.html doesn't work, this diff replaces the url for the new link

[Changelog]
[General][Fixed] - Updated documentation link in `View`.

Reviewed By: yungsters

Differential Revision: D31519836

fbshipit-source-id: c93feee4652caf4ef8390a047599149fc547db48
2021-10-12 18:27:47 -07:00
Luna Wei 8581661e84 Support fbt for accessibilityValue
Summary: Changelog: [Internal] - Change accessibilityValue.text type to allow for Stringish type

Reviewed By: yungsters

Differential Revision: D31577860

fbshipit-source-id: af12505794037a68850a16ce139359e2f8a879e4
2021-10-12 17:39:47 -07:00
Andrei Shikov c75ad2cdb1 React Native sync for revisions e8feb11...afcb9cd
Summary:
This sync includes the following changes:
- **[579c008a7](https://github.com/facebook/react/commit/579c008a7 )**: [Fizz/Flight] pipeToNodeWritable(..., writable).startWriting() -> renderToPipeableStream(...).pipe(writable) ([#22450](https://github.com/facebook/react/pull/22450)) //<Sebastian Markbåge>//
- **[f2c381131](https://github.com/facebook/react/commit/f2c381131 )**: fix: useSyncExternalStoreExtra ([#22500](https://github.com/facebook/react/pull/22500)) //<Daishi Kato>//
- **[0ecbbe142](https://github.com/facebook/react/commit/0ecbbe142 )**: Sync hydrate discrete events in capture phase and dont replay discrete events ([#22448](https://github.com/facebook/react/pull/22448)) //<salazarm>//
- **[a724a3b57](https://github.com/facebook/react/commit/a724a3b57 )**: [RFC] Codemod invariant -> throw new Error ([#22435](https://github.com/facebook/react/pull/22435)) //<Andrew Clark>//
- **[201af81b0](https://github.com/facebook/react/commit/201af81b0 )**: Release pooled cache reference in complete/unwind ([#22464](https://github.com/facebook/react/pull/22464)) //<Joseph Savona>//
- **[033efe731](https://github.com/facebook/react/commit/033efe731 )**: Call get snapshot in useSyncExternalStore server shim ([#22453](https://github.com/facebook/react/pull/22453)) //<salazarm>//
- **[7843b142a](https://github.com/facebook/react/commit/7843b142a )**: [Fizz/Flight] Pass in Destination lazily to startFlowing instead of in createRequest ([#22449](https://github.com/facebook/react/pull/22449)) //<Sebastian Markbåge>//
- **[d9fb383d6](https://github.com/facebook/react/commit/d9fb383d6 )**: Extract queueing logic into shared functions ([#22452](https://github.com/facebook/react/pull/22452)) //<Andrew Clark>//
- **[9175f4d15](https://github.com/facebook/react/commit/9175f4d15 )**: Scheduling Profiler: Show Suspense resource .displayName ([#22451](https://github.com/facebook/react/pull/22451)) //<Brian Vaughn>//
- **[eba248c39](https://github.com/facebook/react/commit/eba248c39 )**: [Fizz/Flight] Remove reentrancy hack ([#22446](https://github.com/facebook/react/pull/22446)) //<Sebastian Markbåge>//
- **[66388150e](https://github.com/facebook/react/commit/66388150e )**: Remove usereducer eager bailout ([#22445](https://github.com/facebook/react/pull/22445)) //<Joseph Savona>//
- **[d3e086932](https://github.com/facebook/react/commit/d3e086932 )**: Make root.unmount() synchronous  ([#22444](https://github.com/facebook/react/pull/22444)) //<Andrew Clark>//
- **[2cc6d79c9](https://github.com/facebook/react/commit/2cc6d79c9 )**: Rename onReadyToStream to onCompleteShell ([#22443](https://github.com/facebook/react/pull/22443)) //<Sebastian Markbåge>//
- **[c88fb49d3](https://github.com/facebook/react/commit/c88fb49d3 )**: Improve DEV errors if string coercion throws (Temporal.*, Symbol, etc.) ([#22064](https://github.com/facebook/react/pull/22064)) //<Justin Grant>//
- **[05726d72c](https://github.com/facebook/react/commit/05726d72c )**: [Fix] Errors should not "unsuspend" a transition ([#22423](https://github.com/facebook/react/pull/22423)) //<Andrew Clark>//
- **[3746eaf98](https://github.com/facebook/react/commit/3746eaf98 )**: Packages/React/src/ReactLazy ---> changing -1 to unintialized ([#22421](https://github.com/facebook/react/pull/22421)) //<BIKI DAS>//
- **[04ccc01d9](https://github.com/facebook/react/commit/04ccc01d9 )**: Hydration errors should force a client render ([#22416](https://github.com/facebook/react/pull/22416)) //<Andrew Clark>//
- **[029fdcebb](https://github.com/facebook/react/commit/029fdcebb )**: root.hydrate -> root.isDehydrated ([#22420](https://github.com/facebook/react/pull/22420)) //<Andrew Clark>//
- **[af87f5a83](https://github.com/facebook/react/commit/af87f5a83 )**: Scheduling Profiler marks should include thrown Errors ([#22417](https://github.com/facebook/react/pull/22417)) //<Brian Vaughn>//
- **[d47339ea3](https://github.com/facebook/react/commit/d47339ea3 )**: [Fizz] Remove assignID mechanism ([#22410](https://github.com/facebook/react/pull/22410)) //<Sebastian Markbåge>//
- **[3a50d9557](https://github.com/facebook/react/commit/3a50d9557 )**: Never attach ping listeners in legacy Suspense ([#22407](https://github.com/facebook/react/pull/22407)) //<Andrew Clark>//
- **[82c8fa90b](https://github.com/facebook/react/commit/82c8fa90b )**: Add back useMutableSource temporarily ([#22396](https://github.com/facebook/react/pull/22396)) //<Andrew Clark>//
- **[5b57bc6e3](https://github.com/facebook/react/commit/5b57bc6e3 )**: [Draft] don't patch console during first render ([#22308](https://github.com/facebook/react/pull/22308)) //<Luna Ruan>//
- **[cf07c3df1](https://github.com/facebook/react/commit/cf07c3df1 )**: Delete all but one `build2` reference ([#22391](https://github.com/facebook/react/pull/22391)) //<Andrew Clark>//
- **[bb0d06935](https://github.com/facebook/react/commit/bb0d06935 )**: [build2 -> build] Local scripts //<Andrew Clark>//
- **[0c81d347b](https://github.com/facebook/react/commit/0c81d347b )**: Write artifacts to `build` instead of `build2` //<Andrew Clark>//
- **[4da03c9fb](https://github.com/facebook/react/commit/4da03c9fb )**: useSyncExternalStore React Native version ([#22367](https://github.com/facebook/react/pull/22367)) //<salazarm>//
- **[48d475c9e](https://github.com/facebook/react/commit/48d475c9e )**: correct typos ([#22294](https://github.com/facebook/react/pull/22294)) //<Bowen>//
- **[cb6c619c0](https://github.com/facebook/react/commit/cb6c619c0 )**: Remove Fiber fields that were used for hydrating useMutableSource ([#22368](https://github.com/facebook/react/pull/22368)) //<Sebastian Silbermann>//
- **[64e70f82e](https://github.com/facebook/react/commit/64e70f82e )**: [Fizz] add avoidThisFallback support ([#22318](https://github.com/facebook/react/pull/22318)) //<salazarm>//
- **[3ee7a004e](https://github.com/facebook/react/commit/3ee7a004e )**: devtools: Display actual ReactDOM API name in root type ([#22363](https://github.com/facebook/react/pull/22363)) //<Sebastian Silbermann>//
- **[79b8fc667](https://github.com/facebook/react/commit/79b8fc667 )**: Implement getServerSnapshot in userspace shim ([#22359](https://github.com/facebook/react/pull/22359)) //<Andrew Clark>//
- **[86b3e2461](https://github.com/facebook/react/commit/86b3e2461 )**: Implement useSyncExternalStore on server ([#22347](https://github.com/facebook/react/pull/22347)) //<Andrew Clark>//
- **[8209de269](https://github.com/facebook/react/commit/8209de269 )**: Delete useMutableSource implementation ([#22292](https://github.com/facebook/react/pull/22292)) //<Andrew Clark>//

Changelog:
[General][Changed] - React Native sync for revisions e8feb11...afcb9cd

jest_e2e[run_all_tests]

Reviewed By: yungsters

Differential Revision: D31541359

fbshipit-source-id: c35941bc303fdf55cb061e9996200dc868a6f2af
2021-10-12 08:32:48 -07:00
Aditya Wasan 79db483568 Add `ACCESS_MEDIA_LOCATION` permission (#32282)
Summary:
This PR adds `ACCESS_MEDIA_LOCATION` permission to the PermissionsAndroid library. It fixes https://github.com/facebook/react-native/issues/31953.

It's a `dangerous` permission added in API level 29.

https://developer.android.com/reference/android/Manifest.permission#ACCESS_MEDIA_LOCATION

## Changelog

<!-- Help reviewers and the release process by writing your own changelog entry. For an example, see:
https://github.com/facebook/react-native/wiki/Changelog
-->

[Android] [Added] - Add ACCESS_MEDIA_LOCATION permission to PermisionsAndroid library.

Pull Request resolved: https://github.com/facebook/react-native/pull/32282

Test Plan:
```
PermissionsAndroid.ACCESS_MEDIA_LOCATION === 'android.permission.ACCESS_MEDIA_LOCATION'
```

Reviewed By: yungsters

Differential Revision: D31235523

Pulled By: cortinico

fbshipit-source-id: 45fa86b1cdf8bc76453e9df6198c1f7ed923db7c
2021-10-12 04:00:25 -07:00
Oleksandr Melnykov f788aab45b Back out "Make runtime initialization from React renderers a no-op"
Summary: Changelog: [Internal]

Reviewed By: yungsters

Differential Revision: D31552508

fbshipit-source-id: 1821f97393e3b9c40bd484a0831eb8fbdfc4bb82
2021-10-11 15:51:54 -07:00
Lulu Wu c901c43d11 Remove shared responsibility between LogBox and ExceptionsManager native module
Summary:
## Context
Right now we are using both LogBox and ExceptionsManager native module to report JS errors in ExceptionsManager.js, from below code we can tell they have some overlapping - when ```__DEV__ === true``` both could report the error.

https://www.internalfb.com/code/fbsource/[5fb44bc926de87e62e6e538082496f22017698eb]/xplat/js/react-native-github/Libraries/Core/ExceptionsManager.js?lines=109-141

## Changes
In this diff overlapping is removed: in ```ExceptionsManager.js``` LogBox will be responsible for showing the error with dialog when ```__DEV__ === true```, when it's prod we'll use ExceptionsManager native module to report the error. As a result LogBox and ExceptionsManager native module don't share responsibilities any more.

Changelog:
[General][Changed] - Remove shared responsibility between LogBox and ExceptionsManager native module

Reviewed By: philIip

Differential Revision: D30942433

fbshipit-source-id: 8fceaaa431e5a460c0ccd151fe9831dcccbcf237
2021-10-08 11:08:43 -07:00
Rubén Norte b14b34b232 Make runtime initialization from React renderers a no-op
Summary:
This module is imported by all flavors of the React Native renderers (dev/prod, Fabric/Paper, etc.), which itself imports `InitializeCore`. This is effectively a no-op in most React Native apps because Metro adds it as a module to execute before the entrypoint of the bundle.

This import would be harmless if all React Native apps included all polyfills and globals, but some of them don't want to include everything and instead of importing `InitializeCore` they import individual setup functions (like `setupXhr`). Having this automatic import in the renderer defeats that purpose (most importantly for app size), so we should remove it.

The main motivation for this change is to increase the number (and spec-compliance) of Web APIs that are supported out of the box without adding that cost to apps that choose not to use some of them (see https://github.com/facebook/react-native/pull/30188#issuecomment-929352747).

Changelog: [General][Removed] Breaking: Removed initialization of React Native polyfills and global variables from React renderers.

Note: this will only be a breaking change for apps not using the React Native CLI, Expo nor have a Metro configuration that executes `InitializeCore` automatically before the bundle EntryPoint.

Reviewed By: yungsters

Differential Revision: D31472153

fbshipit-source-id: 92eb113c83f77dbe414869fbce152a22f3617dcb
2021-10-08 07:39:11 -07:00
Rubén Norte a101fc768c Remove unnecessary global variable named GLOBAL
Summary:
We are defining an alias for the global variable in React Native called `GLOBAL`, which is not used at all at Facebook and it doesn't seem it's used externally either. This alias is not standard nor common in the JS ecosystem, so we can just remove it to reduce the pollution of the global scope.

Changelog: [General][Removed] - Removed unnecessary global variable `GLOBAL`.

Reviewed By: yungsters

Differential Revision: D31472154

fbshipit-source-id: 127c3264848b638f85fb2e39e17ed2006372d2dd
2021-10-08 07:39:11 -07:00
AntoineDoubovetzky ec614c16b3 Update Modal's mock to not render its children when it is not visible (#32346)
Summary:
The Modal's mock always render its children (whether it is visible or not), whereas in reality the Modal renders `null` when the Modal is not visible.
This causes troubles when trying to test whether the Modal is visible or not. Instead of testing if the children are rendered (using getByText from React Native Testing Library for instance), we are forced to test the value of the visible prop directly (see https://github.com/callstack/react-native-testing-library/issues/508 and https://github.com/callstack/react-native-testing-library/issues/659).
This is not ideal because we are forced to test implementation detail and can't test from the user perspective. I also believe the mock should be closest as possible from reality.

I had 2 options:
  1. Rendering the Modal without its children
  2. Not rendering the Modal at all

The latter has the advantage of being closer to the reality, but I chose the former to still be able to test the Modal through the visible prop, so there is no breaking change (only snapshots update will be required).

## Changelog

[General] [Changed] - Update Modal's mock to not render its children when it is not visible

Pull Request resolved: https://github.com/facebook/react-native/pull/32346

Test Plan:
I added a test case when visible is false, then updated the mock so the children are not rendered. The before / after is here:
![image](https://user-images.githubusercontent.com/17070498/136256142-a351d002-8b77-490a-ba65-1e8ad0d6eb55.png)

Reviewed By: yungsters

Differential Revision: D31445964

Pulled By: lunaleaps

fbshipit-source-id: 08501921455728cde6befd0103016c95074cc1df
2021-10-07 22:44:19 -07:00
Wes Johnson e612d3a116 fix(logging): avoid logging sensitive param values (#31522)
Summary:
We noticed that by default when the RootView / ReactView calls runApplication, we're logging at an info level any props ("params") passed to that component. In our case, one of these props was sensitive in nature, causing the value to leak out in logs for our release builds. This is especially problematic on Android where device logs can be accessed by any app which requests that permission.

This is probably more of a concern for brownfield react-native apps, but it seems worthwhile locking this down in non-dev builds.

## Changelog

<!-- Help reviewers and the release process by writing your own changelog entry. For an example, see:
https://github.com/facebook/react-native/wiki/Changelog
-->

[General] [Security] - Avoiding logging root view params outside of dev / debug mode builds

Pull Request resolved: https://github.com/facebook/react-native/pull/31522

Test Plan: * build app in release mode on Android and verified I could not see: `Running "my app" with { sensitive: 'thing' }` in logcat in Android Studio with a tethered device

Reviewed By: yungsters

Differential Revision: D31064902

Pulled By: charlesbdudley

fbshipit-source-id: 8b10a46d92a9ec44243dd74384299087260c7d83
2021-10-07 12:06:43 -07:00
Gijs Weterings 7bbf549ae5 fix viewconfig for AndroidHorizontalScrollViewNativeComponent
Summary: Changelog:  [Android][Fix] Fix viewconfig for AndroidHorizontalScrollViewNativeComponent by adding snapToAlignment

Reviewed By: mdvacca

Differential Revision: D31476885

fbshipit-source-id: 89a4e16bd3d2cac0cc3c70c8a948deadababd488
2021-10-07 11:21:56 -07:00
Xiankun Cheng 22801870f0 Fix: multiline textinput start "jerking" when trying to move cursor. (#32179)
Summary:
Fixes https://github.com/facebook/react-native/issues/30748: on iOS 14, when trying to hold down the space bar and move the cursor on a multi-line TextInput with lots of lines, the cursor could not be scrolled to the desired point. It works as expected on iOS 13 and before.

Figured out that iOS14 acting as expected without `[setContentOffset:animated:]`, so exclude it when iOS version is and above 14.

Credit to efstathiosntonas for the finding and solution provides.

## Related issue
- https://github.com/facebook/react-native/issues/30748

## Changelog

<!-- Help reviewers and the release process by writing your own changelog entry. For an example, see:
https://github.com/facebook/react-native/wiki/Changelog
-->

[iOS] [Fixed] - Fixed the issue when moving cursor in multi-line TextInput.

Pull Request resolved: https://github.com/facebook/react-native/pull/32179

Test Plan:
1. Launch RNTester app on iOS
2. Open `TextInput` in tab `Components`
3. Scroll to `Multiline` section and focus on the first child
4. Input lots of dummy texts
5. Hold the space bar (on device) or press down the mouse inside `TextInput` (simulator without showing keyboard)

### **Video Before:**
https://user-images.githubusercontent.com/6382178/132800651-fb7cd2ac-fbd1-4ec4-9e3b-c06ab5b6a114.MP4

### **Video After:**
https://user-images.githubusercontent.com/6382178/132800677-f349fe7f-5902-40ff-8b93-ecc96ce29166.MP4

Reviewed By: philIip

Differential Revision: D31404248

Pulled By: lunaleaps

fbshipit-source-id: 74a39106e628602c5177fc243783288fcb7782fa
2021-10-06 12:43:36 -07:00
Gustavo Sverzut Barbieri 57aa70c06c Introduce Gemfile, ruby-version (#32303)
Summary:
Implement par of the discussion https://github.com/react-native-community/discussions-and-proposals/discussions/411, except the `.nvmrc` part, this includes:
 - Setting `.ruby-version` in the main project and also `template/`
 - Fixing the CocoaPods version with a project-level `Gemfile` and also `template/Gemfile`
 - Using all `pod` executions from `bundle exec pod`, using the determined version
 - Script to manage and update the ruby version

## Changelog

[iOS] [Added] - Gemfile with CocoaPods 1.11 and ruby-version (2.7.4)

Pull Request resolved: https://github.com/facebook/react-native/pull/32303

Test Plan: Build for iOS and run all CircleCI tests to see if nothing changed

Reviewed By: RSNara

Differential Revision: D31344686

Pulled By: fkgozali

fbshipit-source-id: 25c63131ca9b16d3cf6341019548e0d63bdcaefe
2021-10-01 21:22:26 -07:00
Joshua Gross bf1a5ca8f1 Emit all touch events to PerformanceEventEmitter
Summary:
Pressability previously was filtering which events get forwarded through the PerformanceEventEmitter, but this causes issues for native telemetry systems which won't know which events Pressability has skipped (or why).

Also, the "delay ms" no longer has any meaning because the native timestamps and Date.now() have a different time-basis entirely.

Changelog: [Internal]

Differential Revision: D31251300

fbshipit-source-id: f097047ac150e8dddb0f3857d9f375bae2318681
2021-09-30 13:11:36 -07:00
Tim Yung 4fdbc44ab5 RN: Disable `collapsable` for Animated Components
Summary:
When we were iterating on the Fabric renderer, animated components went through some iteration to ensure that animated shadow nodes were not flattened away. At the time, `collapsable` was not supported on iOS, even in Fabric, because the legacy renderer would not publish the `collapsable` prop on the view config.

This has since been fixed and `collapsable` is supported on both Android and iOS. We no longer need the `nativeID` workaround to prevent view flattening.

For use cases of the JavaScript driver and legacy renderers, this change will cause views which used to be flattened to no longer be flattened. This seems like an appropriate change considering the direction that we are moving (in which everything is eventually transitioned to using the Fabric renderer).

Changelog:
[Android][Changed] - Native views backing Animated.View (w/ JavaScript-driven animations) will no longer be flattened; this should be a transparent change.

Reviewed By: lunaleaps, mdvacca

Differential Revision: D31223031

fbshipit-source-id: 48dc63471eef406f4c215bfea0b3ef82a05d4b24
2021-09-29 17:22:21 -07:00
Cristiano Coelho 900210cacc Fix Image defaultSource not showing on iOS (#32172)
Summary:
Fix Image defaultSource not showing on iOS.

This bug was introduced somewhere between RN 0.63 and 0.65. On iOS, defaultSource does not show while the image is being downloaded, only if it fails or there's no internet.

## Changelog

<!-- Help reviewers and the release process by writing your own changelog entry. For an example, see:
https://github.com/facebook/react-native/wiki/Changelog
-->

[iOS] [Fixed] - Fix Image defaultSource not showing on iOS

Pull Request resolved: https://github.com/facebook/react-native/pull/32172

Test Plan: Ran both debug and release builds on an iPhone 12 pro (iOS 14.6)

Reviewed By: sammy-SC

Differential Revision: D30822805

Pulled By: lunaleaps

fbshipit-source-id: c4ef18723a8311ef3be1d7ae25ff3c205e8fff62
2021-09-29 01:56:56 -07:00
David Vacca a54cfb9e57 Add snapToAlignment to ScrollView.js Android implementation
Summary:
Update ScrollView.js to support snapToAlignment in RN Android

changelog: [Android][Added] Implement snapToAlignment in ReactHorizontalScrollView

Reviewed By: JoshuaGross

Differential Revision: D31174546

fbshipit-source-id: 480e990793ced74121c6aa1875f2695a70d1f804
2021-09-29 01:47:44 -07:00
Adnan Irfan f2eecae63d Fix typo (#31295)
Summary:
Fixed typo in Share component docs

## Changelog

<!-- Help reviewers and the release process by writing your own changelog entry. For an example, see:
https://github.com/facebook/react-native/wiki/Changelog
-->

[Internal] [Fixed] - Fix typo in Share component docs

Pull Request resolved: https://github.com/facebook/react-native/pull/31295

Test Plan: N/A

Reviewed By: yungsters

Differential Revision: D31152173

Pulled By: charlesbdudley

fbshipit-source-id: 831252f24876986fd053ff5e9875fef1132fa957
2021-09-28 14:50:41 -07:00
Sota Ogo 8595f3f22c Back out "Feature: ScrollView `automaticallyAdjustKeyboardInsets`"
Summary:
Original commit changeset: 9ccfb4b6d477 / D30015799 (6e903b07fa)

The diff caused a redbox/error in some products. Reverting now and will try it again.

Changelog: Backing out PR: 31402

Differential Revision: D31238961

fbshipit-source-id: b2ccd3d3ab9d7e764e41fb54d8a7e60882d1405f
2021-09-28 14:05:00 -07:00
Marc Rousavy 6e903b07fa Feature: ScrollView `automaticallyAdjustKeyboardInsets` (#31402)
Summary:
Currently, ScrollViews provide the prop `keyboardDismissMode` which lets you choose `"interactive"`. However when the keyboard is shown, it will be rendered above the ScrollView, potentially blocking content.

With the `automaticallyAdjustKeyboardInsets` prop the ScrollView will automatically adjust it's `contentInset`, `scrollIndicatorInsets` and `contentOffset` (scroll Y) props to push the content up so nothing gets blocked.

* The animation curve and duration of the Keyboard is exactly matched.
* The absolute position of the ScrollView is respected, so if the Keyboard only overlaps 10 pixels of the ScrollView, it will only get inset by 10 pixels.
* By respecting the absolute position on screen, this automatically makes it fully compatible with phones with notches (custom safe areas)
* By using the keyboard frame, this also works for different sized keyboards and even `<InputAccessoryView>`s
* This also supports `maintainVisibleContentPosition` and `autoscrollToTopThreshold`.
* I also fixed an issue with the `maintainVisibleContentPosition` (`autoscrollToTopThreshold`) prop(s), so they behave more reliably when `contentInset`s are applied. (This makes automatically scrolling to new items fully compatible with `automaticallyAdjustKeyboardInsets`)

## Changelog

* [iOS] [Added] - ScrollView: `automaticallyAdjustKeyboardInsets` prop: Automatically animate `contentInset`, `scrollIndicatorInsets` and `contentOffset` (scroll Y) to avoid the Keyboard. (respecting absolute position on screen and safe-areas)
* [iOS] [Fixed] - ScrollView: Respect `contentInset` when animating new items with `autoscrollToTopThreshold`, make `automaticallyAdjustKeyboardInsets` work with `autoscrollToTopThreshold` (includes vertical, vertical-inverted, horizontal and horizontal-inverted ScrollViews)

Pull Request resolved: https://github.com/facebook/react-native/pull/31402

Test Plan:
<table>
<tr>
<th>Before</th>
<th>After</th>
</tr>
<tr>
<td>

https://user-images.githubusercontent.com/15199031/115708680-9700aa80-a370-11eb-8016-e75d81a92cd7.MP4

</td>

<td>

https://user-images.githubusercontent.com/15199031/115708699-9b2cc800-a370-11eb-976f-c4010cd96d55.MP4

</td>
</table>

### "Why not just use `<KeyboardAvoidingView>`?"

<table>
<tr>
<th>Before (with <code>&lt;KeyboardAvoidingView&gt;</code>)</th>
<th>After (with <code>automaticallyAdjustKeyboardInsets</code>)</th>
</tr>
<tr>
<td>

https://user-images.githubusercontent.com/15199031/115708749-abdd3e00-a370-11eb-8e09-a27ffaef12b8.MP4

</td>

<td>

https://user-images.githubusercontent.com/15199031/115708777-b3044c00-a370-11eb-9b7a-e040ccb3ef8c.MP4

</td>
</table>

> Also notice how the `<KeyboardAvoidingView>` does not match the animation curve of the Keyboard

### Usage

```jsx
export const ChatPage = ({
  flatListProps,
  textInputProps
}: Props): React.ReactElement => (
  <>
    <FlatList
      {...flatListProps}
      keyboardDismissMode="interactive"
      automaticallyAdjustContentInsets={false}
      contentInsetAdjustmentBehavior="never"
      maintainVisibleContentPosition={{ minIndexForVisible: 0, autoscrollToTopThreshold: 100 }}
      automaticallyAdjustKeyboardInsets={true}
    />
    <InputAccessoryView backgroundColor={colors.white}>
      <ChatInput {...textInputProps} />
    </InputAccessoryView>
  </>
);
```

## Related Issues

* Fixes https://github.com/facebook/react-native/issues/31394
* Fixes https://github.com/facebook/react-native/issues/13073

Reviewed By: yungsters

Differential Revision: D30015799

Pulled By: sota000

fbshipit-source-id: 9ccfb4b6d477da192a96db4cfa07c31a2d2cefcb
2021-09-24 18:46:00 -07:00
Jesse Katsumata dbd5c3d8e5 chore: add ImageBackgroundPropType (#32099)
Summary:
Added FlowType definition for ImageBackground component Props

## Changelog

[General] [Changed] - Add ImageBackground component type definition
[General] [Fixed] - ImageBackground now respects `imageStyle` width and height

Pull Request resolved: https://github.com/facebook/react-native/pull/32099

Test Plan:
- [ ] flow check passes
- [ ] rn-tester app runs

Reviewed By: charlesbdudley

Differential Revision: D30597737

Pulled By: yungsters

fbshipit-source-id: 9699ee2bb727a1a8f30d6ffe3a2845c8a134e89d
2021-09-22 20:20:57 -07:00
Muhammad Numan 01856633a1 feat: add cancelButtonTintColor props in ActionSheetIOS for change cancel button tint color (#31972)
Summary:
we need to change the text color of the cancel button in `ActionSheetIOS` but `tintColor` changes the all button text color except `destructiveButtonIndex`

so I have added `cancelButtonTintColor` prop to change only the text color of the cancel button

## Changelog

<!-- Help reviewers and the release process by writing your own changelog entry. For an example, see:
https://github.com/facebook/react-native/wiki/Changelog
-->

[General] [Changed] - added `cancelButtonTintColor` prop for `ActionSheetIOS` to change only the text color of the cancel button

Pull Request resolved: https://github.com/facebook/react-native/pull/31972

Test Plan:
With this PR you can change the cancel text button of `ActionSheetIOS` by this `cancelButtonTintColor` prop

| <img src="https://user-images.githubusercontent.com/36044436/128414537-c4454786-a5cf-49d2-8225-1ff26c9c5058.png"  /> | <img src="https://user-images.githubusercontent.com/36044436/128414549-74a21509-711e-48e0-baf1-3718beae1598.png"  /> | <img src="https://user-images.githubusercontent.com/36044436/128414559-4bee9d1a-ac9f-4cd2-b158-5c4c441158ec.png"  /> |
|-|-|-|

Reviewed By: lunaleaps

Differential Revision: D30878022

Pulled By: yungsters

fbshipit-source-id: c70204f9f2510c75d8e9bed4e0fba79f1c941a1f
2021-09-22 10:44:17 -07:00
Ken Tominaga 398595e074 Remove iOS 11 version check (#32151)
Summary:
This pull request aims to remove iOS 11 version check which is no longer needed.

The minimum iOS deployment target for React Native is `iOS 11` but we still have iOS 11 version check like below.

```
#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 110000 /* __IPHONE_11_0 */
        if (available(iOS 11.0, *)) {
```

> React Native apps may target iOS 11.0 and Android 5.0 (API 21) or newer.

ref: https://github.com/facebook/react-native#-requirements

------

If there is a team motivation to remove the deprecated methods and classes before iOS 10, I can continue the work in this pull request or in the continuing pull requests.

We have deprecated warnings for these in the project.

- `UIUserNotificationSettings`
- `UILocalNotification`
- `topLayoutGuide` and `bottomLayoutGuide`
- `automaticallyAdjustsScrollViewInsets`

## Changelog

[iOS] [Changed] - Remove iOS 11 version check

Pull Request resolved: https://github.com/facebook/react-native/pull/32151

Reviewed By: sammy-SC

Differential Revision: D30877917

Pulled By: yungsters

fbshipit-source-id: d903ea5d557beeb65ef87bfce572e4db3532b3c5
2021-09-22 10:37:09 -07:00
Kacie Bawiec 88021894f2 React Native sync for revisions 95d762e...e8feb11
Summary:
This sync includes the following changes:
- **[f4ac680c7](https://github.com/facebook/react/commit/f4ac680c7 )**: Fixed broken build script --unsafe-partial flag ([#22324](https://github.com/facebook/react/pull/22324)) //<Brian Vaughn>//
- **[67222f044](https://github.com/facebook/react/commit/67222f044 )**: [Experiment] Warn if callback ref returns a function ([#22313](https://github.com/facebook/react/pull/22313)) //<Dan Abramov>//
- **[263cfa6ec](https://github.com/facebook/react/commit/263cfa6ec )**: [Experimental] Add useInsertionEffect ([#21913](https://github.com/facebook/react/pull/21913)) //<Ricky>//
- **[806aaa2e2](https://github.com/facebook/react/commit/806aaa2e2 )**: [useSES shim] Import prefixed native API ([#22310](https://github.com/facebook/react/pull/22310)) //<Andrew Clark>//
- **[fd5e01c2e](https://github.com/facebook/react/commit/fd5e01c2e )**: [useSES/extra] Reuse old selection if possible ([#22307](https://github.com/facebook/react/pull/22307)) //<Andrew Clark>//
- **[33226fada](https://github.com/facebook/react/commit/33226fada )**: Check for store mutations before commit ([#22290](https://github.com/facebook/react/pull/22290)) //<Andrew Clark>//
- **[86c7ca70a](https://github.com/facebook/react/commit/86c7ca70a )**: Fix link ([#22296](https://github.com/facebook/react/pull/22296)) //<Konstantin Popov>//
- **[0fd195f29](https://github.com/facebook/react/commit/0fd195f29 )**: update error message to include useLayoutEffect or useEffect on bad e… ([#22279](https://github.com/facebook/react/pull/22279)) //<salazarm>//
- **[8f96c6b2a](https://github.com/facebook/react/commit/8f96c6b2a )**: [Bugfix] Prevent infinite update loop caused by a synchronous update in a passive effect ([#22277](https://github.com/facebook/react/pull/22277)) //<Andrew Clark>//
- **[4ce89a58d](https://github.com/facebook/react/commit/4ce89a58d )**: Test bad useEffect return value with noop-renderer ([#22258](https://github.com/facebook/react/pull/22258)) //<Sebastian Silbermann>//
- **[a3fde2358](https://github.com/facebook/react/commit/a3fde2358 )**: Detect subscriptions wrapped in startTransition ([#22271](https://github.com/facebook/react/pull/22271)) //<salazarm>//

Changelog:
[General][Changed] - React Native sync for revisions 95d762e...e8feb11

jest_e2e[run_all_tests]

Reviewed By: rickhanlonii

Differential Revision: D30966369

fbshipit-source-id: 6c88e591005deb1fd93493628ef4695add49186c
2021-09-22 10:10:44 -07:00
Luis Miguel Alvarado 64aa1e5ffe chore: removed unused files (#31465)
Summary:
All these files are unused

## Changelog

[JavaScript] [Removed] - chore: removed unused files

Pull Request resolved: https://github.com/facebook/react-native/pull/31465

Test Plan: CI is passing

Reviewed By: yungsters

Differential Revision: D30653225

Pulled By: charlesbdudley

fbshipit-source-id: 30c646f10be382c4898a8e362176acc382eb9090
2021-09-20 02:23:26 -07:00
Jimmy Zhang be5372801a Pass accessibilityHint through Button component
Summary:
Changelog: [Internal]

Previously, the `accessibilityHint` value isn't passed through the underlying component so that the voice over system doesn't announce it. This diff fixes that.

Reviewed By: sammy-SC

Differential Revision: D31017275

fbshipit-source-id: 1bf5a5e36fdfed2a199986b82684a40e18325ba1
2021-09-17 17:23:22 -07:00
Kevin Gozali b0c8a4eee8 Link RCT-Folly against libc++abi
Summary:
Folly now depends on libc++abi. This solves linker error for RCT-Folly.podspec like this:

```
Undefined symbols for architecture arm64:
  "___cxa_increment_exception_refcount", referenced from:
      folly::exception_ptr_get_type(std::exception_ptr const&) in libRCT-Folly.a(Exception.o)
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
```

See https://github.com/react-native-community/releases/issues/251

Note: RNTester was not affected by this bug for some reason, so the only way to verify is via the new app generated via `npx react-native init`.

Changelog: [Fixed][iOS] Unbreak Folly linker error

Reviewed By: lunaleaps

Differential Revision: D30950944

fbshipit-source-id: 3eb146e23faa308a02363761d08849d6801e21ca
2021-09-16 22:24:10 -07:00
Rick Hanlon 7f7f8188f2 React Native sync for revisions bd5bf55...95d762e
Summary:
This sync includes the following changes:
- **[95d762e40](https://github.com/facebook/react/commit/95d762e40 )**: Remove duplicate test //<Andrew Clark>//
- **[d4d1dc085](https://github.com/facebook/react/commit/d4d1dc085 )**: Reorder VARIANT feature flags ([#22266](https://github.com/facebook/react/pull/22266)) //<Dan Abramov>//
- **[2f156eafb](https://github.com/facebook/react/commit/2f156eafb )**: Adjust consoleManagedByDevToolsDuringStrictMode feature flag ([#22253](https://github.com/facebook/react/pull/22253)) //<Dan Abramov>//
- **[cfd819332](https://github.com/facebook/react/commit/cfd819332 )**: Add useSyncExternalStore to react-debug-tools ([#22240](https://github.com/facebook/react/pull/22240)) //<Andrew Clark>//
- **[8e80592a3](https://github.com/facebook/react/commit/8e80592a3 )**: Remove state queue from useSyncExternalStore ([#22265](https://github.com/facebook/react/pull/22265)) //<Andrew Clark>//
- **[06f98c168](https://github.com/facebook/react/commit/06f98c168 )**: Implement useSyncExternalStore in Fiber ([#22239](https://github.com/facebook/react/pull/22239)) //<Andrew Clark>//
- **[77912d9a0](https://github.com/facebook/react/commit/77912d9a0 )**: Wire up the native API for useSyncExternalStore ([#22237](https://github.com/facebook/react/pull/22237)) //<Andrew Clark>//
- **[031abd24b](https://github.com/facebook/react/commit/031abd24b )**: Add warning and test for useSyncExternalStore when getSnapshot isn't cached ([#22262](https://github.com/facebook/react/pull/22262)) //<salazarm>//
- **[b8884de24](https://github.com/facebook/react/commit/b8884de24 )**: break up import keyword to avoid being accidentally parsed as dynamic import statement in external code ([#21918](https://github.com/facebook/react/pull/21918)) //<Jianhua Zheng>//
- **[6d6bba5bf](https://github.com/facebook/react/commit/6d6bba5bf )**: Fix typo in ReactUpdatePriority-test.js ([#21958](https://github.com/facebook/react/pull/21958)) //<Ikko Ashimine>//
- **[0c0d1ddae](https://github.com/facebook/react/commit/0c0d1ddae )**: feat(eslint-plugin-react-hooks): support ESLint 8.x ([#22248](https://github.com/facebook/react/pull/22248)) //<Michaël De Boey>//
- **[1314299c7](https://github.com/facebook/react/commit/1314299c7 )**: Initial shim of useSyncExternalStore ([#22211](https://github.com/facebook/react/pull/22211)) //<Andrew Clark>//
- **[fc40f02ad](https://github.com/facebook/react/commit/fc40f02ad )**: Add consoleManagedByDevToolsDuringStrictMode feature flag in React Reconciler ([#22196](https://github.com/facebook/react/pull/22196)) //<Luna Ruan>//
- **[46a0f050a](https://github.com/facebook/react/commit/46a0f050a )**: Set up use-sync-external-store package ([#22202](https://github.com/facebook/react/pull/22202)) //<Andrew Clark>//
- **[8723e772b](https://github.com/facebook/react/commit/8723e772b )**: Fix a string interpolation typo in ReactHooks test ([#22174](https://github.com/facebook/react/pull/22174)) //<Matt Hargett>//
- **[60a30cf32](https://github.com/facebook/react/commit/60a30cf32 )**: Console Logging for StrictMode Double Rendering ([#22030](https://github.com/facebook/react/pull/22030)) //<Luna Ruan>//
- **[76bbad3e3](https://github.com/facebook/react/commit/76bbad3e3 )**: Add maxYieldMs feature flag in Scheduler ([#22165](https://github.com/facebook/react/pull/22165)) //<Ricky>//
- **[b0b53ae2c](https://github.com/facebook/react/commit/b0b53ae2c )**: Add feature flags for scheduler experiments ([#22105](https://github.com/facebook/react/pull/22105)) //<Ricky>//

Changelog:
[General][Changed] - React Native sync for revisions bd5bf55...95d762e

jest_e2e[run_all_tests]

Reviewed By: mdvacca

Differential Revision: D30809906

fbshipit-source-id: 131cfdf91e15f67fa59a5d925467e538ee89fe10
2021-09-10 17:28:55 -07:00
Tim Yung 504cbf1282 RN: Check `ReactSafeMobileConfig` Dependents for MobileConfig References
Summary:
Modifies `js1 build buckfiles` to also parse files that depend on `ReactSafeMobileConfig` for MobileConfig references.

That module was introduced in {D30470489}.

This fixes a bug where the MobileConfig reference in `ReactNativeInternalFeatureFlags` is not being correctly defined via Metro Buck.

Changelog:
[Internal]

Reviewed By: rickhanlonii

Differential Revision: D30815779

fbshipit-source-id: 156b0838fe47e7ab42c62258a1401875690813a6
2021-09-09 13:29:02 -07:00
Pieter De Baets 27dd2ecb70 Fix validation of AnimatedEvent with AnimatedValueXY
Summary: Changelog: [General][Fixed] Support Animated.ValueXY when validating Animated.event

Reviewed By: yungsters

Differential Revision: D30779011

fbshipit-source-id: 56f4d9eb6a20200584e5429a1693d0703f8c1a37
2021-09-09 04:31:58 -07:00
Ramanpreet Nara ddc4225dd4 Move NativeModule initialization logic outside of setModuleRegistry
Summary:
## Context
A while ago, we introduced a new initialization API in NativeModules via RCTInitializing.h (diff: D28435078 (9b45df1fce)).

## Problem
A number of our NativeModules still use setModuleRegistry to perform initialization.

## Changes
This diff migrates those NativeModules to instead use the initialize API.

## Motivation
In bridgeless mode each NativeModule object is [created and decorated by the RCTInstance](https://www.internalfb.com/code/fbsource/[89f6c0df78e453a20555975e06bc46b4e0d2bbe9]/fbobjc/Apps/Internal/Venice/Core/RCTInstance.mm?lines=180-189), while [holding the TurboModuleManagerDelegate mutex](https://www.internalfb.com/code/fbsource/[c50ce2bb3fb078d28e1f9afdef5e8793f1413472]/xplat/js/react-native-github/ReactCommon/react/nativemodule/core/platform/ios/RCTTurboModuleManager.mm?lines=429%2C431). After D30753286, setModuleRegistry will be called in RCTInstance getModuleInstanceForClass, which means that we'll start calling setModuleRegistry while holding the TurboModuleManagerDelegate lock. This leads to a deadlock, because calling setModuleRegistry on RCTDeviceInfo [creates RCTAccessibilityManager](https://www.internalfb.com/code/fbsource/[89f6c0df78e453a20555975e06bc46b4e0d2bbe9]/xplat/js/react-native-github/React/CoreModules/RCTDeviceInfo.mm?lines=50), which tries to acquire the TurboModuleManagerDelegate lock again. The NativeModule initialize method isn't called while holding the TurboModuleManagerDelegate lock. That's why moving all initialization logic to the initialize method mitigates this deadlock hazard.

In general, we shouldn't do any sort of initialization inside setters for these bridge/bridgeless APIs. No other NativeModules do initialization outside of initialize.

Changelog: [Internal]

Reviewed By: sammy-SC

Differential Revision: D30754870

fbshipit-source-id: 7c2d50f995cba6f58ee2dfebfabd36f640579bcb
2021-09-08 12:46:35 -07:00
Meghnath Pillay b998e32501 removed default props for drawerBackgroundColor and fixed lint issues (#32162)
Summary:
Removed the deaultProps in the DrawerLayoutAndroid file and replaced it with a default value in case props are undefined.
## Changelog
[General] [Changed] - Remove defaultProps from the DrawerLayoutAndroid Component.�lunaleaps this is the fix for issue https://github.com/facebook/react-native/issues/31606

Pull Request resolved: https://github.com/facebook/react-native/pull/32162

Test Plan: Ran test suite

Reviewed By: lunaleaps

Differential Revision: D30776242

Pulled By: cortinico

fbshipit-source-id: 51408acd92aecb8d725b0bbf39ddb059924481e5
2021-09-08 07:09:51 -07:00
wangqingyang a950634424 fix: compare the LogBoxData ignorePatterns with the right code (#31977)
Summary:
the `LogBoxData.addIgnorePatterns` function shows the wrong code to get a item in `Set`. because every item in `set.entries` looks like `[value, value]`, but not `value`.

while the `addIgnorePatterns` function evalutes two itertaions that is not necessary. So I refacted this function.

## Changelog

<!-- Help reviewers and the release process by writing your own changelog entry. For an example, see:
https://github.com/facebook/react-native/wiki/Changelog
-->

[General] [Fixed] - for LogBox checking existingPattern in a wrong way.
[General] [Changed] - addIgnorePatterns runs in one iteration.
[General] [Added] - add a function `getIgnorePatterns` in `LogBoxData.js` for tests or other usecases.

Pull Request resolved: https://github.com/facebook/react-native/pull/31977

Test Plan:
test codes in `LogBoxData-test.js`:
````js
it('adding same pattern multiple times', () => {
    expect(LogBoxData.getIgnorePatterns().length).toBe(0);
    LogBoxData.addIgnorePatterns(['abc']);
    expect(LogBoxData.getIgnorePatterns().length).toBe(1);
    LogBoxData.addIgnorePatterns([/abc/]);
    expect(LogBoxData.getIgnorePatterns().length).toBe(2);
    LogBoxData.addIgnorePatterns(['abc']);
    expect(LogBoxData.getIgnorePatterns().length).toBe(2);
    LogBoxData.addIgnorePatterns([/abc/]);
    expect(LogBoxData.getIgnorePatterns().length).toBe(2);
  });

  it('adding duplicated patterns', () => {
    expect(LogBoxData.getIgnorePatterns().length).toBe(0);
    LogBoxData.addIgnorePatterns(['abc', /ab/, /abc/, /abc/, 'abc']);
    expect(LogBoxData.getIgnorePatterns().length).toBe(3);
    LogBoxData.addIgnorePatterns([/ab/, /abc/]);
    expect(LogBoxData.getIgnorePatterns().length).toBe(3);
  });
````

and they have passed

Reviewed By: rickhanlonii

Differential Revision: D30675522

Pulled By: yungsters

fbshipit-source-id: 4a05e0f04a41d06cac416219f1e8e540bf0eea02
2021-09-07 12:00:19 -07:00
Janic Duplessis 7edf9274cf Fix keyboardDismissMode="on-drag" on Android (#31943)
Summary:
Fixes https://github.com/facebook/react-native/issues/23364

The current logic using `_isTouching` does not work because `_handleTouchCancel` is always called before scroll events begin. This means `_isTouching` is always false. To fix it I moved the logic to `_handleScrollBeginDrag` which is only called once when scroll drag beings. This accomplishes the expected behavior and is better than keeping it in onScroll where it would be called for each scroll event.

## Changelog

[Android] [Fixed] - Fix keyboardDismissMode="on-drag" on Android

Pull Request resolved: https://github.com/facebook/react-native/pull/31943

Test Plan: Tested in an app that on-drag does not work before and works after this patch.

Reviewed By: sshic

Differential Revision: D30674276

Pulled By: yungsters

fbshipit-source-id: aa0bd605809fa01518f70fbf323c06e32c76ed1d
2021-09-02 13:20:04 -07:00
Aaron (Li Bo) Tao 4384c32aad revert to class component of ScrollViewStickyHeader
Summary:
Changelog:
[Internal][Changed] - revert to class component of ScrollViewStickyHeader. There is a redbox error during unmount in the functional version

Reviewed By: lunaleaps

Differential Revision: D30705974

fbshipit-source-id: b564c522b0026db0b334cc834a80bbbe9cd261e2
2021-09-02 03:30:46 -07:00
Samuel Susla 569c1cdce9 Remove unused property _rootTag RCTPropsAnimatedNode
Summary:
changelog: [internal]

`_rootTag` is never assigned to and never read, let's remove it.

Reviewed By: RSNara

Differential Revision: D30667860

fbshipit-source-id: f4b89ebe6b6d26559188b0e19682f5ac765d40b6
2021-09-01 10:27:31 -07:00
Tim Yung 65e58f26e1 RN: @react-native/normalize-color support Node.js
Summary:
Changes `react-native/normalize-color` to be useable from Node.js by making the following changes:

1. Rename `base.js` to `index.js` so importing is more convenient.
2. Move Flow definitions into a seprate library definition flow so `index.js` can be consumed directly.

I also made a few improvements to the actual implementation:

1. Avoid allocating `matchers` for non-strings.
2. Avoid allocating an object of all the color keywords. This will reduce memory usage (in exchange for slightly larger compiled bytecode).

Changelog:
[General][Changed] - react-native/normalize-color now supports Node.js

Reviewed By: lunaleaps

Differential Revision: D30595908

fbshipit-source-id: e6279e9ff815d8d1f489811187deabfdf53b8fbf
2021-09-01 01:26:56 -07:00
Joshua Gross cbe0e6bf27 Pass nativeTimestamp into PressabilityPerformanceEvent
Summary:
Pass nativeTimestamp into PressabilityPerformanceEvent as a way to uniquely identify events.

Changelog: [Internal]

Differential Revision: D30648544

fbshipit-source-id: 7cb0146f6ff1655f1312e5094535e59268fb2a22
2021-08-30 20:03:28 -07:00
Andrew Coates 49b3b31d8e Native component check in deprecatedPropType was inverted (#31164)
Summary:
While investigating an issue hit on a recent sync of [react-native-windows](https://github.com/microsoft/react-native-windows) I noticed that e68cf7cee9 appears to have accidently inverted the logic to avoid checking native components.

`!UIManager.getViewManagerConfig(componentName)`
become
`UIManager.hasViewManagerConfig(componentName)`
losing the !

Also adding a check in PaperUIManager's getViewManagerConfig to avoid trying to call a sync method when using Chrome Debugging.

## Changelog

[Internal] [Fixed] - Restored the previous logic of deprecatedPropType

Pull Request resolved: https://github.com/facebook/react-native/pull/31164

Test Plan:
Change tested and being submitted in react-native-windows:
https://github.com/microsoft/react-native-windows/pull/7397

Reviewed By: hramos

Differential Revision: D30624302

Pulled By: fkgozali

fbshipit-source-id: 0f26e750283a1fa5eb5f44ecd2cf90617b6d931f
2021-08-30 18:03:27 -07:00
Genki Kondo a0d30b848a Remove unsupported values for android_hyphenationFrequency
Summary:
hyphenationStrategy must be one of one of Layout#HYPHENATION_FREQUENCY_NONE, Layout#HYPHENATION_FREQUENCY_NORMAL, Layout#HYPHENATION_FREQUENCY_FULL: (https://developer.android.com/reference/android/widget/TextView#setHyphenationFrequency(int))

Thus "high" and "balanced" are not only redundant, but actually don't do what the value indicates - Layout#BREAK_STRATEGY_BALANCED (constant value: 2) and Layout#BREAK_STRATEGY_HIGH_QUALITY (constant value: 1) are only meant to be used for android:breakStrategy

Changelog:
[Android][Changed] - Remove `"high"` and `"balanced"` as values for `android_hyphenationFrequency` on `Text`

Reviewed By: JoshuaGross

Differential Revision: D30531096

fbshipit-source-id: 1a0b6e733bb21ce6b2f104a2025a79c16de3cfea
2021-08-26 10:40:11 -07:00
Xuan Huang e60ad0837e Type more globals
Summary:
Changelog: [Internal]

This diff add types to some of the common globals so uses of
them through `global` are now typed.

All the globals are marked as read-only for their intented uses.
However, some of them do have write cites (mostly are in tests to
deliberately set up a special test environment). Those write cites
are considered as "necessary evil" and annotated as `FlowFixMe`.

Reviewed By: yungsters

Differential Revision: D30158145

fbshipit-source-id: 93a99063361a4b7a1e33d9fc97a661be30a4d8f9
2021-08-26 01:06:44 -07:00
Keion Anvaripour 8da6964d80 Refactor Image to log component stacktraces for images rendering non-fb sources
Summary:
This diff refactors the Image component in order to log the component hierarchy stacktraces for images rendering non-fb sources

Changelog: [Internal] internal

Reviewed By: fkgozali

Differential Revision: D30504483

fbshipit-source-id: 1e41a67d5b9643730360bce7e787ee3427d931e8
2021-08-25 16:41:50 -07:00
Andres Riveros Moya 7a770526c6 Remove DatePickerAndroid from react-native-github
Summary:
Changelog:
[JavaScript][Removed] - Remove DatePickerAndroid from React Native

Reviewed By: lunaleaps, yungsters

Differential Revision: D30281952

fbshipit-source-id: 5cd0ad2ad741afeef3e6f8a39635c6baf4b79b38
2021-08-25 13:38:25 -07:00
alessandro 2fb102b601 refactor: remove DefeaultProps from the DatePickerIOS component (#32064)
Summary:
Closes issue  https://github.com/facebook/react-native/issues/31605.
This is part of a bigger issue that plans to remove defaultProps from class components in order to provide a smoother transition to functional components.

## Changelog

[General] [Changed] - Remove defaultProps from the DatePickerIOS Component.
[General] [Test] - Added snapshot test for the new component

Pull Request resolved: https://github.com/facebook/react-native/pull/32064

Test Plan: Compiled the rn-tester folder to check if the behavior is consistent with the previous versions.

Reviewed By: lunaleaps

Differential Revision: D30492515

Pulled By: yungsters

fbshipit-source-id: ed2c5f3211742d528ff3f8e406a53cd7ea43d7e7
2021-08-25 13:09:36 -07:00
Connor Tumbleson 2bcc6fac38 feat: add Android 12 BLUETOOTH_ADVERTISE to PermissionsAndroid (#32079)
Summary:
This PR adds BLUETOOTH_ADVERTISE, which showed up in the latest Android 12 Beta build as new `dangerous` permissions requiring approval for them.

https://developer.android.com/reference/android/Manifest.permission.html#BLUETOOTH_ADVERTISE

You can see the new set of `SCAN/ADVERTISE/CONNECT` added in this doc - https://developer.android.com/about/versions/12/features/bluetooth-permissions, previously SCAN/CONNECT were added in: https://github.com/facebook/react-native/pull/31488

## Changelog

[Android] [Changed] - Add BLUETOOTH_ADVERTISE to PermissionsAndroid

Pull Request resolved: https://github.com/facebook/react-native/pull/32079

Test Plan:
```
PermissionsAndroid.BLUETOOTH_ADVERTISE === 'android.permission.BLUETOOTH_ADVERTISE'
```

Reviewed By: cortinico

Differential Revision: D30532656

Pulled By: yungsters

fbshipit-source-id: 986ad8cbfc27913df13ab24bba36f6e13104e7d9
2021-08-25 12:46:44 -07:00
Kacie Bawiec 7299cb485e React Native sync for revisions 424fe58...bd5bf55
Summary:
Post: https://fb.workplace.com/groups/rnsyncsquad/permalink/879923262900946/

This sync includes the following changes:
- **[fc3b6a411](https://github.com/facebook/react/commit/fc3b6a411 )**: Fix a few typos ([#22154](https://github.com/facebook/react/pull/22154)) //<Bowen>//
- **[986d0e61d](https://github.com/facebook/react/commit/986d0e61d )**: [Scheduler] Add tests for isInputPending ([#22140](https://github.com/facebook/react/pull/22140)) //<Andrew Clark>//
- **[d54be90be](https://github.com/facebook/react/commit/d54be90be )**: Set up test infra for dynamic Scheduler flags ([#22139](https://github.com/facebook/react/pull/22139)) //<Andrew Clark>//
- **[7ed0706d7](https://github.com/facebook/react/commit/7ed0706d7 )**: Remove the warning for setState on unmounted components ([#22114](https://github.com/facebook/react/pull/22114)) //<Dan Abramov>//
- **[9eb2aaaf8](https://github.com/facebook/react/commit/9eb2aaaf8 )**: Fixed ReactSharedInternals export in UMD bundle ([#22117](https://github.com/facebook/react/pull/22117)) //<Brian Vaughn>//
- **[bd255700d](https://github.com/facebook/react/commit/bd255700d )**: Show a soft error when a text string or number is supplied as a child to non text wrappers ([#22109](https://github.com/facebook/react/pull/22109)) //<Sota>//

Changelog:
[General][Changed] - React Native sync for revisions 424fe58...bd5bf55

jest_e2e[run_all_tests]

Reviewed By: yungsters

Differential Revision: D30485521

fbshipit-source-id: c5b92356e9e666eae94536ed31b8de43536419f8
2021-08-24 09:50:33 -07:00
Steven Bell ddf9a63acb fix typos in comments (#32061)
Summary:
Fixed some typos in the code comments.

## Changelog

[Internal] [Fixed] - Fixed typo in the comments

Pull Request resolved: https://github.com/facebook/react-native/pull/32061

Test Plan: N/A

Reviewed By: javache

Differential Revision: D30482511

Pulled By: cortinico

fbshipit-source-id: ff67bc00d57972df88e41ee7a933259673de3aa2
2021-08-24 07:21:56 -07:00
Jimmy Zhang 11f8d9c7cd Add support for the UIAccessibilityTraitsTabBar
Summary:
Changelog:
Add the capability to set tabbar accessibilityRole which maps to the iOS's UIAccessibilityTraitsTabBar

Reviewed By: yungsters

Differential Revision: D30490752

fbshipit-source-id: f7561a8932306e133d2f65a5ab40ba0be3899ec3
2021-08-24 02:31:17 -07:00
Xuan Huang ff4b33672a Add Flow libdefs for HermesInternalType
Summary:
Changelog: [Internal]

This diff add a flow libdefs for the `HermesInternalType` to type
`HermesInternal` as the first accurately typed `global` property,
and filled all the type holes.

Reviewed By: yungsters

Differential Revision: D29986749

fbshipit-source-id: a94be7919f989b5085f6b264e55145a85020fea9
2021-08-24 00:12:21 -07:00
edenb-moveo 6c080167e6 Update ImageBackground.js (#32055)
Summary:
Currently ImageBackGround component has optional style props, but if you don't pass it as prop, it still "thinks" you pass style and crushes.
In this pr, I made width and height inside component to be optional so it won't crush.

## Changelog

[General] [Fix] - Changed ImageBackground's style so it won't crush.

[Screen Shot 2021-08-20 at 15 05 45](https://user-images.githubusercontent.com/62840630/130230568-be02b1a2-52ec-4f9d-b3d3-212552d3882b.png)

As you can see in this component, I tried to use ImageBackground without any style props, and my app crushes. Then I added style with empty object and the app didn't crush anymore, as you can see here:
![Screen Shot 2021-08-20 at 15 09 23](https://user-images.githubusercontent.com/62840630/130230932-a576c397-a910-4e40-a202-56482d83dd9c.png).

In conclusion, if we make width and height styles optionals inside ImageBackground component, it won't crush anymore.

Thoughts:
Maybe consider to make style props for this component none-optional because it isn't make any sense that image won't have any style at all.

Thanks ahead, that was my first pr, Eden Binyamin.

Pull Request resolved: https://github.com/facebook/react-native/pull/32055

Reviewed By: charlesbdudley

Differential Revision: D30452297

Pulled By: sshic

fbshipit-source-id: b7071aa457dba443ed2f627c2458ea84fd24b36d
2021-08-20 23:37:18 -07:00
Jimmy Zhang f085e09be5 Passing the scheme field throughout all the metro connection pipeline to allow different scheme other than the default hardcoded http
Reviewed By: lunaleaps

Differential Revision: D30218490

fbshipit-source-id: 3832c731156a4f88ad1c55be0a0e4f68fa3e1d48
2021-08-19 10:28:49 -07:00
alessandro 5923ee50fc refactor: remove DefaultProps from the StatusBar Component (#31631)
Summary:
Issue https://github.com/facebook/react-native/issues/31607. defaultProps makes it difficult to migrate components to functional.

## Changelog

[General] [Changed] -  Remove defaultProps from the StatusBar Component.

Pull Request resolved: https://github.com/facebook/react-native/pull/31631

Test Plan:
Verified the behaviour of the existing functionality after the removal on the RN Tester app.

https://user-images.githubusercontent.com/11355609/120085709-a2b35f80-c0da-11eb-94f2-2649270155ef.mov

Reviewed By: sota000

Differential Revision: D30259324

Pulled By: lunaleaps

fbshipit-source-id: 0c8841691198761589fdd029cab36629f7dfa757
2021-08-18 01:23:04 -07:00
Rick Hanlon aad9f3553b React Native sync for revisions 19092ac...5634ed1
Summary:
This sync includes the following changes:
- **[424fe5870](https://github.com/facebook/react/commit/424fe5870 )**: Revert "Show a soft error when a text string or number is supplied as a child to non text wrappers ([#21953](https://github.com/facebook/react/pull/21953))" ([#22108](https://github.com/facebook/react/pull/22108)) //<Sota>//
- **[aebf3b456](https://github.com/facebook/react/commit/aebf3b456 )**: [Scheduler] Check for continuous input events ([#22107](https://github.com/facebook/react/pull/22107)) //<Andrew Clark>//
- **[e9b2028b3](https://github.com/facebook/react/commit/e9b2028b3 )**: Show a soft error when a text string or number is supplied as a child to non text wrappers ([#21953](https://github.com/facebook/react/pull/21953)) //<Sota>//
- **[ecd73e17b](https://github.com/facebook/react/commit/ecd73e17b )**: Enable enableSuspenseLayoutEffectSemantics flag statically for Facebook ([#22050](https://github.com/facebook/react/pull/22050)) //<Brian Vaughn>//
- **[a8725a3e6](https://github.com/facebook/react/commit/a8725a3e6 )**: Scheduling profiler: Added lane labels and durations to React measures ([#22029](https://github.com/facebook/react/pull/22029)) //<Brian Vaughn>//

Changelog:
[General][Changed] - React Native sync for revisions 19092ac...5634ed1

jest_e2e[run_all_tests]

Reviewed By: kacieb

Differential Revision: D30225923

fbshipit-source-id: 562895d3e0d264f40770dadb89d4a16241967c4c
2021-08-16 20:35:28 -07:00
fabriziobertoglio1987 3560753559 Fix TextInput Cursor jumping to the right when the placeholder null (#28995)
Summary:
This issue fixes https://github.com/facebook/react-native/issues/28794 fixes https://github.com/facebook/react-native/issues/27658
Flow type ?Stringish allows to set the placeholder value to null. The null value causes the cursor to jump to the right in a TextInput. The fix replaces the placeholder null value with an empty string which avoid calling setHint(null) as causes the placeholder to jump to the right.

## Changelog

<!-- Help reviewers and the release process by writing your own changelog entry. For an example, see:
https://github.com/facebook/react-native/wiki/Changelog
-->

[Android] [Fixed] - avoid calling setHint with a null parameter causing cursor to jump to the right

Pull Request resolved: https://github.com/facebook/react-native/pull/28995

Test Plan:
**<details><summary>CLICK TO OPEN TESTS RESULTS (28 May 2020 20a9473aaa330ad9b6e7a0b42ebd9c4ed41ce60b)</summary>**
<p>

More videos and information included in issue https://github.com/facebook/react-native/issues/28794
The below test cases are from the [following repository](https://github.com/fabriziobertoglio1987/AwesomeProject)

| **BEFORE** |
|:-------------------------:|
| <img src="https://user-images.githubusercontent.com/24992535/83123470-3e2f8000-a0d5-11ea-8718-11e6a0575a0c.gif" />|

| **AFTER** |
|:-------------------------:|
| <img src="https://user-images.githubusercontent.com/24992535/83123554-599a8b00-a0d5-11ea-9701-6557f0d76044.gif" />|

Extensive testing on `RNTester` did not identify any regression.

| **AFTER** |
|:-------------------------:|
| <img src="https://user-images.githubusercontent.com/24992535/83123586-628b5c80-a0d5-11ea-92eb-449d499dcc7d.gif" />|

</p>
</details>

**<details><summary>CLICK TO OPEN TESTS RESULTS (15 February 2021 20a9473aaa)</summary>**
<p>

| **BEFORE** |
|:-------------------------:|
| <video src="https://user-images.githubusercontent.com/24992535/107960803-5d44a980-6fa5-11eb-90e2-f0d665e35291.mp4" />|

| **AFTER** |
|:-------------------------:|
| <video src="https://user-images.githubusercontent.com/24992535/107960602-1f478580-6fa5-11eb-8f39-b985fafa6a6c.mp4" />|

</p>
</details>

Reviewed By: charlesbdudley

Differential Revision: D30095877

Pulled By: lunaleaps

fbshipit-source-id: 38a3e788443a22d48a4335063cd4315638bd8e97
2021-08-11 22:53:16 -07:00
jeswinsimon 27fec9569e Updated TextInput autoCompleteType prop to autoComplete 2/2 (#26010)
Summary:
Fix for bug https://github.com/facebook/react-native/issues/26003 Rename TextInput prop "autoCompleteType" to "autoComplete".

## Changelog

[Android] [Breaking] - Updated `autoCompleteType` prop of `TextInput` to `autoComplete`

Pull Request resolved: https://github.com/facebook/react-native/pull/26010

Test Plan: Sandcastle

Reviewed By: mdvacca

Differential Revision: D29795575

Pulled By: lunaleaps

fbshipit-source-id: 6eba7030968e9b7384529a43a6cd1b3c9e8b2a2c
2021-08-11 17:53:37 -07:00
Dmytro Voronkevych 899fa25d38 Documenting UserFlow.endFailure
Summary:
We had some confusion lately, where errorName was used to dump "error message". This caused problems in Scuba.
This doc should add some clarity on what is expected from endFailure users.

Changelog:
[Internal][Added] - Documentation for method in UserFlow.js class

Reviewed By: mityal

Differential Revision: D30192127

fbshipit-source-id: d057668aab714a9342131c83daf41cbe9372cb39
2021-08-11 02:52:53 -07:00
Samuel Susla beb3c2b538 Back out "Flush operations queue when animation starts in RCTNativeAnimatedModule"
Summary:
Changelog: [internal]

Original commit changeset: d3fc021dd434

Reviewed By: motiz88

Differential Revision: D30223203

fbshipit-source-id: 8edf79e109858855d13a36fabab2bcae36180df2
2021-08-10 09:48:38 -07:00
Samuel Susla f3374d0508 Flush operations queue when animation starts in RCTNativeAnimatedModule
Summary:
changelog: [internal]

If nodesManager has the information if animated node is managed by Fabric, we can't decide if the operation queue should be flushed before it is flushed. Therefore, keep the information about animated nodes inside a set instead of nodesManager.

For simplicity, I will refer to class `RCTNativeAnimatedTurboModule` as *NativeAnimated* and to `RCTNativeAnimatedNodesManager` as *NodesManager*

Notice that each call to *NativeAnimated* is queued up in `_operations` or `_preOperations`. When the queues are flushed, only then methods are called on `RCTNativeAnimatedNodesManager`.

There are two mechanisms that flush operations.
One is triggered by `RCTMountingManager` before mounting operations are applied and after they are applied. This works fine but is important to paint the picture.

The second mechanism is inside `[RCTNativeAnimatedTurboModule startAnimatingNode]`. It flushes the queues for Fabric nodes only (not sure why Fabric nodes only, I couldn't find any explanation in old diffs). It checks with *NativeAnimated* if a node is managed by Fabric. Keep in mind, *NodesManager* only knows about the nodes when the queues have been flushed.

Exampe:
JavaScript calls methods on *NativeAnimated*.
For example:
1. `createNode`
2. `connectAnimatedNodeToView`
3. `startAnimatingNode`. (here, the queues should be flushed, since we are in Fabric)

All of these operations are queued up and for as long as `RCTMountingManager` executes mounting, all proceeds as expected.
But if those operations happen after mounting phase, `startAnimatingNode` will not flush the operations queues, because it can't tell if nodeTag is managed by fabric or it isn't. This is because *NodesManager* hasn't been notified about any new nodes.

Reviewed By: RSNara

Differential Revision: D30099010

fbshipit-source-id: d3fc021dd4346d1cbbda3b49ecd9d982c543e705
2021-08-09 12:20:28 -07:00
Andrei Shikov 3bc883c6c6 Warn when negative `numberOfLines` prop set on <Text/> component
Summary:
Updates previous variant that was crashing a surface to the non-crashing variant.
Now it prints error in console and modifies value to be 0.

Changelog: [General][Fixed] Clamp negative values for `numberOfLines` in <Text> component

Reviewed By: yungsters

Differential Revision: D30129658

fbshipit-source-id: fda47a262365573514d3e1e4bf8a26f6d30cdae0
2021-08-05 12:39:09 -07:00
Luis Miguel Alvarado 7ce0f40f5c refactor!: drop deprecated `StatusBarIOS` (#31466)
Summary:
This component has been merged with `StatusBar` and deprecated since [Jun 24, 2019](a833778553)

## Changelog

<!-- Help reviewers and the release process by writing your own changelog entry. For an example, see:
https://github.com/facebook/react-native/wiki/Changelog
-->

[JavaScript] [Removed] - refactor!: drop deprecated `StatusBarIOS`

Pull Request resolved: https://github.com/facebook/react-native/pull/31466

Test Plan: Warning when user imports `StatusBarIOS`

Reviewed By: yungsters

Differential Revision: D30109324

Pulled By: lunaleaps

fbshipit-source-id: fa2d3aa2cf35206ed8a196e09f12af57d3b61ccc
2021-08-04 21:14:46 -07:00
Andrew Clark a169009095 React Native sync for revisions 419cc9c...19092ac
Summary:
This sync includes the following changes:
- **[19092ac8c](https://github.com/facebook/react/commit/19092ac8c )**: Re-add old Fabric Offscreen impl behind flag ([#22018](https://github.com/facebook/react/pull/22018)) //<Andrew Clark>//
- **[215db465a](https://github.com/facebook/react/commit/215db465a )**: [Fabric] Add `flex: 1` to Offscreen view container ([#22019](https://github.com/facebook/react/pull/22019)) //<Andrew Clark>//
- **[8a37b0ef3](https://github.com/facebook/react/commit/8a37b0ef3 )**: typos fixed ([#21955](https://github.com/facebook/react/pull/21955)) //<Sinan Sonmez (Chaush)>//
- **[e3049bb85](https://github.com/facebook/react/commit/e3049bb85 )**: DevTools scheduling profiler: Add React component measures ([#22013](https://github.com/facebook/react/pull/22013)) //<Brian Vaughn>//
- **[27bf6f9a8](https://github.com/facebook/react/commit/27bf6f9a8 )**: Scheduling profiler UX changes ([#21990](https://github.com/facebook/react/pull/21990)) //<Brian Vaughn>//
- **[f0d354efc](https://github.com/facebook/react/commit/f0d354efc )**: [Fabric] Fix reparenting bug in legacy Suspense mount ([#21995](https://github.com/facebook/react/pull/21995)) //<Andrew Clark>//
- **[34308b5ad](https://github.com/facebook/react/commit/34308b5ad )**: Tidy up early bailout logic at start of begin phase ([#21852](https://github.com/facebook/react/pull/21852)) //<Andrew Clark>//
- **[321087d13](https://github.com/facebook/react/commit/321087d13 )**: [Fizz] Don't add aborted segments to the completedSegments list ([#21976](https://github.com/facebook/react/pull/21976)) //<Sebastian Markbåge>//
- **[4cc8ec64c](https://github.com/facebook/react/commit/4cc8ec64c )**: Separate unit tests for ReactFabricHostComponent ([#21969](https://github.com/facebook/react/pull/21969)) //<Timothy Yung>//
- **[d4d786493](https://github.com/facebook/react/commit/d4d786493 )**: Fix `ReactFabricHostComponent` methods if detached ([#21967](https://github.com/facebook/react/pull/21967)) //<Timothy Yung>//
- **[392253a77](https://github.com/facebook/react/commit/392253a77 )**: [Fabric] Use container node to toggle the visibility of Offscreen and Suspense trees ([#21960](https://github.com/facebook/react/pull/21960)) //<Andrew Clark>//

Changelog:
[General][Changed] - React Native sync for revisions 419cc9c...19092ac

jest_e2e[run_all_tests]

Reviewed By: JoshuaGross

Differential Revision: D30092460

fbshipit-source-id: 9f118db2419a9a5db26a9b873868f91ab88f2f89
2021-08-04 13:47:11 -07:00
Andrei Shikov a8a85034e1 Check for negative `numberOfLines` in TextView
Summary:
Negative `numberOfLines` prop is not supported by Android and causes a crash during layout measurement. This change adds a check in JS to catch the error earlier.

Changelog: [Internal]

Reviewed By: GijsWeterings

Differential Revision: D30047103

fbshipit-source-id: 4248a0f573c3b6facd25c7ae6ce007a357a1469b
2021-08-04 05:13:57 -07:00
Samuel Susla c39a4c7f2e Flush operations queue when animation starts
Summary:
changelog: [internal]

If nodesManager has the information if animated node is managed by Fabric, we can't decide if the operation queue should be flushed before it is flushed. Therefore, keep the information about animated nodes inside a set instead of nodesManager.

For simplicity, I will refer to class `RCTNativeAnimatedTurboModule` as *NativeAnimated* and to `RCTNativeAnimatedNodesManager` as *NodesManager*

Notice that each call to *NativeAnimated* is queued up in `_operations` or `_preOperations`. When the queues are flushed, only then methods are called on `RCTNativeAnimatedNodesManager`.

There are two mechanisms that flush operations.
One is triggered by `RCTMountingManager` before mounting operations are applied and after they are applied. This works fine but is important to paint the picture.

The second mechanism is inside `[RCTNativeAnimatedTurboModule startAnimatingNode]`. It flushes the queues for Fabric nodes only (not sure why Fabric nodes only, I couldn't find any explanation in old diffs). It checks with *NativeAnimated* if a node is managed by Fabric. Keep in mind, *NodesManager* only knows about the nodes when the queues have been flushed.

Exampe:
JavaScript calls methods on *NativeAnimated*.
For example:
1. `createNode`
2. `connectAnimatedNodeToView`
3. `startAnimatingNode`. (here, the queues should be flushed, since we are in Fabric)

All of these operations are queued up and for as long as `RCTMountingManager` executes mounting, all proceeds as expected.
But if those operations happen after mounting phase, `startAnimatingNode` will not flush the operations queues, because it can't tell if nodeTag is managed by fabric or it isn't. This is because *NodesManager* hasn't been notified about any new nodes.

Reviewed By: JoshuaGross, p-sun

Differential Revision: D30053890

fbshipit-source-id: b7fe24861d5300f9cfefa813a53df8330fa56d86
2021-08-03 11:32:43 -07:00
Moti Zilberman d4ee734f32 Merge BUCK file at Libraries/ into root
Summary:
Merges the Facebook-internal Buck target definitions in `Libraries/` into the BUCK file at the root of the repo (which is currently not synced to GitHub at all). This does not affect how React Native is built in open source.

Changelog: [Internal]

Reviewed By: GijsWeterings

Differential Revision: D27967499

fbshipit-source-id: 39c51a544b3868242598072d24cb6cfb5a6e2d8c
2021-08-03 05:42:03 -07:00
Samuel Susla 8a8a5323cf Fix order of calls for Native Animated Module
Summary:
Changelog: [internal]

Make sure the order of call is preserved for `NativeAnimatedModule`. The order of calls to NativeAnimatedModule needs to be preserved because its internals depend on it. For example, if you `getValue` is called before `createAnimatedNode`, it causes a crash.

To resolve it, we need to enqueue `getValue` onto operationQueue.

Reviewed By: JoshuaGross

Differential Revision: D30035911

fbshipit-source-id: bbd698a96cada5d2b1312a1a689ca99b04a07cdc
2021-08-03 04:04:06 -07:00
Test User 0b4f4eec8e chore: update Dimensions API Flow types (#31898)
Summary:
This small PR updates the Flow types used in Dimensions. The following changes has been made:
* generic types has been replaced with types from `NativeDeviceInfo` (which already were used in event subscription update)
* ~simplification of `DisplayMetricsAndroid` by spreading via intersection with `DisplayMetrics` type and removing shared properties~
  > I have tried both notations, but according to the lint, it looks like a Native Modules typing limitation which requires redundancy / code duplication in cases like this.

## Changelog

<!-- Help reviewers and the release process by writing your own changelog entry. For an example, see:
https://github.com/facebook/react-native/wiki/Changelog
-->

[Internal] [Changed] - update Dimensions API Flow types

Pull Request resolved: https://github.com/facebook/react-native/pull/31898

Test Plan: Running `yarn flow` in the workspace yields no errors.

Reviewed By: yungsters

Differential Revision: D29932940

Pulled By: GijsWeterings

fbshipit-source-id: bf97bb972964c585207e2450ccf71d932555e291
2021-08-03 03:15:42 -07:00
Xuan Huang d9a9ae38d1 Conditionalize the Regenerator Setup
Summary:
Changelog: [Internal]

If generators are provided natively, that should suggest that the JS source
code did not go through the regenerator-transform (e.g. in Metro Hermes profile),
then there is no need to set up the regenerator runtime.

This should save some work during the Core initialization.

Reviewed By: motiz88

Differential Revision: D29986751

fbshipit-source-id: 129f5122e8e4c05535ee2aa5da6970a66843e8cd
2021-08-02 19:43:04 -07:00
Xuan Huang 06388891a3 Extract feature detection as an utilitiy module
Summary:
Changelog: [Internal]

This diff only extracted the `isNativeFunction` used in `setUpTimers`
into the `FeatureDetection` utility, but later we will add more functions
in it and reuse them in other places.

Reviewed By: RSNara

Differential Revision: D29986750

fbshipit-source-id: 6e48e38d92ceccb35eead3c52e00e1eecb81b5b0
2021-08-02 19:43:04 -07:00
jeswinsimon 8066bc9ff6 Updated TextInput autoCompleteType prop to autoComplete 1/2 (#26010)
Summary:
Fix for bug https://github.com/facebook/react-native/issues/26003 Rename TextInput prop "autoCompleteType" to "autoComplete".

## Changelog

[Android] [Changed] - Updated `autoCompleteType` prop of `TextInput` to `autoComplete`

Pull Request resolved: https://github.com/facebook/react-native/pull/26010

Test Plan:
Test Pass

PR for [Doc Update](https://github.com/facebook/react-native-website/pull/1184)

Reviewed By: mdvacca

Differential Revision: D29980220

Pulled By: lunaleaps

fbshipit-source-id: 3c9e7d3250b5f95b0dbd523fdb0d917a039cd6a9
2021-07-30 03:16:35 -07:00
Michael Chow 1c87d4aee3 Update Dimension.js typo (#29858)
Summary:
preferred instead of preffered

## Changelog

<!-- Help reviewers and the release process by writing your own changelog entry. For an example, see:
https://github.com/facebook/react-native/wiki/Changelog
-->

[CATEGORY] [TYPE] - Message

Pull Request resolved: https://github.com/facebook/react-native/pull/29858

Reviewed By: charlesbdudley

Differential Revision: D29998754

Pulled By: sota000

fbshipit-source-id: f13fef58e9154ddf8087944d53e022fb9afa6b1b
2021-07-29 17:26:01 -07:00
Ikko Ashimine 8b1b7f7126 Fix typo in VirtualizedList-test.js (#31756)
Summary:
occured -> occurred

## Changelog

<!-- Help reviewers and the release process by writing your own changelog entry. For an example, see:
https://github.com/facebook/react-native/wiki/Changelog
-->

[Internal] [Fixed] - Fixed typo in VirtualizedList-test.js

Pull Request resolved: https://github.com/facebook/react-native/pull/31756

Test Plan: NONE

Reviewed By: lunaleaps

Differential Revision: D29975153

Pulled By: charlesbdudley

fbshipit-source-id: 966d90df0bf015b4a6a2e3b1bf88c66b61161a7a
2021-07-28 18:51:07 -07:00
Xuan Huang dc8d218077 Shim Immediate APIs when Promise is queueing to JSVM
Summary:
Changelog: [Internal]

Historically, Immediate API is implemented upon the React Native's
internal microtask-y queue (known as "immediate queue"), which
is the same queue Promise polyfill is operating on.

To make React Native suitable of using the built-in Promises from JSVMs,
which usually enqueues to the JSVM internal microtask queue and has no
access to React Native microtask-y queue, we need to migrate the
Immediate API to use the JSVM microtask queue as well to preserve the
semantics of code relies on the interleaving of promises and immediates.

To do that, this diff implement a shim layer for immediate APIs via the
new `global.queueMicrotask` API (which enqueues to JSVM) in JS, by wrapping
the immediate callback into a "microtask callback", which validate the
`immediate ID` against `clearedImmediate` Set before invoking it.

Reviewed By: RSNara

Differential Revision: D29845305

fbshipit-source-id: c2ed3fed426a5316b1e0dfbfaad51706d1765d4d
2021-07-28 13:37:54 -07:00
Xuan Huang be189cd819 Introduce queueMicrotask API
Summary:
Changelog:
[General][Added] - Add global.queueMicrotask

`queueMicrotask` is a relatively recent API defined in the WHATWG HTML spec
and it's been widely adopted by all web browsers and Node.js.

This diff introduced it to React Native by polyfilling it via a lazily-allocated
resolved Promise, or calling directly into a fast path provided by Hermes.

Reviewed By: RSNara

Differential Revision: D29838852

fbshipit-source-id: 8c4378b1b713fb8b0da5e67f92ba2ea9838766f7
2021-07-28 13:37:54 -07:00
Rick Hanlon d98ec75199 React Native sync for revisions cae6350...419cc9c
Summary:
This sync includes the following changes:
- **[419cc9c37](https://github.com/facebook/react/commit/419cc9c37 )**: Fix: Hide new/updated nodes in already hidden tree ([#21929](https://github.com/facebook/react/pull/21929)) //<Andrew Clark>//
- **[4758e4533](https://github.com/facebook/react/commit/4758e4533 )**: React Native: Export getInspectorDataForInstance API ([#21572](https://github.com/facebook/react/pull/21572)) //<Brian Vaughn>//
- **[ae5d26154](https://github.com/facebook/react/commit/ae5d26154 )**: Fix: LegacyHidden should not toggle effects ([#21928](https://github.com/facebook/react/pull/21928)) //<Andrew Clark>//
- **[9ab90de60](https://github.com/facebook/react/commit/9ab90de60 )**: Clean-up: Move Offscreen logic from Suspense fiber ([#21925](https://github.com/facebook/react/pull/21925)) //<Andrew Clark>//
- **[3f62dec84](https://github.com/facebook/react/commit/3f62dec84 )**: Typo fix ([#21729](https://github.com/facebook/react/pull/21729)) //<Deniz Susman>//
- **[5579f1dc8](https://github.com/facebook/react/commit/5579f1dc8 )**: Update test comments with explanations ([#21857](https://github.com/facebook/react/pull/21857)) //<Ricky>//
- **[262ff7ad2](https://github.com/facebook/react/commit/262ff7ad2 )**: Refactor "disappear" logic into its own traversal ([#21901](https://github.com/facebook/react/pull/21901)) //<Andrew Clark>//
- **[34600f4fa](https://github.com/facebook/react/commit/34600f4fa )**: Refactor "reappear" logic into its own traversal ([#21898](https://github.com/facebook/react/pull/21898)) //<Andrew Clark>//
- **[310187264](https://github.com/facebook/react/commit/310187264 )**: Clean up flushSync flow types ([#21887](https://github.com/facebook/react/pull/21887)) //<Ricky>//
- **[a97b5ac07](https://github.com/facebook/react/commit/a97b5ac07 )**: [Bugfix] Don't hide/unhide unless visibility changes ([#21875](https://github.com/facebook/react/pull/21875)) //<Andrew Clark>//
- **[81346764b](https://github.com/facebook/react/commit/81346764b )**: Run persistent tests in more configurations in CI ([#21880](https://github.com/facebook/react/pull/21880)) //<Andrew Clark>//
- **[9090257e6](https://github.com/facebook/react/commit/9090257e6 )**: fix: restore execution context after RetryAfterError completed ([#21766](https://github.com/facebook/react/pull/21766)) //<Sebastian Silbermann>//
- **[14bac6193](https://github.com/facebook/react/commit/14bac6193 )**: Allow components to render undefined ([#21869](https://github.com/facebook/react/pull/21869)) //<Ricky>//
- **[87b67d319](https://github.com/facebook/react/commit/87b67d319 )**: Enable scheduling profiler flag for react-dom profiling builds ([#21867](https://github.com/facebook/react/pull/21867)) //<Brian Vaughn>//
- **[464f27572](https://github.com/facebook/react/commit/464f27572 )**: Update link to flow ([#21862](https://github.com/facebook/react/pull/21862)) //<Ehsan Hosseini>//
- **[9f5224a9c](https://github.com/facebook/react/commit/9f5224a9c )**: Restore DevTools console message ([#21864](https://github.com/facebook/react/pull/21864)) //<Dan Abramov>//
- **[a4ecd85e8](https://github.com/facebook/react/commit/a4ecd85e8 )**: act: Batch updates, even in legacy roots ([#21797](https://github.com/facebook/react/pull/21797)) //<Andrew Clark>//
- **[c2c6ea1fd](https://github.com/facebook/react/commit/c2c6ea1fd )**: Capture suspense boundaries with undefined fallbacks ([#21854](https://github.com/facebook/react/pull/21854)) //<Ricky>//
- **[0f09f14ae](https://github.com/facebook/react/commit/0f09f14ae )**: Check if already rendering before flushing //<Andrew Clark>//
- **[54e88ed12](https://github.com/facebook/react/commit/54e88ed12 )**: Bugfix: Flush legacy sync passive effects at beginning of event ([#21846](https://github.com/facebook/react/pull/21846)) //<Andrew Clark>//
- **[cb8afda18](https://github.com/facebook/react/commit/cb8afda18 )**: Add test for #21837 ([#21842](https://github.com/facebook/react/pull/21842)) //<Andrew Clark>//
- **[f85f429d5](https://github.com/facebook/react/commit/f85f429d5 )**: Use `act()` in ReactFabric tests ([#21839](https://github.com/facebook/react/pull/21839)) ([#21841](https://github.com/facebook/react/pull/21841)) //<Andrew Clark>//
- **[84639ab53](https://github.com/facebook/react/commit/84639ab53 )**: Guard against reused fibers in React Native commands ([#21837](https://github.com/facebook/react/pull/21837)) //<Timothy Yung>//
- **[c549bc491](https://github.com/facebook/react/commit/c549bc491 )**: Revert "Use `act()` in ReactFabric tests ([#21839](https://github.com/facebook/react/pull/21839))" ([#21840](https://github.com/facebook/react/pull/21840)) //<Timothy Yung>//
- **[59d3aca68](https://github.com/facebook/react/commit/59d3aca68 )**: Use `act()` in ReactFabric tests ([#21839](https://github.com/facebook/react/pull/21839)) //<Timothy Yung>//
- **[9ccc25a0e](https://github.com/facebook/react/commit/9ccc25a0e )**: Reverting recent flushSync changes ([#21816](https://github.com/facebook/react/pull/21816)) //<Brian Vaughn>//
- **[ed6c091fe](https://github.com/facebook/react/commit/ed6c091fe )**: Replace unbatchedUpdates with flushSync ([#21776](https://github.com/facebook/react/pull/21776)) //<Andrew Clark>//
- **[32eefcb3c](https://github.com/facebook/react/commit/32eefcb3c )**: Replace flushDiscreteUpdates with flushSync ([#21775](https://github.com/facebook/react/pull/21775)) //<Andrew Clark>//
- **[ab390c65e](https://github.com/facebook/react/commit/ab390c65e )**: ReactDebugHooks optionally includes fileName, and line/column numbers ([#21781](https://github.com/facebook/react/pull/21781)) //<Brian Vaughn>//
- **[c96761c7b](https://github.com/facebook/react/commit/c96761c7b )**: Delete batchedEventUpdates ([#21774](https://github.com/facebook/react/pull/21774)) //<Andrew Clark>//
- **[3e8c86c1c](https://github.com/facebook/react/commit/3e8c86c1c )**: fix: maxYieldInterval should not compare with currentTime directly in Scheduler-shouldYieldToHost //<郭帅彬>//
- **[d483463bc](https://github.com/facebook/react/commit/d483463bc )**: Updated scripts and config to replace "master" with "main" branch ([#21768](https://github.com/facebook/react/pull/21768)) //<Brian Vaughn>//

Changelog:
[General][Changed] - React Native sync for revisions cae6350...419cc9c

jest_e2e[run_all_tests]

Reviewed By: JoshuaGross

Differential Revision: D29913856

fbshipit-source-id: 58e4903766a312a64a17cfba0b0f684cf4bcacb0
2021-07-27 19:57:52 -07:00
Xuan Huang 37dc1d44a5 Rename immediate to ReactNativeMicrotask in Bridge
Summary:
Changelog: [Internal]

This diff replaced all the internal occurrences of "Immediate" with
"ReactNativeMicrotask" in the legacy bridge and then polyfilled the
original immediate APIs during the timer setup phases as aliases of them.

Note that this diff is part of a larger refactoring.

Reviewed By: RSNara

Differential Revision: D29785430

fbshipit-source-id: 7325d2a7358a6c9baa3e9abb8acf90414de5072f
2021-07-27 00:51:34 -07:00
Jesse Katsumata b4b8b73a9b chore: fix dead link in comment (#31902)
Summary:
Fixed a link in a comment that lead to dead link

whatwg-url changed the source directory from `lib` to `src`

## Changelog

<!-- Help reviewers and the release process by writing your own changelog entry. For an example, see:
https://github.com/facebook/react-native/wiki/Changelog
-->

[INTERNAL] [FIXED] - fix dead link in a comment

Pull Request resolved: https://github.com/facebook/react-native/pull/31902

Test Plan: - [ ] Changed URL opens properly

Reviewed By: charlesbdudley

Differential Revision: D29915170

Pulled By: lunaleaps

fbshipit-source-id: 00b69db82f51d16cf887cd4540a159132ad7d771
2021-07-26 13:10:41 -07:00
Rick Hanlon a90f8d8644 React Native sync for revisions 568dc35...cae6350
Summary:
This sync includes the following changes:
- **[cae635054](https://github.com/facebook/react/commit/cae635054 )**: `act`: Resolve to return value of scope function ([#21759](https://github.com/facebook/react/pull/21759)) //<Andrew Clark>//
- **[e2453e200](https://github.com/facebook/react/commit/e2453e200 )**: act: Add test for bypassing queueMicrotask ([#21743](https://github.com/facebook/react/pull/21743)) //<Andrew Clark>//
- **[534c9c52e](https://github.com/facebook/react/commit/534c9c52e )**: Move error logging to update callback ([#21737](https://github.com/facebook/react/pull/21737)) //<Dan Abramov>//
- **[51b0becf3](https://github.com/facebook/react/commit/51b0becf3 )**: Always keep disabled logs in the second pass ([#21739](https://github.com/facebook/react/pull/21739)) //<Dan Abramov>//
- **[7fec38041](https://github.com/facebook/react/commit/7fec38041 )**: Log and show error overlay for commit phase errors ([#21723](https://github.com/facebook/react/pull/21723)) //<Dan Abramov>//
- **[27c9c95e2](https://github.com/facebook/react/commit/27c9c95e2 )**: act: Bypass microtask for "default sync" updates ([#21740](https://github.com/facebook/react/pull/21740)) //<Andrew Clark>//
- **[355591add](https://github.com/facebook/react/commit/355591add )**: Next/experimental release versions include commit date ([#21700](https://github.com/facebook/react/pull/21700)) //<Brian Vaughn>//
- **[d7dce572c](https://github.com/facebook/react/commit/d7dce572c )**: Remove internal `act` builds from public modules ([#21721](https://github.com/facebook/react/pull/21721)) //<Andrew Clark>//
- **[06f7b4f43](https://github.com/facebook/react/commit/06f7b4f43 )**: `act` should work without mock Scheduler ([#21714](https://github.com/facebook/react/pull/21714)) //<Andrew Clark>//

Changelog:
[General][Changed] - React Native sync for revisions 568dc35...cae6350

jest_e2e[run_all_tests]

Reviewed By: JoshuaGross, ShikaSD

Differential Revision: D29555979

fbshipit-source-id: 0afc869cc007bce417f0020d3ee4dc8b0ea5beb9
2021-07-24 14:27:32 -07:00
Altaibayar Tseveenbayar 6b4d8dbf1a Wrong warning message
Summary:
* it says focusTextInput but the function name is blurTextInput
* probably the message was copy-pasted from `focusTextInput` where is the same error message.

Changelog: [Internal]

Reviewed By: arhelmus

Differential Revision: D29845922

fbshipit-source-id: 21fd3e572c32779c13f6909556153d07dc7a416f
2021-07-22 08:28:02 -07:00
Evan Yeung afe0c1daea Remove existential types from xplat/js
Summary: Changelog: [Internal]

Reviewed By: pieterv

Differential Revision: D29724915

fbshipit-source-id: 97cbeefbba2ddc2e1088dfe19db14fa545213549
2021-07-21 16:52:22 -07:00
Jason Safaiyeh d9e0ea77f0 Migrate to androidx.autofill.HintConstants & Support all constant types (#28008)
Summary:
Fix for https://github.com/facebook/react-native/issues/27952.

Noticed more than just `AUTOFILL_HINT_NEW_PASSWORD` were missing, this PR will support every `AUTOFILL_HINT_*` type.

## Changelog

[Android] [Added] - Added all autofill types to TextEdit

Pull Request resolved: https://github.com/facebook/react-native/pull/28008

Reviewed By: sturmen

Differential Revision: D29766235

Pulled By: mdvacca

fbshipit-source-id: d5171aef8092d37716fddcb6f3443637a4af8481
2021-07-21 15:14:41 -07:00
Mark Bridges aa98978302 Adding metadata to React Native QPL points
Summary:
Changelog:
[General][Added] - Added data field to markerPoint to allow callers to add additional arbitrary string data to logged points

Reviewed By: dmitry-voronkevich

Differential Revision: D29764274

fbshipit-source-id: b0d21e3b20a5353351424afb10c950f3e8689887
2021-07-21 10:34:27 -07:00
Nick Gerleman cd78558552 Add unit tests for VirtualizedList render quirks (#31401)
Summary:
This change adds a series of snapshot tests to validate the render output of VirtualizedList in mixed scenarios. Jest timer mocks are used to measure rendering at different ticks. These test cases mostly center around realization logic, to help prevent regressions when chaning internal state representation.
## Changelog

<!-- Help reviewers and the release process by writing your own changelog entry. For an example, see:
https://github.com/facebook/react-native/wiki/Changelog
-->

[Internal] [Added] - Add unit tests for VirtualizedList render quirks

Pull Request resolved: https://github.com/facebook/react-native/pull/31401

Test Plan: Ran the added UTs locally.

Reviewed By: lunaleaps

Differential Revision: D28017750

Pulled By: rozele

fbshipit-source-id: df9684c4ac80a8732f3e88e7496815127213832e
2021-07-20 10:10:48 -07:00
Joshua Wiegmann 7d5895df4e Remove defaultProps from FlatList (#31798)
Summary:
Issue https://github.com/facebook/react-native/issues/31602. Remove `defaultProps` from `FlatList`.

## Changelog

[JavaScript] [Changed] - Remove defaultProps from FlatList

Pull Request resolved: https://github.com/facebook/react-native/pull/31798

Test Plan:
All test for `FlatList` pass.

https://user-images.githubusercontent.com/57131123/124164691-4066c980-daa1-11eb-8653-5c51640fe63e.mov

Reviewed By: charlesbdudley

Differential Revision: D29619867

Pulled By: lunaleaps

fbshipit-source-id: 8d8a6f095f80374407a55bac0b4e899bae04c577
2021-07-20 00:23:56 -07:00
Kudo Chien b77948e33b Upgrade folly to 2021.06.28.00 and boost to 1.76.0 (#31840)
Summary:
1. [ios] upgrade folly to 2021.06.28.00 which aligned to android.
2. folly compile setting from c++14 -> c++17: _this folly requires c++17 for `std::unordered_map::insert_or_assign`._
3. boost 1.63.0 -> 1.76.0:  _the old boost does not support c++17._
4. deprecating react-native-community/boost-for-react-native: _by cocoapods installer, we could download the official target._

## Changelog

[iOS] [Changed] - Upgrade folly to 2021.06.28.00 and boost to 1.76.0

Pull Request resolved: https://github.com/facebook/react-native/pull/31840

Test Plan: CI passed

Reviewed By: fkgozali

Differential Revision: D29668480

Pulled By: yungsters

fbshipit-source-id: 98eae9ca47f489dcea91974e6f5e9dcb4d66c40c
2021-07-16 15:13:12 -07:00
Adrián Cuesta 1465c8f387 Add support to URI keyboard type in Android (#31781)
Summary:
Android react-native `TextInput` component does nothing if prop `keyboardType` is `url` value. This PR solves that problem.

## Changelog

[Android] [Added] - Add support to URI keyboard type in Android

Pull Request resolved: https://github.com/facebook/react-native/pull/31781

Test Plan:
Before change:

{F630980679}

After Change:

{F630986399}

Reviewed By: lunaleaps

Differential Revision: D29517822

Pulled By: sshic

fbshipit-source-id: 1bda29584a3799570f34e772b5589b59ac80c524
2021-07-16 05:13:07 -07:00
Tim Yung 92c13f0d1d RN: Replace `master` with `main` in Documentation
Summary:
Updates documentation in React Native to reference `main` (or `HEAD` for URLs) instead of `master`.

Part of https://github.com/facebook/react-native/issues/31788.

Changelog:
[General][Changed] - Update documentation reference from `master` to `main` or `HEAD`.

Reviewed By: JoshuaGross

Differential Revision: D29717128

fbshipit-source-id: 0b0babd8407c6fd3d0e5431f6eaf976059731d6f
2021-07-15 15:22:57 -07:00
Evan Yeung efd4dafc54 Update xplat to Flow v0.155.0
Summary:
Update flow version to v0.155.0

Changelog: [Internal]

Reviewed By: pieterv

Differential Revision: D29641055

fbshipit-source-id: 601a82fe4fa4ce548a790347a84aea4014c418d9
2021-07-14 09:13:29 -07:00
Joshua Wiegmann fa0518d3d3 Remove defaultProps from SegmentedControlIOS (#31804)
Summary:
Issue https://github.com/facebook/react-native/issues/31604 . Remove `defaultProps` from `SegmentedControlIOS`.

## Changelog

[JavaScript] [Changed] - Remove defaultProps from SegmentedControlIOS

Pull Request resolved: https://github.com/facebook/react-native/pull/31804

Test Plan: Added tests for `SegmentedControlIOS` pass.

Reviewed By: yungsters

Differential Revision: D29653982

Pulled By: lunaleaps

fbshipit-source-id: ed6e133cc3af629be6cd83be79e402ad1e68b29b
2021-07-13 19:25:43 -07:00
Anas Khurshid 25a16123a6 Added Support for Entrance/exit from collection by Flatlist (#31630)
Summary:
Issue https://github.com/facebook/react-native/issues/30964 .When using a screen reader, flatlist does not announce entrance/ exit from the flat list.

## Changelog

[Android] [Changed] - Added support for accessibility role of "list" for flatlist and sectioned list

Pull Request resolved: https://github.com/facebook/react-native/pull/31630

Test Plan: I have added accessibility role prop in flatlist and sectioned list in rntester app, that will announce entrance/ exit from flatlist and sectioned list.

Reviewed By: kacieb

Differential Revision: D29599351

Pulled By: blavalla

fbshipit-source-id: e16ec69a694780d12f15f88a1e6bb5d7d77ac15f
2021-07-09 19:25:36 -07:00
Kacie Bawiec 771d584098 Add passthroughAnimatedPropsExplicitValues to modern createAnimatedComponent
Summary:
Code almost directly copied from the old implementation of [createAnimatedComponent.js](https://www.internalfb.com/intern/diffusion/FBS/browsefile/master/xplat/js/react-native-github/Libraries/Animated/createAnimatedComponent.js?commit=156dbfe5d0fc491819a8b4939896d23b2273e251&lines=208-211).

This is necessary for certain things to work (like ScrollViewStickyHeader).

The reason is because when animations are driven by useNativeDriver, JS does not know where the component has moved to. If a component that is translated like ScrollViewStickyHeader is also Pressable, the onPress will **not** work without this prop. [Link to where ScrollViewStickyHeader uses passthroughAnimatedPropsExplicitValues](https://www.internalfb.com/intern/diffusion/FBS/browsefile/master/xplat/js/react-native-github/Libraries/Components/ScrollView/ScrollViewStickyHeader.js?commit=124a38e1708b620857e4e6969cdef6004aa1bd10&lines=294-296)

I am not adding this to the Flow type because we only want people using this if they really know what they're doing, as it's a hacky fix.

Followup work to this would be to create a hook to attach the listener to the animated values, which ScrollViewStickyHeader does manually. But this is not required for this component to work.

Changelog: Internal

Reviewed By: yungsters

Differential Revision: D29557480

fbshipit-source-id: 293fab4746c3404f5ae9b90afe85d2ca91181873
2021-07-08 09:29:38 -07:00
Kacie Bawiec 7ebafc0066 Add animation queue to modern createAnimatedComponent
Summary:
Add animation queuing back into createAnimatedComponent_EXPERIMENTAL.js, which is a concurrent-safe version of createAnimatedComponent.

T93269035 for details on why this is needed.

# How does this work?

In the old createAnimatedComponent, Animations were queued by calling `setWaitingForIdentifier` before render, and then calling `unsetWaitingForIdentifier` after render.

In this diff, instead we are calling `setWaitingForIdentifier` in an `useLayoutEffect` before calling `useAnimatedProps`, and we are calling `unsetWaitingForIdentifier` in a `useEffect` after `useAnimatedProps`. So the ordering for the effects are:

1. `useLayoutEffect` with `setWaiting`
2. `useLayoutEffect`s in `useAnimatedProps`
3. `useEffect`s in `useAnimatedProps`
4. `useEffect` with `unsetWaiting`.

There's a React guarantee that **if one effect is called, all of them will be called**, so we don't have a concern about the queue getting locked.

## **Main concerns:**
1. This works in my test cases, but it's not the same behavior as the old createAnimatedComponent (which is wait before and unset wait after render). This may still be ok because the relevant side effects in render from that component have been moved to `useLayoutEffect` or `useEffect` in `useAnimatedProps` (so the ordering is still the same?).
2. I'm not sure about the ordering of `onLayoutEffect`, `onLayout` callbacks, and `useEffect`. createAnimatedComponent_EXPERIMENTAL doesn't use `onLayout`, but with this new method of queuing, **`onLayout` calls will likely be called before the animation queue has been flushed**. It's not clear to me whether this is bad.

Changelog: [Internal]

Reviewed By: yungsters

Differential Revision: D29467458

fbshipit-source-id: 2be23a8968404526d0fa394a7879fda8b5ffbfdc
2021-07-08 09:29:38 -07:00
Justin Huntington bc1e602e0c Add ScrollView.automaticallyAdjustsScrollIndicatorInsets prop (on iOS) (#29809)
Summary:
iOS 13 added a new property to `UIScrollView`: `automaticallyAdjustsScrollIndicatorInsets`, which is `YES` by default.  The property changes the meaning of the `scrollIndicatorInsets` property.  When `YES`, any such insets are **in addition to** whatever insets would be applied by the device's safe area.  When `NO`, the iOS <13 behavior is restored, which is for such insets to not account for safe area.

In other words, this effects ScrollViews that underlay the device's safe area (i.e. under the notch).  When `YES`, the OS "automatically" insets the scroll indicators, when `NO` it does not.

There are two problems with the default `YES` setting:

1. It means applying `scrollIndicatorInsets` to a `ScrollView` has a different effect on iOS 13 versus iOS 12.
2. It limits developers' control over `scrollIndicatorInsets`.  Since negative insets are not supported, if the insets the OS chooses are too large for your app, you cannot fix it.

Further explanation & sample code is available in issue https://github.com/facebook/react-native/issues/28140 .

This change sets the default for this property to `NO`, making the behavior consistent across iOS versions, and allowing developers full control.

## Changelog

<!-- Help reviewers and the release process by writing your own changelog entry. For an example, see:
https://github.com/facebook/react-native/wiki/Changelog
-->

[iOS] [Changed] - ScrollView scrollIndicatorInsets to not automatically add safe area on iOS13+

Pull Request resolved: https://github.com/facebook/react-native/pull/29809

Test Plan:
Updated the RNTester example to explain what to expect. Also removed the `pageScreen` modal example for now as mentioned in my Github comment.

{F628636466}

Here are screenshots of the demo app (from the original bug) before (with safe area applied to insets) & after (without safe area applied to insets):

![before](https://user-images.githubusercontent.com/428831/91644197-ea03a700-ea07-11ea-9489-be27820930eb.png)

![after](https://user-images.githubusercontent.com/428831/91644200-eff98800-ea07-11ea-8788-daf1e783639d.png)

Reviewed By: p-sun

Differential Revision: D28229603

Pulled By: lunaleaps

fbshipit-source-id: 2e774ae150b1dc41680b8b7886c7ceac8808136a
2021-07-07 20:23:36 -07:00
Nishan Bende d85d72d0d9 fix: TouchableNativeFeedback ripple starts on previous touch location (#31777)
Summary:
TouchableNativeFeedback's ripple starts from previous location on subsequent presses. This is similar to https://github.com/facebook/react-native/pull/31669

Fixes https://github.com/facebook/react-native/issues/28944

Issue

https://user-images.githubusercontent.com/23293248/123521731-1f375f00-d6d6-11eb-8e4c-fc5ffb322e67.mov

Fix

https://user-images.githubusercontent.com/23293248/123521735-2bbbb780-d6d6-11eb-88b2-be75342cf22a.mov

## Changelog

<!-- Help reviewers and the release process by writing your own changelog entry. For an example, see:
https://github.com/facebook/react-native/wiki/Changelog
-->

[Android] [Fixed] - TouchableNativeFeedback ripple starts on previous touch location.

Pull Request resolved: https://github.com/facebook/react-native/pull/31777

Test Plan: Tested TouchableNativeFeedback examples in rn-tester app. Registering coordinates before pressed command fixes the issue.

Reviewed By: lunaleaps

Differential Revision: D29496515

Pulled By: kacieb

fbshipit-source-id: 77ac626181a61eee2cd30c4d48e52d10d800f2d8
2021-07-06 17:50:35 -07:00
Ruslan Serebriakov d5676f8370 CKComponentLayout
Summary:
fastmod --accept-all "CKComponentLayout" "RCLayout"
Changelog: [Internal]

## Changelog:

[Internal] - Renaming

Reviewed By: cuva

Differential Revision: D29228868

fbshipit-source-id: 2a5601eb7464e2cff3302781030c175e972f38bb
2021-07-01 09:04:46 -07:00
Joshua Gross afafbf8ec4 Log soft exception instead of crashing if ref is null on TextInput onPress
Summary:
See title.

Changelog: [internal]

Reviewed By: yungsters

Differential Revision: D29410457

fbshipit-source-id: 0b9a9836baa0b5b7deb88cd73f4f634ca10c5868
2021-06-25 19:49:04 -07:00
Nick Gerleman 5cb2debbea Add "CellRenderMask" Region Tracking Structure (#31420)
Summary:
A CellRenderMask helps track regions of cells/spacers to render. It's API allows adding ranges of cells, where its otput be an ordered list of contiguous spacer/non-spacer ranges.

The implementation keeps this region list internally, splitting or merging regions when cells are added. This output will be used by the render function of a refactored VirtualizedList.

## Changelog

<!-- Help reviewers and the release process by writing your own changelog entry. For an example, see:
https://github.com/facebook/react-native/wiki/Changelog
-->

[Internal] [Added] - Add "CellRenderMask" Region Tracking Structure

Pull Request resolved: https://github.com/facebook/react-native/pull/31420

Test Plan: Validated via UTs.

Reviewed By: lunaleaps

Differential Revision: D28293161

Pulled By: rozele

fbshipit-source-id: a5e4e2144a90387aabe0974650429018440abf67
2021-06-24 07:57:01 -07:00
Tim Yung 123d184944 ImageSource: Convert `ImageURISource` to Interface
Summary:
Changes the `ImageURISource` Flow type into an interface.

- This enables both objects and class instances to be subtypes of `ImageURISource`.
- This makes it invalid to spread `ImageURISource` as a type, so `interface X extends ImageURISource` can instead be used.
- This makes it invalid to spread `ImageURISource` as a value, so `getImageSourceProperties(x)` can instead be used.
- This makes it invalid to use `$Exact` with `ImageURISource`.

Changelog:
[General][Changed] - `ImageURISource` Flow type is now an interface instead of an object.

Reviewed By: timrc

Differential Revision: D29323508

fbshipit-source-id: 647c2f9b0bfead6d7e56bdb7108e623cbf8b6c89
2021-06-23 13:15:02 -07:00
Peter Argany e83feffeba Back out "Avoid re-encoding images when uploading local files"
Summary:
This was causing an upload error in FB Dating, will need to re-land with the fix.

Changelog: [Internal]

Reviewed By: fkgozali

Differential Revision: D29320144

fbshipit-source-id: 5d09dd2171b5696afe89cffa064947f0a0bb413d
2021-06-22 19:18:22 -07:00
Kacie Bawiec d4d22fbfb9 React Native sync for revisions c96b78e...568dc35
Summary:
This sync includes the following changes:
- **[43f4cc160](https://github.com/facebook/react/commit/43f4cc160 )**: Fix failing test ([#21697](https://github.com/facebook/react/pull/21697)) //<Dan Abramov>//
- **[d0f348dc1](https://github.com/facebook/react/commit/d0f348dc1 )**: Fix for failed Suspense layout semantics ([#21694](https://github.com/facebook/react/pull/21694)) //<Brian Vaughn>//
- **[bd0a96344](https://github.com/facebook/react/commit/bd0a96344 )**: Throw when `act` is used in production ([#21686](https://github.com/facebook/react/pull/21686)) //<Andrew Clark>//
- **[9343f8720](https://github.com/facebook/react/commit/9343f8720 )**: Use the server src files as entry points for the builds/tests ([#21683](https://github.com/facebook/react/pull/21683)) //<Sebastian Markbåge>//
- **[502f8a2a0](https://github.com/facebook/react/commit/502f8a2a0 )**: [Fizz/Flight] Don't use default args ([#21681](https://github.com/facebook/react/pull/21681)) //<Sebastian Markbåge>//
- **[a8f5e77b9](https://github.com/facebook/react/commit/a8f5e77b9 )**: Remove invokeGuardedCallback from commit phase ([#21666](https://github.com/facebook/react/pull/21666)) //<Dan Abramov>//
- **[dbe3363cc](https://github.com/facebook/react/commit/dbe3363cc )**: [Fizz] Implement Legacy renderToString and renderToNodeStream on top of Fizz ([#21276](https://github.com/facebook/react/pull/21276)) //<Sebastian Markbåge>//
- **[101ea9f55](https://github.com/facebook/react/commit/101ea9f55 )**: Set deletedTreeCleanUpLevel to 3 ([#21679](https://github.com/facebook/react/pull/21679)) //<Dan Abramov>//
- **[1a106bdc2](https://github.com/facebook/react/commit/1a106bdc2 )**: Wrap eventhandle-specific logic in a flag ([#21657](https://github.com/facebook/react/pull/21657)) //<Dan Abramov>//
- **[cb30388d1](https://github.com/facebook/react/commit/cb30388d1 )**: Export React Native `AttributeType` Types ([#21661](https://github.com/facebook/react/pull/21661)) //<Timothy Yung>//
- **[c1536795c](https://github.com/facebook/react/commit/c1536795c )**: Revert "Make enableSuspenseLayoutEffectSemantics static for www ([#21617](https://github.com/facebook/react/pull/21617))" ([#21656](https://github.com/facebook/react/pull/21656)) //<Sebastian Markbåge>//

Changelog:
[General][Changed] - React Native sync for revisions c96b78e...568dc35

jest_e2e[run_all_tests]

Reviewed By: rickhanlonii

Differential Revision: D29303157

fbshipit-source-id: 90952885eb2264f4effa04070357b80700bb9be3
2021-06-22 14:29:17 -07:00
Luna Wei fc9c326912 Use Animated.event implementation in AnimatedMock
Summary: Changelog: [Internal] - Animated.event from my limited understanding attaches Animated.Values to native views. In terms of animation, Animated.Values are already handled by AnimatedMock to skip interpolation.

Reviewed By: GijsWeterings

Differential Revision: D29241590

fbshipit-source-id: 98650883dad53d6f77dbc398ba0cac903194deca
2021-06-22 08:16:42 -07:00
David Vacca 7f117394af Refactor Image to log component stacktraces for images rendering non-fb sources
Summary:
This diff refactors the Image component in order to log the component hierarchy stacktraces for images rendering non-fb sources

changelog: [internal] internal

Reviewed By: yungsters

Differential Revision: D29266451

fbshipit-source-id: 826230b1a18a5809b340ef0767d80a281e20477a
2021-06-21 20:29:27 -07:00
Luna Wei ad0ccac0d6 Remove Picker from OSS
Summary:
Changelog:
[General][Removed] - Remove Picker/PickerIOS export from react-native and delete JS related code

Reviewed By: kacieb

Differential Revision: D29122947

fbshipit-source-id: 9f754396d1f221fde57ec4dec8e29af598432102
2021-06-21 15:19:09 -07:00
David Vacca 14ca57b435 Log ImageSource uris that are not using Facebook domain
Summary:
This diff adds logging to uncover what are the ReactNative screens that are rendering images using NON-Facebook domains

changelog: [internal] internal

Reviewed By: yungsters

Differential Revision: D29179990

fbshipit-source-id: 85f6380848d1ac1461419bc29c4666be389fb87a
2021-06-17 15:11:06 -07:00
Tim Yung 765d1e247b RN: Change `ImageURISource` to Object Type
Summary:
Changes `ImageURISource` back to an object type.

It was changed to an interface by D27193522 (05418f8fcc), but that is not the right direction for this type.

Changelog:
[Internal] - There was no changelog entry for this initially, so the revert can also be omitted.

Reviewed By: lunaleaps

Differential Revision: D29205798

fbshipit-source-id: 727ef70bbf47d14b163ecf5d6f31184da51c894a
2021-06-17 13:51:41 -07:00
Ramanpreet Nara 8a677face4 Add NOBRIDGE prefix to Venice Metro logs
Summary:
## Context
In dev mode, Metro hijacks the JavaScript `console`, and prints all logs into the terminal running the Metro server.

## Problem
We have no way to distinguish between Bridge mode and Bridgeless mode logs. This makes it hard to tell catch warnings and errors are coming from bridgeless mode.

## Changes
- This diff adds a "NOBRIDGE" prefix to all React Native Metro logs coming from Bridgeless mode.
- Bridge mode console logs/warnings/errors are **unaffected**.

Changelog: [Internal]

Reviewed By: PeteTheHeat

Differential Revision: D29152292

fbshipit-source-id: 257b8140327cfd7a0a10aa229bcb88117231e452
2021-06-16 12:45:08 -07:00
Peter Argany c3dffe059b Fix native module lookup followup from D28630805
Summary:
In D28630805 (f78526ce3d) ([github link](https://github.com/facebook/react-native/pull/31457)) I added a setter to workaround a bug I perceived with `moduleRegistry`. Turns out - the proper fix was to remove the `synthesize` line. See conversation on linked diff for more context.

Changelog: [Internal]

Reviewed By: RSNara

Differential Revision: D29144717

fbshipit-source-id: aa95b670b540b9007eed76769c9babc10ea399ce
2021-06-15 18:50:08 -07:00
Arthur Lee f78526ce3d Avoid re-encoding images when uploading local files (#31457)
Summary:
Fixes https://github.com/facebook/react-native/issues/27099

When you upload a local file using XHR + the `FormData` API, RN uses `RCTNetworkTask` to retrieve the image file data from the local filesystem (request URL is a file:// URL) ([code pointer](https://github.com/facebook/react-native/blob/master/Libraries/Network/RCTNetworking.mm#L398)). As a result, if you are uploading a local image file that is in the app's directory `RCTNetworkTask` will end up using `RCTLocalAssetImageLoader` to load the image, which reads the image into a `UIImage` and then re-encodes it using `UIImageJPEGRepresentation` with a compression quality of 1.0, which is the higest ([code pointer](4c5182c1cc/Libraries/Image/RCTImageLoader.mm (L1114))). Not only is this unnecessary, it ends up inflating the size of the jpg if it had been previously compressed to a lower quality.

With this PR, this issue is fixed by forcing the `RCTFileRequestHandler` to be used when retrieving local files for upload, regardless of whether they are images or not. As a result, any file to be uploaded gets read into `NSData` which is the format needed when appending to the multipart body.
I considered fixing this by modifying the behavior of how the handlers were chosen, but this felt like a safer fix since it will be scoped to just uploads and wont affect image fetching.

## Changelog

[iOS] [Fixed] - Avoid re-encoding images when uploading local files

Pull Request resolved: https://github.com/facebook/react-native/pull/31457

Test Plan:
The repro for this is a bit troublesome, especially because this issue doesn't repro in RNTester. There is [some code](https://github.com/facebook/react-native/blob/master/packages/rn-tester/RNTester/AppDelegate.mm#L220) that is to be overriding the handlers that will be used, excluding the `RCTImageLoader`. I had to repro this in a fresh new RN app.

1. Create a blank RN app
2. Put an image in the folder of the app's install location. This would be similar to where files might be placed after an app downloads or captures an image.
3. Set up a quick express server that accepts multipart form uploads and stores the files
4. Trigger an upload via react native
```
const data = new FormData();
data.append('image', {
  uri:
    '/Users/arthur.lee/Library/Developer/CoreSimulator/Devices/46CDD981 (d0c8cb12f2)-9164-4925-9025-1A76C0D9 (1946aee3d9)F0F5/data/Containers/Bundle/Application/B1E8A764-6221-4EA9-BE9A-2CB1699FD218 (1c92b1cff6)/test.app/test.bundle/compressed.jpg',
  type: 'image/jpeg',
  name: 'image.jpeg',
});

fetch(`http://localhost:3000/upload`, {
  method: 'POST',
  headers: {'Content-Type': 'multipart/form-data'},
  body: data,
}).then(console.log);
```
5. Trigger the upload with and without this patch

Original file:
```
$ ls -lh
total 448
-rw-r--r--  1 arthur.lee  staff   223K Apr 29 17:08 compressed.jpg
```

Uploaded file (with and without patch):
```
$ ls -lh
total 1624
-rw-r--r--@ 1 arthur.lee  staff   584K Apr 29 17:11 image-nopatch.jpeg
-rw-r--r--@ 1 arthur.lee  staff   223K Apr 29 17:20 image-withpatch.jpeg
```

Would appreciate pointers on whether this needs to be tested more extensively

Reviewed By: yungsters

Differential Revision: D28630805

Pulled By: PeteTheHeat

fbshipit-source-id: 606a6091fa3e817966548c5eb84b19cb8b9abb1c
2021-06-14 22:52:58 -07:00
Martin Sherburn e539e7d0be Fix bug in parseHermesStack.js
Summary:
If function name is an empty string then it would fail to parse the line. And not only that, it would cause the entire stack to be lost. This fixes the issue by replacing `.+?` with `.*?`.

For example this line fails to parse:
```
    at global (:2:4)
```

Changelog:
[General][Fixed] - Fixed bug parsing hermes call stacks when the file name is empty

Reviewed By: yungsters

Differential Revision: D29063192

fbshipit-source-id: 604e457af51f852fe547e6424283631ae148897d
2021-06-14 02:57:37 -07:00
Tim Yung ed76d4d8db RN: Statically Define `ReactNativeStyleAttributes`
Summary:
Rewrites `ReactNativeStyleAttributes` so that it is statically defined.

This means it will no longer require a handful of modules that defines `prop-types` only to use their keys.

Functionally, this should be equivalent to what was there before.

Changelog:
[Internal]

Reviewed By: TheSavior

Differential Revision: D29019308

fbshipit-source-id: 47f85a8c7703a133c68c20c7f3e14e1026ce4ff2
2021-06-11 23:52:09 -07:00
Tim Yung 33b385825c RN: Simplify `ReactNativeStyleAttributes` Type
Summary:
Simplifies the Flow type for `ReactNativeStyleAttributes`, an internal module.

Changelog:
[Internal]

Reviewed By: TheSavior

Differential Revision: D29019311

fbshipit-source-id: cf95dac4b8c2261812cc1d753255dfb905540759
2021-06-11 23:52:09 -07:00
Tim Yung 2e8c0bd7ea RN: Delete `StyleSheetValidation`
Summary:
Deletes `StyleSheetValidation` because it is `prop-types` in disguise.

Changelog:
[General][Removed] - `StyleSheet.create` will no longer do DEV-time validation.

Reviewed By: TheSavior

Differential Revision: D29019310

fbshipit-source-id: bfe886d8dc09a1aa8dac4a73bfd62f481e3eb9e9
2021-06-11 23:52:09 -07:00
Tim Yung 052b3e3faa RN: Cleanup `DeprecatedTextInputPropTypes`
Summary:
Removes the unnecessary dependency from `DeprecatedTextInputPropTypes` on `Text`. Just use `DeprecatedTextPropTypes` directly.

Changelog:
[Internal]

Reviewed By: TheSavior

Differential Revision: D29017596

fbshipit-source-id: b816c2261bf473e02473d84984cfb3d5a63ec8c1
2021-06-11 23:52:09 -07:00
Tim Yung efefae92ca RN: Move `{ => Deprecated}ImageProp{s => Types}` (Android)
Summary:
Moves `ImagePropTypes` out of `Image.android.js` in preparation for some cleanup.

Changelog:
[Internal]

Reviewed By: TheSavior

Differential Revision: D29017076

fbshipit-source-id: e7d3d6533f69dc2c54e7c25e215648d7c7ff1840
2021-06-11 23:52:09 -07:00
Daniel Sainati 974f0a3281 pre-suppress this typing errors ahead of 154
Summary:
This pre-suppresses the 154 error diff ahead of its release, since it is large.

Changelog: [Internal]

Reviewed By: samwgoldman

Differential Revision: D29065246

fbshipit-source-id: f418041305a46df410dcbe3d9a4db81a61ac7014
2021-06-11 14:31:41 -07:00
Samuel Susla 2a6df5b375 Pass concurrentRoot flag through to renderApplication
Summary:
Changelog: [internal]

Pass concurrentRoot flag to renderApplication.

Reviewed By: rubennorte

Differential Revision: D28630516

fbshipit-source-id: 959b9c684a8736a28a86d42699a78c96da859224
2021-06-11 04:23:50 -07:00
Samuel Susla e31e2cc318 React Native sync for revisions 0eea577...c96b78e
Summary:
This sync includes the following changes:
- **[c96b78e0e](https://github.com/facebook/react/commit/c96b78e0e )**: Add concurrentRoot property to ReactNativeTypes ([#21648](https://github.com/facebook/react/pull/21648)) //<Samuel Susla>//
- **[1a3f1afbd](https://github.com/facebook/react/commit/1a3f1afbd )**: [React Native] Fabric get current event priority ([#21553](https://github.com/facebook/react/pull/21553)) //<Samuel Susla>//
- **[48a11a3ef](https://github.com/facebook/react/commit/48a11a3ef )**: Update next React version ([#21647](https://github.com/facebook/react/pull/21647)) //<Andrew Clark>//
- **[5aa0c5671](https://github.com/facebook/react/commit/5aa0c5671 )**: Fix Issue with Undefined Lazy Imports By Refactoring Lazy Initialization Order ([#21642](https://github.com/facebook/react/pull/21642)) //<Sebastian Markbåge>//

Changelog:
[General][Changed] - React Native sync for revisions 0eea577...c96b78e

jest_e2e[run_all_tests]

Reviewed By: bvaughn

Differential Revision: D29029542

fbshipit-source-id: 9f2e19b4714b5697b5b846f2db8eb28c25420932
2021-06-11 02:09:02 -07:00
Kacie Bawiec 6e2989a7b3 Update Image.[android|ios].js to use import from instead of require
Summary:
As title

Changelog:
[General][Changed] Update Image.[android|ios].js to use import from instead of require

Reviewed By: TheSavior, yungsters

Differential Revision: D29003824

fbshipit-source-id: 0f98c730b1bd9cb581d2fcf6f4c0e911bb8c24b5
2021-06-10 17:12:06 -07:00
Luna Wei fc587c9e98 Back out "Back out "[react-native][PR] remove defaultProps from picker of components""
Summary:
Changelog:
[Internal] - Remove defaultProps from Picker

Reviewed By: TheSavior

Differential Revision: D28941586

fbshipit-source-id: ca9efef597936badfd5c2920028ebd11dc7422a0
2021-06-09 10:34:50 -07:00
Luna Wei 0aa8e25deb Switch: useMergeRef for forwarding ref
Summary:
Changelog:
[Internal] - Replace `useImperativeHandle` usage with new `useMergeRef` which will keep both the forwarded and internal ref handle up to date (in case the instance ever changes). That being said, this change was not motivated in fear of a stale ref but more an intention to show that `useImperativeHandle`'s use case is more about creating a selective API and `useMergeRef` is better suited for publishing ref updates.

Reviewed By: yungsters

Differential Revision: D28950632

fbshipit-source-id: 594afda02693545aab77f24566180c338b58bb8b
2021-06-09 10:12:53 -07:00
Nishan Bende 961b00d8c0 Pressable ripple should pick press event coordinates on subsequent press. (#31669)
Summary:
Please watch the recording below for better explanation. Ripple effect starts from previous press event's coordinates on subsequent presses.

https://user-images.githubusercontent.com/23293248/120929850-51bdef80-c708-11eb-906c-d711672370ee.mov

## Changelog

[Android] [Fixed] - Pressable ripple subsequent press coordinates.

Pull Request resolved: https://github.com/facebook/react-native/pull/31669

Test Plan:
- Tested all Pressable examples. Registering coordinates before press seems to fix the issue.

https://user-images.githubusercontent.com/23293248/120929905-892c9c00-c708-11eb-9e63-576ae800733c.mov

Reviewed By: yungsters

Differential Revision: D28966505

Pulled By: kacieb

fbshipit-source-id: b745180065611390e1897692a0bdea7d6e022cdd
2021-06-08 15:28:22 -07:00
Birkir Gudjonsson 4b9d9dda27 Accessible colors for DynamicColorIOS (#31651)
Summary:
Allow you to harvest the `UIAccessibilityContrastHigh` trait from iOS to show accessible colors when high contrast mode is enabled.

```jsx
// usage

PlatformColorIOS({
  light: '#eeeeee',
  dark: '#333333',
  highContrastLight: '#ffffff',
  highContrastDark: '#000000',
});

// {
//   "dynamic": {
//     "light": "#eeeeee",
//     "dark": "#333333",
//     "highContrastLight": "#ffffff",
//     "highContrastDark": "#000000",
//   }
// }
```

This is how apple's own dynamic system colors work under the hood (https://developer.apple.com/design/human-interface-guidelines/ios/visual-design/color/#dynamic-system-colors)

 ---

The react native docs mention that more keys may become available in the future, which this PR is adding:

> In the future, more keys might become available for different user preferences, like high contrast.

https://reactnative.dev/docs/dynamiccolorios

## Changelog

<!-- Help reviewers and the release process by writing your own changelog entry. For an example, see:
https://github.com/facebook/react-native/wiki/Changelog
-->

[iOS] [Added] - High contrast dynamic color options for dark and light mode.

Pull Request resolved: https://github.com/facebook/react-native/pull/31651

Test Plan: Added unit tests for `normalizeColor` to pass the high contrast colors downstream to RCTConvert

Reviewed By: lunaleaps

Differential Revision: D28922536

Pulled By: p-sun

fbshipit-source-id: f81417f003c3adefac50e994e62b9be14ffa91a1
2021-06-08 11:51:23 -07:00
Nishan Bende 0823f299e5 Foreground ripple support in Pressable (#31632)
Summary:
This PR aims to enable support for foreground ripple in Pressable. This makes it possible to show ripple on top of custom child components like Image as shown in the below example.

## Changelog

<!-- Help reviewers and the release process by writing your own changelog entry. For an example, see:
https://github.com/facebook/react-native/wiki/Changelog
-->

[Android] [Added] - Support for foreground ripple in Pressable

Pull Request resolved: https://github.com/facebook/react-native/pull/31632

Test Plan:
- Pass property useForeground: true in android_ripple config to verify the changes.

https://user-images.githubusercontent.com/23293248/120111371-4cecbf00-c18f-11eb-8acb-d10718d5483c.mov

Reviewed By: kacieb

Differential Revision: D28926493

Pulled By: yungsters

fbshipit-source-id: 12a6ba71a7dc6ed60fbaeb651f015cace38e03b1
2021-06-07 17:07:58 -07:00
Andrei Shikov a403e76177 React Native sync for revisions 2d8d133...0eea577
Summary:
- **[0eea57724](https://github.com/facebook/react/commit/0eea57724 )**: Fix typo in comment (accumlated → accumulated) ([#21637](https://github.com/facebook/react/pull/21637)) //<ithinker5>//
- **[0706162ba](https://github.com/facebook/react/commit/0706162ba )**: Fix typo in comment (environement → environment) ([#21635](https://github.com/facebook/react/pull/21635)) //<niexq>//
- **[9d17b562b](https://github.com/facebook/react/commit/9d17b562b )**: Fix typo in comment (satsify → satisfy) ([#21629](https://github.com/facebook/react/pull/21629)) //<niexq>//
- **[b610fec00](https://github.com/facebook/react/commit/b610fec00 )**: fix comments: expiration time -> lanes ([#21551](https://github.com/facebook/react/pull/21551)) //<Shannon Feng>//
- **[cc4d24ab0](https://github.com/facebook/react/commit/cc4d24ab0 )**: [Fizz] Always call flush() if it exists ([#21625](https://github.com/facebook/react/pull/21625)) //<Dan Abramov>//
- **[e0d9b2899](https://github.com/facebook/react/commit/e0d9b2899 )**: [Fizz] Minor Fixes for Warning Parity ([#21618](https://github.com/facebook/react/pull/21618)) //<Sebastian Markbåge>//
- **[1b7b3592f](https://github.com/facebook/react/commit/1b7b3592f )**: [Fizz] Implement Component Stacks in DEV for warnings ([#21610](https://github.com/facebook/react/pull/21610)) //<Sebastian Markbåge>//
- **[39f007489](https://github.com/facebook/react/commit/39f007489 )**: Make enableSuspenseLayoutEffectSemantics static for www ([#21617](https://github.com/facebook/react/pull/21617)) //<Brian Vaughn>//
- **[8f3794276](https://github.com/facebook/react/commit/8f3794276 )**: Prepare semver (`latest`) releases in CI ([#21615](https://github.com/facebook/react/pull/21615)) //<Andrew Clark>//
- **[8b4201535](https://github.com/facebook/react/commit/8b4201535 )**: Devtools: add feature to trigger an error boundary ([#21583](https://github.com/facebook/react/pull/21583)) //<Bao Pham>//
- **[154a8cf32](https://github.com/facebook/react/commit/154a8cf32 )**: Fix reference to wrong variable //<Andrew Clark>//
- **[6736a38b9](https://github.com/facebook/react/commit/6736a38b9 )**: Add single source of truth for package versions ([#21608](https://github.com/facebook/react/pull/21608)) //<Andrew Clark>//
- **[86715efa2](https://github.com/facebook/react/commit/86715efa2 )**: Resolve the true entry point during tests ([#21505](https://github.com/facebook/react/pull/21505)) //<Sebastian Markbåge>//
- **[a8a4742f1](https://github.com/facebook/react/commit/a8a4742f1 )**: Convert ES6/TypeScript/CoffeeScript Tests to createRoot + act ([#21598](https://github.com/facebook/react/pull/21598)) //<Sebastian Markbåge>//
- **[1d3558965](https://github.com/facebook/react/commit/1d3558965 )**: Disable deferRenderPhaseUpdateToNextBatch by default ([#21605](https://github.com/facebook/react/pull/21605)) //<Sebastian Markbåge>//
- **[a8964649b](https://github.com/facebook/react/commit/a8964649b )**: Delete an unused field ([#21415](https://github.com/facebook/react/pull/21415)) //<okmttdhr>//
- **[76f85b3e5](https://github.com/facebook/react/commit/76f85b3e5 )**: Expose Fizz in stable builds ([#21602](https://github.com/facebook/react/pull/21602)) //<Dan Abramov>//
- **[e16d61c30](https://github.com/facebook/react/commit/e16d61c30 )**: [Offscreen] Mount/unmount layout effects ([#21386](https://github.com/facebook/react/pull/21386)) //<Andrew Clark>//
- **[63091939b](https://github.com/facebook/react/commit/63091939b )**: OSS feature flag updates ([#21597](https://github.com/facebook/react/pull/21597)) //<Brian Vaughn>//
- **[efbd69b27](https://github.com/facebook/react/commit/efbd69b27 )**:  Define global __WWW__ = true flag during www tests ([#21504](https://github.com/facebook/react/pull/21504)) //<Sebastian Markbåge>//
- **[28625c6f4](https://github.com/facebook/react/commit/28625c6f4 )**: Disable strict effects for legacy roots (again) ([#21591](https://github.com/facebook/react/pull/21591)) //<Brian Vaughn>//
- **[3c2341416](https://github.com/facebook/react/commit/3c2341416 )**: Update jest to v26 ([#21574](https://github.com/facebook/react/pull/21574)) //<Sebastian Silbermann>//
- **[0d493dcda](https://github.com/facebook/react/commit/0d493dcda )**: Removed _debugID field from Fiber - Issue #21558 ([#21570](https://github.com/facebook/react/pull/21570)) //<Pulkit Sharma>//
- **[7841d0695](https://github.com/facebook/react/commit/7841d0695 )**: Enable the updater-tracking feature flag in more builds ([#21567](https://github.com/facebook/react/pull/21567)) //<Brian Vaughn>//
- **[6405efc36](https://github.com/facebook/react/commit/6405efc36 )**: Enabled Profiling feature flags for OSS release ([#21565](https://github.com/facebook/react/pull/21565)) //<Brian Vaughn>//

Changelog:
[General][Changed] - React Native sync for revisions 2d8d133...0eea577

jest_e2e[run_all_tests]

Reviewed By: bvaughn

Differential Revision: D28932083

fbshipit-source-id: 012c1bfb857ed59d7283334d633f1cce8ec50360
2021-06-07 11:42:50 -07:00
Tim Yung c774f9e97e Animated: Support Concurrent Rendering
Summary:
Creates a `useAnimatedProps` hook that is compatible with concurrent mode, and uses this in `createAnimatedComponent_EXPERIMENTAL`.

Changelog:
[Internal]

Reviewed By: lunaleaps

Differential Revision: D28390393

fbshipit-source-id: d8aa471507a5d096832b93caf63a24f71733deda
2021-06-06 17:08:55 -07:00
Tim Yung cb25638a0e RN: Create `useRefEffect` Utility
Summary:
Creates `useRefEffect` which will be used by components in React Native.

Changelog:
[Internal]

Reviewed By: lunaleaps

Differential Revision: D28862440

fbshipit-source-id: 50e0099c1a3e0a0f506bf82e68984fc5a032f101
2021-06-06 17:08:55 -07:00
Tim Yung 0b994ac19c RN: Create `useMergeRefs` Utility
Summary:
Creates `useMergeRefs` which will be used by components in React Native.

Changelog:
[Internal]

Reviewed By: lunaleaps

Differential Revision: D28862439

fbshipit-source-id: 60eac7bcd6cceb06ee82181386b4712d642f5404
2021-06-06 17:08:55 -07:00
Andrei Shikov 29bc96135b Back out "remove defaultProps from picker of components"
Summary:
Reverts changes that were causing insta crashes on Android surfaces.

Changelog: [Internal]

Reviewed By: TheSavior

Differential Revision: D28924291

fbshipit-source-id: eebaf9d28b40e4bb4168af1ceafd5ee29935c81c
2021-06-06 11:10:50 -07:00
Kermit b4cde15cdb remove defaultProps from picker of components (#31644)
Summary:
Remove `defaultProps` from `Picker` of components, replace it with destructuring assignment.

## Changelog

<!-- Help reviewers and the release process by writing your own changelog entry. For an example, see:
https://github.com/facebook/react-native/wiki/Changelog
-->

[JavaScript] [Changed] - Remove defaultProps from picker

close https://github.com/facebook/react-native/issues/31603

Pull Request resolved: https://github.com/facebook/react-native/pull/31644

Test Plan: all test suite and CI passes.

Reviewed By: TheSavior

Differential Revision: D28886320

Pulled By: lunaleaps

fbshipit-source-id: d88a922dffeebe2bce019250d460b5e43a0af562
2021-06-04 21:00:17 -07:00
Shuhao Zhang f3b8d4976f Bug fix: <TextInput> content is reset when emoji is entered at the max length
Summary:
When maxLength is defined in <TextInput>, if the last character at max length is an emoji, the content of the input is cleared:

{F620865178} {F620865237}

Related Github issues:

https://github.com/facebook/react-native/issues/10929
https://github.com/facebook/react-native/issues/10964

## Root cause:

When NSString was created, unicode characters were 16-bit long, so Objective-C considers every unicode character as 16-bit. However, unicode was later extended to more than 16bit, for example, emojis, which causes NSString substring method cuts off at the wrong position.

Example:

```
NSString *s = @"abc{emoji:1f601}";
NSInteger len = s.length; //length is 5 (as {emoji:1f601} occupies two 16-bit characters)
NSString *s3 = [s substringToIndex: 3]; //s3 is "abc"
NSString *s4 = [s substringToIndex: 4]; //s4 is null!
```

If string s, "abc{emoji:1f601}", is entered in <TextInput>, which has max length 4, it will truncate the string to the first 4 characters, "cutting" the emoji in half which causes encoding error and returns null. The text input is cleared.

## Solution:

If the character at max length is longer than 16-bit, truncate the character BEFORE it instead. In the previous example, truncate till index 3 instead of 4. The end result will be "abc" and the emoji is dropped.

## Changelog:

[iOS] [Fixed] - <TextInput> content is reset when emoji is entered at the max length

Reviewed By: p-sun

Differential Revision: D28821909

fbshipit-source-id: 4720d864970b554160ed5388f65b352ce95a6199
2021-06-04 13:40:42 -07:00
Nick Gerleman 41f145fa47 Add testID to NewAppScreen Header Component (#31652)
Summary:
The RN OSS release process includes manual testing that a new template app can be started under various platforms, JS engines, etc. This should ideally be automated, to help reduce wasted engineer-time, and to allow reliably increasing release velocity.

`react-native-windows` does already have tests to create and build template projects across our matrix, but they do not do any runtime validation on the newly created app. Adding a `testID` to the new app screen header gives us something to search for in black-box testing to validate that the app started successfully. This should help catch cases where a sample project in repo has changes not reflected in a newly created template app.

## Changelog

<!-- Help reviewers and the release process by writing your own changelog entry. For an example, see:
https://github.com/facebook/react-native/wiki/Changelog
-->

[Internal] [Added] - Add testID to NewAppScreen Header Component

Pull Request resolved: https://github.com/facebook/react-native/pull/31652

Test Plan: Did not manually validate the change, though did check that `ImageBackground` forwards props to `Image`, and that `Image` is aware of `testID` and will forward to the native component.

Reviewed By: kacieb

Differential Revision: D28907197

Pulled By: p-sun

fbshipit-source-id: db3974294afba25878383f1955cad37b69d95da3
2021-06-04 13:14:48 -07:00
Rubén Norte 249b8d21c4 Fix inline requires for ESM in react-native-github
Summary:
This fixes how ES modules are handled in Jest tests in the react-native codebase.

They caused some problems before because `import` statements weren't inlined as `require` calls were, so there were some errors in tests when migrating from CommonJS to ESM.

This changes the transform that Jest uses to inline import statements the same way, so we can migrate everything without issues in tests.

Changelog: [Internal]

Reviewed By: kacieb

Differential Revision: D28899692

fbshipit-source-id: 027690f57ca3b5613c261a1089c0635af76662b2
2021-06-04 13:05:11 -07:00
Kacie Bawiec 7f3f868020 Convert KeyboardAvoidingView to use export default
Summary:
Changelog:
[General][Changed] Convert KeyboardAvoidingView to use export default

Reviewed By: TheSavior

Differential Revision: D28884111

fbshipit-source-id: e2d144505536362b405b833c9ebad530f6dcacb5
2021-06-04 12:56:17 -07:00
Tim Yung 819b926beb Animated: Create Experimental Stub
Summary:
Creates an experimental stub implementation of `createAnimatedComponent` to be implemented in future commits.

Changelog:
[Internal]

Reviewed By: lunaleaps, kacieb

Differential Revision: D28799738

fbshipit-source-id: dc3fbee557db353de6807bd87561f8f372d7cab5
2021-06-02 22:36:13 -07:00
Tim Yung 8ccc4064c5 Animated: Setup Experiment Injection
Summary:
Sets up an injection mechanism for experimenting in production with an alternate implementation of `createAnimatedComponent`.

This will be used to implement and refine a new `createAnimatedComponent` that is compatible with concurrent rendering.

Changelog:
[Internal]

Reviewed By: lunaleaps

Differential Revision: D28799739

fbshipit-source-id: 46ba2dd6137f7bf73ce8a659698533ed3985516f
2021-06-02 22:36:13 -07:00
Håkon Knutzen 58444c74f5 Custom NSURLSession configuration (#27701)
Summary:
While it is possible in the React Native implementation for Android to provide a custom configuration for HTTP requests, the iOS implementation does not allow for the same customization. As the NSURLSession used for HTTP requests on iOS is configured internally, one may for instance not supply an ephemeral configuration for HTTP requests. Other concerns related to the given problem have been addressed in the community: https://github.com/react-native-community/discussions-and-proposals/issues/166. I did make a PR with an RFC in the community repo, but after some discussion in the said repo, I figured I might as well make a PR with a suggestion :)

## Changelog

[iOS] [Added] - Allow for configuring the NSURLSessionConfiguration

Implement a C function `RCTSetCustomNSURLSessionConfigurationProvider` which gives the app programmer the ability to provide a block which provides an NSURLSessionConfiguration that will be used for all HTTP requests instead of the default configuration. The provided block will be called when the session configuration is needed.

Pull Request resolved: https://github.com/facebook/react-native/pull/27701

Test Plan: Unsure if this can be tested in any other way than uncommenting the example code in `RNTester/RNTester/AppDelegate.mm`.

Reviewed By: yungsters

Differential Revision: D28680384

Pulled By: JoshuaGross

fbshipit-source-id: ae24399955581a1cc9f4202f0f6f497bfe067a5c
2021-06-02 18:39:52 -07:00
Janic Duplessis 1538fa4455 Fix Switch ref forwarding (#31629)
Summary:
Since moving Switch to a function component it is no longer possible to get the native switch ref. This adds forwardRef so it is possible again.

## Changelog

[General] [Fixed] - Fix Switch ref forwarding

Pull Request resolved: https://github.com/facebook/react-native/pull/31629

Test Plan: Tested the change in an app using react-native-gesture-handler, which tries to set a ref on Switch. Also made sure flow still passes.

Reviewed By: TheSavior

Differential Revision: D28839605

Pulled By: lunaleaps

fbshipit-source-id: 1fee86145caeabb60c0010bb9062dddca419f7ca
2021-06-02 14:44:52 -07:00
Tim Yung 249435c4d5 RN: Cleanup `collapsable` Experiment (iOS)
Summary:
With the conclusion of D27944688 (925af8ddea), this backs out the experiment introduced via D27987619 (f598dd0ee3).

Changelog:
[Internal]

Reviewed By: kacieb

Differential Revision: D28799741

fbshipit-source-id: 607ee85db26326e13dd8ddb52f5aebb732e9a354
2021-06-02 09:43:41 -07:00
Tim Yung e4a4c4d6d7 ExceptionsManager: Report Fatal "Warnings"
Summary:
As suggested by motiz88 on D28421692 (883e0d5752), make sure to still report fatal "warnings".

Changelog:
[General][Fixed] Report fatal errors even if its `type` is "warn".

Reviewed By: motiz88

Differential Revision: D28815228

fbshipit-source-id: 8d3b77958ef687a4ce64bdfccbf6ce2dc5557eaf
2021-06-02 01:31:50 -07:00
Tim Yung b85572af6e RN: Cleanup `TextInjection`
Summary:
Deletes `TextInjection` which is no longer needed.

Changelog:
[Internal]

Reviewed By: kacieb

Differential Revision: D28799740

fbshipit-source-id: 5dfbff23db3f73153aa0c3df25fec5acfb4977e4
2021-06-01 15:29:59 -07:00
Daniel Sainati 74d5d03dbd pre-suppress Flow errors in xplat ahead of 153 release
Summary:
This pre-suppresses the 153 error diff ahead of its release, since it is large.

Changelog: [Internal]

Reviewed By: mroch

Differential Revision: D28754374

fbshipit-source-id: 1806f53bc7d804644d434583a2dcd6da63d00328
2021-06-01 09:01:26 -07:00
Paige Sun 8a5ee96354 Remove log info when TurboModule cannot be found
Summary: Changelog: [Internal]

Reviewed By: rubennorte

Differential Revision: D28749474

fbshipit-source-id: 28079904023f23e88b4f5bca45d7e600171e929e
2021-05-27 10:42:34 -07:00