A framework for building native macOS apps with React.
Перейти к файлу
Ruslan Shestopalyuk 540ae39487 Fix race condition in RCTLoggingTests integration tests (#34858)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/34858

Changelog:

[iOS][Fixed] - Fix race condition in RCTLoggingTests integration tests

RCTLoggingTests work in the following way:
* Put a custom hook on logging (logging function) to intercept log messages
* Send several log messages via JS and see whether they hit the hook as expected

The problem with this approach was that there may be unexpected log messages, which squeeze inbetween the points of time when the hook was set and when the first message was sent.

There was a (now 6 years old!!!) fix to mitigate this problem, which was adding a lead pause of 2s to "make sure" that all the other possible log messages had been sent: https://github.com/facebook/react-native/pull/10568

That didn't actually guarantee fixing the problem in general, just partially mitigating it, as the race condition conceptually still remained there.

Here I take a different approach, which should guarantee that we skip all the rogue JS messages before we start sending and reading them on our own:
* Install the hook
* Log a "marker" message
* Pump the log until the marker appears - at this point we know that the hook has been definitely installed

Reviewed By: cipolleschi

Differential Revision: D40043442

fbshipit-source-id: b4aa617d27c2dcff26682dd72e47ec19cb0d11ca
2022-10-04 04:38:07 -07:00
.bundle Introduce Gemfile, ruby-version (#32303) 2021-10-01 21:22:26 -07:00
.circleci Back out "RN: Switch to `Choco-Install` from Windows Hermes CI" (#34818) 2022-09-29 07:22:39 -07:00
.github Make autorebase less restrictive (#34848) 2022-10-03 08:13:07 -07:00
IntegrationTests RN: Cleanup Existing ESLint Warnings 2022-08-12 17:16:40 -07:00
Libraries chore: add headers.Content-type to openFileInEditor call (#33517) 2022-10-03 10:32:29 -07:00
React Factor out feature flags for RN Fabric core 2022-10-03 05:38:31 -07:00
ReactAndroid Propagate common flag to autolinked libraries (#34853) 2022-10-04 04:18:53 -07:00
ReactCommon Re-add support for using Yoga without exceptions (#1006) 2022-10-03 23:35:46 -07:00
docs Generate doc info for RN components 2019-09-19 18:36:25 -07:00
flow Prepare for Jest 27+ by making legacy fake timer use explicit 2022-09-12 04:59:18 -07:00
flow-typed/npm RN: Normalize `flow-typed` Definitions 2022-09-30 14:28:48 -07:00
gradle Bump Gradle to 7.5.1 (#34359) 2022-08-08 04:03:59 -07:00
jest fix: adjust clipboard mock (#34672) 2022-09-16 08:54:05 -07:00
keystores
local-cli Update copyright headers from Facebook to Meta 2021-12-30 15:11:21 -08:00
packages Fix race condition in RCTLoggingTests integration tests (#34858) 2022-10-04 04:38:07 -07:00
repo-config chore(deps): bump CLI to 9.1.3 and Metro to 0.72.3 (#34803) 2022-09-30 06:22:21 -07:00
scripts Fix issues for nightly build (#34846) 2022-10-03 08:16:16 -07:00
sdks/hermes-engine Fix issues for nightly build (#34846) 2022-10-03 08:16:16 -07:00
template Cleanup the template after prefab support (#34843) 2022-10-04 03:27:07 -07:00
third-party-podspecs bump RTC-Folly to 2021.07.22 (#33841) 2022-06-21 12:36:43 -07:00
tools RN: Enforce `flow-typed` Signatures 2022-09-30 14:28:48 -07:00
types Sync new changes in @types/react-native (TextProps, TouchableWithoutFeedbackProps) (#34794) 2022-10-03 08:01:20 -07:00
.buckconfig Download kotlin compiler JARs for Buck instead of checking them in (#33209) 2022-03-02 13:04:49 -08:00
.buckjavaargs
.clang-format
.editorconfig Revert removal of CRLF from Windows bat files (#31398) 2021-09-09 22:44:32 -07:00
.eslintignore RN: Enforce `flow-typed` Signatures 2022-09-30 14:28:48 -07:00
.eslintrc.js RN: Enforce `flow-typed` Signatures 2022-09-30 14:28:48 -07:00
.flowconfig Deploy 0.188.1 to xplat 2022-09-29 23:11:09 -07:00
.flowconfig.android Deploy 0.188.1 to xplat 2022-09-29 23:11:09 -07:00
.gitignore Fix missing renames from bots to react-native-bots (#34713) 2022-09-16 12:41:06 -07:00
.node-version Added files for node version in reactive native project (#34171) 2022-07-11 06:20:58 -07:00
.prettierrc JS: Upgrade to Prettier v2.4.1 [1/n] 2021-11-02 22:14:16 -07:00
.ruby-version Bump ruby to 2.7.5 (#33485) 2022-04-12 07:59:52 -07:00
BUCK add link group label to fbios deps 2022-09-22 22:52:22 -07:00
CHANGELOG.md add 0.69.6 changelog (#34798) 2022-09-27 06:34:10 -07:00
CODE_OF_CONDUCT.md docs: add new version convenant contribuitor guide link (#32107) 2021-08-30 10:18:11 -07:00
CONTRIBUTING.md Update CONTRIBUTING.md, replace wiki links (#34035) 2022-06-21 19:30:23 -07:00
ECOSYSTEM.md Updates to ecosystem.md do clarify community roles (#34341) 2022-09-26 14:27:11 -07:00
Gemfile Bump ruby to 2.7.5 (#33485) 2022-04-12 07:59:52 -07:00
Gemfile.lock RN: Upgrade CocoaPods Dependencies 2022-09-29 17:02:46 -07:00
LICENSE Update copyright headers from Facebook to Meta 2021-12-30 15:11:21 -08:00
LICENSE-docs
README.md Update Expo domain to expo.dev (#34799) 2022-09-28 07:17:47 -07:00
React-Core.podspec Fix hermes executor not available when use_frameworks is enabled (#34222) 2022-07-27 07:12:16 -07:00
React.podspec bump iOS and tvOS from 11.0 to 12.4 in cocoapods 2022-03-16 21:08:01 -07:00
build.gradle.kts Bump AGP to 7.3.0 inside ReactAndroid (#34707) 2022-09-20 10:30:40 -07:00
cli.js Update copyright headers from Facebook to Meta 2021-12-30 15:11:21 -08:00
gradle.properties Do not specify a Kotlin version in the RN rootProject (#33589) 2022-04-08 03:44:56 -07:00
gradlew bump gradle to 7.3 (#32588) 2021-11-15 06:47:39 -08:00
gradlew.bat Re-sync with internal repository (#32212) 2021-09-15 10:45:06 +01:00
index.js refactor: Convert Animated directory to use ESModule imports/exports (#34539) 2022-09-20 10:05:48 -07:00
interface.js RN: Cleanup Existing ESLint Warnings 2022-08-12 17:16:40 -07:00
jest-preset.js Update copyright headers from Facebook to Meta 2021-12-30 15:11:21 -08:00
jest.config.js Update to Jest 29 (#34724) 2022-09-20 14:15:50 -07:00
metro.config.js Blacklist sdks/hermes from Metro resolution (#34452) 2022-08-19 02:32:02 -07:00
package.json Fix broken template tests due to missing boost headers (#34829) 2022-09-30 14:25:41 -07:00
react-native.config.js Upgrade RN CLI to v8 alpha (#33610) 2022-04-12 04:17:20 -07:00
react.gradle Fix detectCliPath check for cliJsFromNode (#34808) 2022-10-03 04:22:45 -07:00
rn-get-polyfills.js Update copyright headers from Facebook to Meta 2021-12-30 15:11:21 -08:00
runXcodeTests.sh Use realpath instead of readlink 2022-02-22 02:23:02 -08:00
settings.gradle.kts Remove :packages:react-native-codegen:android from top level settings (#34579) 2022-09-13 04:07:44 -07:00
template.config.js Update copyright headers from Facebook to Meta 2021-12-30 15:11:21 -08:00
yarn.lock chore(deps): bump CLI to 9.1.3 and Metro to 0.72.3 (#34803) 2022-09-30 06:22:21 -07:00

README.md

React Native

Learn once, write anywhere:
Build mobile apps with React.

React Native is released under the MIT license. Current CircleCI build status. Current npm package version. PRs welcome! Follow @reactnative

Getting Started · Learn the Basics · Showcase · Contribute · Community · Support

React Native brings React's declarative UI framework to iOS and Android. With React Native, you use native UI controls and have full access to the native platform.

  • Declarative. React makes it painless to create interactive UIs. Declarative views make your code more predictable and easier to debug.
  • Component-Based. Build encapsulated components that manage their state, then compose them to make complex UIs.
  • Developer Velocity. See local changes in seconds. Changes to JavaScript code can be live reloaded without rebuilding the native app.
  • Portability. Reuse code across iOS, Android, and other platforms.

React Native is developed and supported by many companies and individual core contributors. Find out more in our ecosystem overview.

Contents

📋 Requirements

React Native apps may target iOS 12.4 and Android 5.0 (API 21) or newer. You may use Windows, macOS, or Linux as your development operating system, though building and running iOS apps is limited to macOS. Tools like Expo can be used to work around this.

🎉 Building your first React Native app

Follow the Getting Started guide. The recommended way to install React Native depends on your project. Here you can find short guides for the most common scenarios:

📖 Documentation

The full documentation for React Native can be found on our website.

The React Native documentation discusses components, APIs, and topics that are specific to React Native. For further documentation on the React API that is shared between React Native and React DOM, refer to the React documentation.

The source for the React Native documentation and website is hosted on a separate repo, @facebook/react-native-website.

🚀 Upgrading

Upgrading to new versions of React Native may give you access to more APIs, views, developer tools, and other goodies. See the Upgrading Guide for instructions.

React Native releases are discussed in this discussion repo.

👏 How to Contribute

The main purpose of this repository is to continue evolving React Native core. We want to make contributing to this project as easy and transparent as possible, and we are grateful to the community for contributing bug fixes and improvements. Read below to learn how you can take part in improving React Native.

Code of Conduct

Facebook has adopted a Code of Conduct that we expect project participants to adhere to. Please read the full text so that you can understand what actions will and will not be tolerated.

Contributing Guide

Read our Contributing Guide to learn about our development process, how to propose bugfixes and improvements, and how to build and test your changes to React Native.

Open Source Roadmap

You can learn more about our vision for React Native in the Roadmap.

Good First Issues

We have a list of good first issues that contain bugs which have a relatively limited scope. This is a great place to get started, gain experience, and get familiar with our contribution process.

Discussions

Larger discussions and proposals are discussed in @react-native-community/discussions-and-proposals.

📄 License

React Native is MIT licensed, as found in the LICENSE file.

React Native documentation is Creative Commons licensed, as found in the LICENSE-docs file.