A framework for building native macOS apps with React.
Перейти к файлу
Lulu Wu f207cfddf3 Add atomic registerSegment method to test
Summary:
In the top js errors there are 2 mids related to segment fetching:
- requireForFacebook.js:unknownModuleError (https://www.internalfb.com/logview/details/facebook_android_javascripterrors/ba11461526aff8a6842401b35b02f5a4), 11.64 K vs. 524
- asyncRequire.js:verifySegment (https://www.internalfb.com/logview/details/facebook_android_javascripterrors/5452ba893b8d9ba8e97e070cf6976b65) 5.39 K vs. 180

Both errors will result in surface not loading.

A lot of traces have logs similar with the following:

```11-01 19:57:51.166 27735  7626 W fb4a.BridgelessReact: registerSegment(segmentId = "1090", path = "/data/data/com.facebook.katana/app_overtheair/resources/412137089/414433453/hbc-seg-1090__DELIM__main.jsbundle")
11-01 19:57:51.167 27735  7445 I ReactNativeJS: Module 39122 in segment 0 doesn not exist moduleDefiner
11-01 19:57:51.171 27735  7445 E ReactNativeJS: Error: Requiring unknown module "39122"., js build: 414433453
11-01 19:57:51.175 27735  7445 E ReactNativeJS: Error: Segment meta module is not setup properly. Details: segmentId = 1090, metaModule === undefined
11-01 19:57:51.175 27735  7445 E ReactNativeJS:
11-01 19:57:51.175 27735  7445 E ReactNativeJS: This error is located at:
```

RegisterSegment lives through 3 threads while in bridge there are only 2 threads involved (native & JS):
- Native thread, log printed (fb4a.BridgelessReact: registerSegment...)
- Background thread: no log, added in this diff (Finish registerSegment...)
- JS thread: logs not printed, should print logs here:

https://www.internalfb.com/code/fbsource/[60521987354ed1ef9a0d10bafc60db3c25302ab4]/xplat/ReactNative/venice/ReactInstance.cpp?lines=308-330

Since the JS thread logs aren't printed and there are segment errors right after calling registerSegemnt, I think registerSegment is not done. It could be caused by:
- ReactInstance being null, I added logs in background thread to verify (Finish registerSegment...) since dispatching to background thread relies on non-nullable ReactInstance.
- Work on JS thread hasn't been executed when trying to use/verify the segment. I added atomic method ```registerSegmentAtomic``` to make sure JS thread is blocked until segment is fully registered.

```registerSegmentAtomic``` will be tested behind gating added in D40917444.

Changelog:
[Android][Changed] - Add feature flag enableAtomicRegisterSegment

Reviewed By: RSNara

Differential Revision: D40921759

fbshipit-source-id: 84221aa81f0c549f931a4847b154187299639ef4
2022-11-02 21:01:53 -07:00
.bundle Introduce Gemfile, ruby-version (#32303) 2021-10-01 21:22:26 -07:00
.circleci Cleanup the template documentation after RNGP & hermesEnabled to gradle.properties (#35108) 2022-10-27 14:40:27 -07:00
.github Make autorebase less restrictive (#34848) 2022-10-03 08:13:07 -07:00
IntegrationTests Codemod cycle annotations for xplat/js 2022-11-01 17:13:27 -07:00
Libraries Add JS stub for PerformanceObserver specs 2022-11-02 19:44:29 -07:00
React Local filenames with colon should be parsed correctly (#35123) 2022-11-02 19:00:07 -07:00
ReactAndroid Add atomic registerSegment method to test 2022-11-02 21:01:53 -07:00
ReactCommon Integrate Hermes with the Xcode build process 2022-11-01 11:55:41 -07:00
docs Generate doc info for RN components 2019-09-19 18:36:25 -07:00
flow Fix or expose previously hidden type errors to prepare for LTI mode 2022-10-22 12:32:34 -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 feat(jest): move Jest config to use a custom react-native Jest env (#34971) 2022-10-17 12:40:25 -07:00
keystores Use fb_native_wrapper for all targets 2018-10-31 11:47:42 -07:00
local-cli Update copyright headers from Facebook to Meta 2021-12-30 15:11:21 -08:00
packages Local filenames with colon should be parsed correctly (#35123) 2022-11-02 19:00:07 -07:00
repo-config bump codegen to v0.71.1 (#35154) 2022-10-31 12:31:00 -07:00
scripts cleanup publish-npm.js: --include-hermes is not used anywhere (#35166) 2022-11-02 20:59:03 -07:00
sdks/hermes-engine fix(local-e2e-script): add logic to handle maven local for iOS and Android accordingly (#35104) 2022-11-02 08:23:50 -07:00
template Sets the namespace via Gradle and not via AndroidManifest (#35094) 2022-10-29 06:35:38 -07:00
third-party-podspecs Remove remaining TV_OS fragments (#35110) 2022-10-28 02:50:49 -07:00
tools Add TurboModule code-gen support 2022-10-10 15:42:06 -07:00
types Fixup TS Organization (#35169) 2022-11-02 14:58:37 -07:00
.buckconfig Download kotlin compiler JARs for Buck instead of checking them in (#33209) 2022-03-02 13:04:49 -08:00
.buckjavaargs limiting BUCK's memory for CI 2016-02-01 10:49:33 -08:00
.clang-format Moving ObjC specific clang-format rules to the common config 2019-02-11 13:07:09 -08:00
.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 exact_empty_objects is on by default in 0.191, delete usage in fbsource 2022-10-31 15:31:29 -07:00
.flowconfig.android exact_empty_objects is on by default in 0.191, delete usage in fbsource 2022-10-31 15:31:29 -07:00
.gitignore Integrate Hermes with the Xcode build process 2022-11-01 11:55:41 -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 Circle CI macOS container to Xcode 14.0.1, Ruby to 2.7.6, CocoaPods 1.11.3 (#34884) 2022-10-11 18:27:25 -07:00
BUCK Add back deprecated prop-types 2022-10-26 22:03:19 -07:00
CHANGELOG.md add 0.70.3 changelog (#34958) 2022-10-12 09:07:22 -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 Circle CI macOS container to Xcode 14.0.1, Ruby to 2.7.6, CocoaPods 1.11.3 (#34884) 2022-10-11 18:27:25 -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 More licenses 2015-03-24 19:59:10 -07:00
README.md Update Expo domain to expo.dev (#34799) 2022-09-28 07:17:47 -07:00
React-Core.podspec Do not build JSI in React-jsi when Hermes is enabled, resolve JSI ODR violation (#35038) 2022-10-20 14:14:23 -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.1 (#35100) 2022-10-27 03:33:29 -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(react-native-github): remove AsyncStorage from JS 2022-10-31 14:39:19 -07:00
interface.js RN: Cleanup Existing ESLint Warnings 2022-08-12 17:16:40 -07:00
jest-preset.js feat(jest): move Jest config to use a custom react-native Jest env (#34971) 2022-10-17 12:40:25 -07: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 Bump RNGP to 0.71.8 2022-11-02 18:57:10 -07:00
react-native.config.js Upgrade RN CLI to v8 alpha (#33610) 2022-04-12 04:17:20 -07:00
react.gradle Deprecate react.gradle 2022-10-25 11:29:40 -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 Setup publishing for Snapshot and Stable on Maven (#34967) 2022-10-13 03:08:22 -07:00
template.config.js Update copyright headers from Facebook to Meta 2021-12-30 15:11:21 -08:00
yarn.lock Bump CLI to 10.0.0-alpha.2 2022-10-28 13:10:32 -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.