Summary:
This diff adds buttons to scroll to top and scroll to end to the invertStickyHeaders ScrollView test. This will allow programmatic scrolling to test sticky header behavior in end-to-end tests.
NOTE: This prop doesn't seem to work at all to invert the sticky header.
NOTE: There is also a bug where on first render, the sticky header does not "stick" correctly. My diff has not changed this and it seems to be a JS issue - I will investigate in another diff.
Changelog:
[General][Added] Added scroll buttons to invertStickyHeaders ScrollView test
Reviewed By: nadiia
Differential Revision: D26735461
fbshipit-source-id: 66db39ab9c9dbc9c62f50c5ff56db67a829f6db8
Summary:
# Changelog
[General][Added] - Expand example in RNTester for separators on VirtualizedSectionList to showcase updating props on separator ("has not been pressed" -> "has been pressed")
Reviewed By: nadiia, kacieb
Differential Revision: D26713429
fbshipit-source-id: 21034fab5a80d46c46462c41b0989cc9e4c45d03
Summary:
For better cross-platform consistency, migrate usages of NDEBUG to REACT_NATIVE_DEBUG. See flags.h for explanation.
Changelog: [Internal]
Reviewed By: PeteTheHeat
Differential Revision: D26695016
fbshipit-source-id: 63e6f6fc919076d94f04416f6821f21e0b3707a3
Summary:
Changelog: [Internal]
Adds react_debug dependency in Android.mk where it was missing
Reviewed By: mdvacca
Differential Revision: D26617400
fbshipit-source-id: 5ac799269b106eadd881d30490ac34bd2134a9b7
Summary:
allow-large-files
RN Tester is using an old version of Flipper. This will help testing regressions in the latest version (which is installed when starting a new project). This also fixes an issue where libevent is incompatible between the one in flipper and when using hermes on iOS. To fix it I changed to use the version published on cocoapods instead of using a local podspec (see https://github.com/facebook/flipper/issues/1916).
## Changelog
[General] [Changed] - Update flipper
Pull Request resolved: https://github.com/facebook/react-native/pull/31010
Test Plan:
- Tested that RN tester builds and flipper works with hermes enabled / disabled and fabric on iOS
- Tested that RN tester builds and flipper works on Android
Reviewed By: fkgozali
Differential Revision: D26592317
Pulled By: PeteTheHeat
fbshipit-source-id: 2cd278c7a51b1859dab0465846b061221f07d3f6
Summary:
Changelog: [Internal]
Debuggable flag defines multiple things for flavours including `NDEBUG` flag in native builds. We need to explicitly state this from build.gradle to use it.
Reviewed By: JoshuaGross
Differential Revision: D26610482
fbshipit-source-id: e0c8095e239241c57a119e561b125cab16bf299f
Summary:
Changelog:
[General][Added] - Added an example showcasing how separator callbacks work in SectionList for RNTester
Reviewed By: nadiia
Differential Revision: D26575122
fbshipit-source-id: 46710e2647c84bdf083265ce04ba330bd70eb2a7
Summary:
Changelog:
[Internal] - Use lazy task APIs in the Gradle new plugin
Gradle now migrates to [lazy task APIs](https://docs.gradle.org/current/userguide/lazy_configuration.html) to help with project configuration time. It helps even in the rn-tester case, e.g. `./gradlew help` executes in 2-3s instead of 20s.
The migration is quite simple - use `Provider` and `tasks.register` instead of `task.create` everywhere.
Reviewed By: mdvacca
Differential Revision: D25946748
fbshipit-source-id: 2ccd2f881afe7601e506dc7adcc8a658c7267328
Summary:
Changelog: [Internal]
Extracts task definition for bundling and hermes binary into separate tasks in the new plugin.
Reviewed By: mdvacca
Differential Revision: D25915057
fbshipit-source-id: b1d8a4b5e8789c3b7832efea13274435c9391ccb
Summary:
Changelog:
[Android][Added] - Basic definition for react gradle plugin
Adds plugin and build configuration + copies config from react.gradle to extension.
Copies internals of react.gradle to the plugin. Will be refactored in the next commits.
Reviewed By: mdvacca
Differential Revision: D25693008
fbshipit-source-id: b0feaa02cee8a1ee94d032426d19c501ff3b2534
Summary:
This prop is iOS only.
Changelog:
[iOS][Added] Add an example showing the prop contentInset in SectionList
Reviewed By: lunaleaps
Differential Revision: D26491787
fbshipit-source-id: 31398388081a22ccd17cc256aa174ffe7764e7a9
Summary:
BUCK always defines NDEBUG on Android builds. This is a longstanding issue and it's tricky to work around.
Previous attempts to fix this within React Native were difficult because disabling NDEBUG caused lots of issues that were difficult to track down.
Instead, I am (1) introducing a new RN_DEBUG flag that can be used cross-platform, (2) whenever NDEBUG is *not* enabled, RN_DEBUG will automatically be defined, (3) enables debug-only code to be compiled on Android, (4) enables us to selectively, slowly migrate `assert` to `rn_assert` in a way that doesn't impact non-Android platforms, but allows us to maintain stability of Android debug builds.
Actually enabling the RN_DEBUG flag in debug builds is done in FB-internal code. I assume the NDEBUG issue is not a problem when compiling in open-source without BUCK.
Changelog: [Internal]
Reviewed By: mdvacca
Differential Revision: D26409355
fbshipit-source-id: 285b8073bba3756834925727bfa28d3c6bc06335
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/30988
We have a bunch of flags scattered throughout the codebase with poor hygiene and commenting. Consolidate.
Changelog: [Internal]
Reviewed By: mdvacca
Differential Revision: D26392518
fbshipit-source-id: 2823de123a5009d6b8c358e8a3f451b9fa0e05b7
Summary:
Building ReactAndroid from source on Windows has recently hit the limitation of maximum path lengths.
At build time, during the `:ReactAndroid:buildReactNdkLib` task, the linker tries to access several of the intermediate binaries located deep in the tmp folder hierarchy, eg.
```
D:\r\ReactAndroid\build\tmp\buildReactNdkLib/local/armeabi-v7a/objs/react_render_components_progressbar/D_/r/ReactAndroid/__/ReactCommon/react/renderer/components/progressbar/android/react/renderer/components/progressbar/AndroidProgressBarMeasurementsManager.o
```
**Suggested fix:** for modules such as `react_render_components_progressbar` and `react_render_components_picker`, rename them to `rrc_progressbar` etc.
**NOTE**: this assumes that the fix from https://github.com/facebook/react-native/issues/30535 is in place. This regression happened while https://github.com/facebook/react-native/issues/30535 has been pending checkin.
**Other mitigations I've tried:**
- setting [`LOCAL_SHORT_COMMANDS`](https://developer.android.com/ndk/guides/android_mk#local_short_commands) for the problematic modules or `APP_SHORT_COMMANDS` for the root project. Turns out those commands don't work on the NDK version RN requires, but even after manually applying a [patch ](https://android-review.googlesource.com/c/platform/ndk/+/1126440) to my local copy of the NDK, these flags had no effect.
- moving the repo directory higher in the file system tree, and using short directory names `D:\r\...` was not enough
- creating virtual drive letters for specific long paths with the [`sust`](https://docs.microsoft.com/en-us/windows-server/administration/windows-commands/subst#examples) command is not workable, since they depend on the source folder structure, and get partly generated by the build system, which I can't plug into
- just enabling long path support on Windows is not enough, since the compiler toolchain doesn't support 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
-->
[Android] [Fixed] - Fix source build on Windows machines vol. 2
Pull Request resolved: https://github.com/facebook/react-native/pull/30776
Test Plan:
Run `.\gradlew installArchives`
Before:

Now:

Differential Revision: D26194286
Pulled By: mdvacca
fbshipit-source-id: 778b5a0515148e2ace19e7902f74301831ebed94
Summary:
Changelog:
[General][Changed] Refactor how we create test cases for SectionList and update some styling
Reviewed By: kacieb
Differential Revision: D26326600
fbshipit-source-id: d6f62f60fec9a5890db9d00c264b62123d3c723e
Summary:
Changelog:
[General][Internal] Added some test IDs for the TextIput examples.
Reviewed By: lunaleaps
Differential Revision: D26265361
fbshipit-source-id: 26d7a69f74f283daed2ddabaaf31113cd3089bf3
Summary:
Changelog:
[General][Internal] Added some test IDs and names for the TextIput examples.
Reviewed By: lunaleaps
Differential Revision: D26263554
fbshipit-source-id: 958a030eafbbed9076f49ab05585f30ddef3ef23
Summary:
Changelog:
[General][Added] - Show a test title if set and standardize the output
Note this will break existing screenshot tests so will need to re-run these
Reviewed By: nadiia
Differential Revision: D26318844
fbshipit-source-id: cef48d72a524ccc6f32b9d930c68fe4171270365
Summary:
Changelog:
[General][Changed] - Update RNTester example headers
* Removed platform availability on a example page
* Add the title of the example module since we aren't updating the native title bar
Since we already show platform information on the list of examples, it's redundant to show it again on the example page and this would give us more clearance for our examples below.
Where we already show platform information
| Android | iOS |
| {F370209520} | {F370209763} |
Reviewed By: nadiia, kacieb
Differential Revision: D26293966
fbshipit-source-id: a503db3703fc0c56a64c91880a83d222fe38faf4
Summary:
Changelog:
[General][Added] - Add more SectionList examples to RNTester
Move the examples we're using for e2e tests to RNTester as well
Reviewed By: nadiia, kacieb
Differential Revision: D26290719
fbshipit-source-id: c61ccd3034ac21c779c3a94e5c0febcfbf9897f7
Summary:
Fix eslint complaining about FileReader not being defined.
## 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 eslint complaining about FileReader not being defined.
Pull Request resolved: https://github.com/facebook/react-native/pull/30766
Reviewed By: TheSavior
Differential Revision: D26318564
Pulled By: PeteTheHeat
fbshipit-source-id: d08c040f872cca3cbb26e8bf753a1acb3931d294
Summary:
NativeModule getConstants() methods on Java might not be used within Java. So, they can be stripped by proguard. This diff adds the DoNotStrip annotation to the getConstants() method.
Changelog: [Internal]
Reviewed By: keoskate
Differential Revision: D26265874
fbshipit-source-id: b405ee32406e829212e5c9641750a6b5795899c3
Summary:
Changelog:
[Android][Changed] - Initial replacement of jcenter with mavenCentral.
Replaces jcenter with Maven Central in the build files of the repository.
Some dependencies are not resolvable from maven central yet, so for now they are included from jcenter, but limited to specific modules only.
I didn't touch the template for now.
Reviewed By: mdvacca
Differential Revision: D26260977
fbshipit-source-id: 2a65e1195b6367c026089184ad6471bf3573dc37
Summary:
Publish a new react-native-codegen release with latest changes in order to support the 0.64 react-native release.
Changelog:
[Internal]
Reviewed By: fkgozali
Differential Revision: D26253312
fbshipit-source-id: 766cfa3e088b3715bc9bc815523c8d04fae409bf
Summary:
This is an example from RNTester. I added a button in the ScrollView which can eat taps. This allows us to test the `keyboardShouldPersistTap` prop values for `ScrollView`, since there was no way to differentiate between "handled" and "always".
Expected behavior for each value of `keyboardShouldPersistTaps`:
* `"handled"` - The keyboard should dismiss if the ScrollView is tapped, but pressable components like buttons can eat taps (and not dismiss the keyboard)
* `"never"` - The keyboard should always dismiss when anything in the ScrollView is tapped. Buttons won't be pressed - the keyboard will dismiss instead.
* `"always"` - The keyboard should never dismiss. Buttons and other content in the ScrollView can be tapped.
Reviewed By: lunaleaps, nadiia
Differential Revision: D26228852
fbshipit-source-id: 1df78f0be10e2f2cc81e95548a6a6f7cab07894f
Summary:
Simplifies `AppState` by removing redundant methods and changing `addEventListener` to return an `EventSubscription`.
Changelog:
[General][Changed] - `AppState.addEventListener` now returns an `EventSubscription` object.
[General][Removed] - Removed `AppState.removeEventListener`. Instead, use the `remove()` method on the object returned by `AppState.addEventListener`.
[General][Removed] - `AppState` no longer inherits from `NativeEventEmitter`, so it no longer implements `addListener`, `removeAllListeners`, and `removeSubscription`.
Reviewed By: wtfil
Differential Revision: D26161343
fbshipit-source-id: b3cff76bf0f8f7d79cd954fdef551d0654c682ca
Summary:
We'll pass these ReactPackageTurboModuleManagerDelegate.Builders to ReactInstanceManager. ReactInstanceManager will then use these builders to initialize the TurboModule system. To allow TurboModules to work with RNTester, we have to switch RNTester over to using these Builders.
Changelog: [Internal]
Reviewed By: mdvacca
Differential Revision: D26193054
fbshipit-source-id: d98b857226be3ebaa22b1b734a4e76c0f4be6608
Summary:
Previously, owner(TurboModuleManager) used to depend on owner(ReactInstanceManager). Now, owner(ReactInstanceManager) depends on owner(TurboModuleManager).
**Rationale:** This allows ReactInstanceManager to create TurboModuleManager.
## Changes
We moved ReactPackageTurboModuleManagerDelegate to com.facebook.react.
Changelog: [Internal]
Reviewed By: mdvacca
Differential Revision: D26163661
fbshipit-source-id: 3ebff16ef2aa77e20bb55500ed44c9214acb91dd
Summary:
ES Modules implicitly enable strict mode. Adding the "use strict" directive is, therefore, not required.
This diff removes all "use strict" directives from ES modules.
Changelog:
[Internal]
Reviewed By: motiz88
Differential Revision: D26172715
fbshipit-source-id: 57957bcbb672c4c3e62b1db633cf425c1c9d6430
Summary:
This addesses a few issues I noticed while migrating my app to the new build-time codegen on iOS.
1. I noticed random failures because of codegen on iOS. This is mostly due to the fact the codegen output files are not specified in the xcode script. The only reason it works relatively fine currently is because the codegen output is inside the input files directory. This has the side effect of causing files to be regenerated every build, then causes all core modules to be recompiled which adds up a significant amount of time to rebuilds. To fix this I added the generated files to the script phase output and moved the FBReactNativeSpec dir outside of the codegen source (Libraries). I moved it to the React directory as this seemed to make sense and is where a lot of iOS files are as well as the core modules. Note this might require internal changes. This removes the circular dependency between our build phase input and output so consecutive builds can be cached properly.
2. Add `set -o pipefail` to the xcode script, this helped propagate errors properly to xcode because of the `| tee` pipe so it fails at the script phase and not later with a header not found error. Also add `2>&1` to pipe stderr to stdout so errors are also captured in the log file.
3. Add the `-l` flag to the bash invocation to help finding the yarn binary. With my setup yarn is added to the system PATH in my user .profile. Adding this file will cause bash to source the user environment which xcode scripts does not by default. I think this will help with most setups.
4. If yarn is not found the `command -v yarn` would make the script exit without any output because of the -e flag. I made a change to ignore the return code and check later if YARN_BINARY is set and have an explicit error message if not.
## Changelog
[iOS] [Fixed] - Make codegen more reliable on iOS
Pull Request resolved: https://github.com/facebook/react-native/pull/30792
Test Plan:
Tested various project states to make sure the build always succeeds in RN tester:
- Simulate fresh clone, remove all ignored files, install pods, build
- Build, delete FBReactNativeSpec generated files, build again
- Build, build again, make sure FBReactNativeSpec is cached and not rebuilt
- Make the script fail and check that xcode shows the script error logs properly

Note: Did not test fabric
Reviewed By: fkgozali
Differential Revision: D26104213
Pulled By: hramos
fbshipit-source-id: e18d9a0b9ada7c0c2e608d29ffe88087f04605b4
Summary:
This implements `SurfaceHandler`, a new primitive for controlling the Surface life-cycle that ensures ownership, preserves state, maintains internal invariants, and simplifies surface manipulation from the application side.
For now, all this is an unused code. The coming diff will introduce an experiment that will route all surfaceId-based APIs to SurfaceHandler-based ones.
Changelog: [Internal] Fabric-specific internal change.
Reviewed By: sammy-SC
Differential Revision: D24290777
fbshipit-source-id: f2ff2b58e6d46e971a548f9f02113a1c783c4940
Summary:
Running `.\gradlew installArchives` is currently broken on Windows. This is because .sh scripts were added in the codegen module, which cannot be run by the Command Prompt on Windows. It can be worked around by installing eg. Git Bash., which can be then leveraged using the code modifications in this PR, which include sanitizing mixed Linux-Windows relative paths, and other minor Windows-specific adjustments.
It's required that the user adds a Windows Environment variable storing the path to their bash binary named `REACT_WINDOWS_BASH`.
Pair-programmed with davinci26
## 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] [Fix] - Fix building React Android on Windows.
Fixes https://github.com/facebook/react-native/issues/30271
Pull Request resolved: https://github.com/facebook/react-native/pull/30535
Reviewed By: ShikaSD
Differential Revision: D25909760
Pulled By: appden
fbshipit-source-id: ea0e6e7c161a5e4a937d46e8e6972ce142fead4e
Summary:
Changelog: [internal]
If ShadowNode has not been mounted, forward rawProps from `sourceShadowNode` to newly cloned shadow node.
This is Android specific change, on iOS the logic should remain unchanged.
Reviewed By: JoshuaGross
Differential Revision: D26049264
fbshipit-source-id: 7c201bc2d4e99eec024065714d2172c5c817153c
Summary:
`sendAccessibilityEvent_unstable` is a cross-platform, Fabric/non-Fabric replacement for previous APIs (which went through UIManager directly on Android, and a native module on iOS).
Changelog: [Added] sendAccessibilityEvent_unstable API in AccessibilityInfo and sendAccessibilityEvent in React renderer
Reviewed By: kacieb
Differential Revision: D25821052
fbshipit-source-id: 03f7a9878c95e8395f9102b3e596bfc9f03730e0
Summary:
Use the name prop to render test cases.
Changelog:
[General][Changed] - Add optional name prop to RNTester examples
Reviewed By: lunaleaps
Differential Revision: D26078614
fbshipit-source-id: 82b13184aefee461c72b49c505f8848dd639eef0
Summary:
To ensure these Pojos don't get dead code eliminated, this diff adds a DoNotStrip annotation to each Props pojo object.
Changelog: [Internal]
Reviewed By: mdvacca
Differential Revision: D26041103
fbshipit-source-id: 02031f39f5fc5ef1bb9f11b729e68437bfe95452
Summary:
The Pojo data structure now keeps a flag `isRoot`, so that we can customize code-generation for the Props pojo vs its helper pojos.
In the following diff (i.e: D26041103), we'll add a DoNotStrip annotation to the props pojo. That doesn't need to exist on the helper pojos, because they'll all be referenced in the root props pojo.
Changelog: [Internal]
Reviewed By: mdvacca
Differential Revision: D26041102
fbshipit-source-id: ae2e1ba346d038853b5ff30cd5524a809ef97053
Summary:
## What This Does
- **Phase 1:** Given a component, convert its props (and all its ObjectTypeAnnotations) into this Pojo data structure under some namespace. This is a recursive operation.
- **Phase 2:** Loop over each Pojo data structure, and serialize it to Java class.
So...
- Each Component has its own namespace (i.e: its hasteModuleName) for Java Pojo objects.
- Each Component generates 1 Pojo object, for its props.
- Each Component generates 1 Pojo object for every ObjectTypeAnnotation in its props.
## Decisions
By design, [JNI can read/write to private properties on Java objects](https://stackoverflow.com/a/12208643). So, each Pojo, which represents an ObjectTypeAnnotation, contains only a private member variable for each of its properties, and a getter to retrieve the data from each of its private members.
## Todos
- Improved type-safety:
- ReservedTypeAnnotation (e.g: PointPrimitive). These currently map to ReadableMap.
- String enums, and Int enums don't actually generate Java enums.
- Verify if there are any compilation issues by wiring this up to the Codegen buck infra.
- To actually use the Pojos, we'll need C++/Jni codegen to transform C++ props into these Pojos. Building this out will give a more accurate assessment of the app-size cost of Pojos. However, we can do that if we deem that the app-size increase from adding just the Pojo classes is negligible enough to **not** rule out this entire approach.
- ~~Add some annotations to prevent these Pojo classes from being stripped at compile-time.~~ D26041103
Changelog: [Internal]
Reviewed By: mdvacca
Differential Revision: D26038189
fbshipit-source-id: c137c4ca6b043ee76adb354105aff6e0f270df86
Summary:
Fix eslint complaining about AbortController not being defined.
## 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
-->
Pull Request resolved: https://github.com/facebook/react-native/pull/30691
Reviewed By: TheSavior
Differential Revision: D25926479
Pulled By: mdvacca
fbshipit-source-id: aee7ef3e46331a389085e26eb3b601e9a6cf0910