Commit Graph

12270 Commits

Author SHA1 Message Date
Kacie Bawiec fb0a7edd6c Add scroll buttons to invertStickyHeaders ScrollView test
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
2021-03-03 15:34:36 -08:00
Luna Wei ede065c8b0 SectionList example add updateProps to example
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
2021-03-03 01:10:50 -08:00
Joshua Gross ee98e6a493 ReactCommon/nativemodule: Migrate uses of NDEBUG to REACT_NATIVE_DEBUG + react_native_assert
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
2021-02-26 21:20:25 -08:00
Andrei Shikov ac704690dc Update Android.mk to ensure the rn-tester compiles in debug mode
Summary:
Changelog: [Internal]

Adds react_debug dependency in Android.mk where it was missing

Reviewed By: mdvacca

Differential Revision: D26617400

fbshipit-source-id: 5ac799269b106eadd881d30490ac34bd2134a9b7
2021-02-24 12:29:00 -08:00
Janic Duplessis 3399896ae7 Update flipper in RNTester and template (#31010)
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
2021-02-24 12:23:27 -08:00
Andrei Shikov 36ca57ee25 Mark rn tester flavours as debuggable
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
2021-02-23 13:23:31 -08:00
Luna Wei 174372c178 SectionList Separators Example
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
2021-02-22 17:06:22 -08:00
Andrei Shikov c6d7af60fa Use lazy configuration APIs in the react app plugin
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
2021-02-22 08:16:52 -08:00
Andrei Shikov 959e135d80 Extract bundle task
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
2021-02-22 08:16:51 -08:00
Andrei Shikov dbbc1c1624 Add react build app plugin and extension
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
2021-02-22 08:16:51 -08:00
Peter Argany f0faa7843c Remove iOS10/tvOS10 support from remaining podfiles
Summary: Changelog: [iOS] Remove iOS10/tvOS10 support from remaining podfiles

Reviewed By: shergin

Differential Revision: D26410811

fbshipit-source-id: 9050346def5070338e709ff102a284a828821586
2021-02-19 13:47:25 -08:00
Kacie Bawiec 28fb41a0ab Add an example showing the prop contentInset in SectionList
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
2021-02-17 20:40:20 -08:00
Joshua Gross ec4833f06d Introduce RN_DEBUG flag and rn_assert for Cxx
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
2021-02-17 18:00:47 -08:00
Joshua Gross fb1833eede Consolidate various debug-only flags into flags.h (#30988)
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
2021-02-17 18:00:47 -08:00
Igor Klemenski c37d49492b Work around max path length during source build of RN Android (#30776)
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:
![image](https://user-images.githubusercontent.com/12816515/105435667-a1e15d00-5c12-11eb-9fcd-d0c278aaf477.png)
Now:
![image](https://user-images.githubusercontent.com/12816515/105435741-c2a9b280-5c12-11eb-88d5-a69ae56bbf50.png)

Differential Revision: D26194286

Pulled By: mdvacca

fbshipit-source-id: 778b5a0515148e2ace19e7902f74301831ebed94
2021-02-11 12:32:33 -08:00
Luna Wei 49f5d148a7 Add inverted test case
Summary:
Changelog:
[General][Added] - Add inverted example for SectionList in RNTester

Reviewed By: kacieb

Differential Revision: D26333023

fbshipit-source-id: 43ca139a725b7b5d269150d2d56b7b57124a69e0
2021-02-10 19:18:24 -08:00
Luna Wei 575e23eb2a Add stickyHeadersEnabled example
Summary:
Changelog:
[General][Added] - [RNTester] Add stickyHeadersEnabled example

Reviewed By: kacieb

Differential Revision: D26333022

fbshipit-source-id: 37c869bbd25e4d6a090b53b1cffdf236ac27a8f3
2021-02-10 19:18:24 -08:00
Luna Wei 2e8b5df7b7 Refactor SectionList examples
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
2021-02-10 19:18:23 -08:00
Nadiia D 7d4612b076 Add testIDs and names to Animated examples
Summary:
Changelog:
[General][Internal] - Add testIDs to the Animated examples.

Reviewed By: kacieb

Differential Revision: D26312729

fbshipit-source-id: c9131bb0fda1533d78dd6cf61d8c604053c7884f
2021-02-09 21:07:52 -08:00
Nadiia D 2c19d85285 TextInput: test cursor placement
Summary:
Changelog:
[General][Internal] Added some test IDs for the TextIput examples.

Reviewed By: lunaleaps

Differential Revision: D26265361

fbshipit-source-id: 26d7a69f74f283daed2ddabaaf31113cd3089bf3
2021-02-09 21:07:52 -08:00
Nadiia D 05b54cbee9 TextInput: create shared test utils
Summary:
Changelog:
[General][Internal] Added some test IDs and names for the TextIput examples.

Reviewed By: lunaleaps

Differential Revision: D26263554

fbshipit-source-id: 958a030eafbbed9076f49ab05585f30ddef3ef23
2021-02-09 21:07:51 -08:00
Luna Wei 16efb8dd52 Render test titles and standardize on output
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
2021-02-09 11:59:52 -08:00
Luna Wei 7f5ec15009 Update RNTester example headers
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
2021-02-08 17:08:43 -08:00
Luna Wei 4ed54c6411 Move SectionList examples to RNTester
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
2021-02-08 17:08:43 -08:00
maltoze 35b6d2e52b Add FileReader to eslint globals (#30766)
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
2021-02-08 12:23:08 -08:00
Ramanpreet Nara cba6aba2e6 Add @DoNotStrip annotation to getConstants()
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
2021-02-05 11:48:30 -08:00
Andrei Shikov 704dd2812f Replace jcenter with mavenCentral when possible
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
2021-02-05 05:17:32 -08:00
Héctor Ramos edf18c74ce Bump react-native-codegen to 0.0.7
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
2021-02-04 17:35:57 -08:00
Kacie Bawiec f0ed1e8201 Add to an RNTester ScrollView example a TextInput and a Button to test keyboardShouldPersistTaps
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
2021-02-04 12:48:13 -08:00
Tim Yung 6f22989e92 RN: Simplify AppState
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
2021-02-04 12:48:13 -08:00
Ramanpreet Nara 13f100f788 Move TurboModuleManager creation into ReactInstanceManager
Summary:
See title.

Changelog: [Android][Changed] - Move TurboModuleManager creation into ReactInstanceManager

Reviewed By: mdvacca

Differential Revision: D26193053

fbshipit-source-id: fe92636f0cb3dca65fa919ac5df8931b693f76c5
2021-02-02 20:50:31 -08:00
Ramanpreet Nara 48e4e34107 Give RNTesterTurboModuleManagerDelegate a Builder
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
2021-02-02 20:50:30 -08:00
Ramanpreet Nara 2a1b5193f7 Allow ReactInstanceManager to create TurboModuleManager
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
2021-02-02 20:50:30 -08:00
Micha Reiser 93377ff508 Remove "use strict" directive from ES Modules
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
2021-02-02 11:12:56 -08:00
Janic Duplessis 12fccdeea3 Make codegen more reliable on iOS (#30792)
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

![image](https://user-images.githubusercontent.com/2677334/105891571-c8badd00-5fde-11eb-839c-259d8e448523.png)

Note: Did not test fabric

Reviewed By: fkgozali

Differential Revision: D26104213

Pulled By: hramos

fbshipit-source-id: e18d9a0b9ada7c0c2e608d29ffe88087f04605b4
2021-02-01 14:39:25 -08:00
Nadiia D f5f69af87f Change test file names to align with the set convention
Summary:
Changelog:
[General][Changed] Change RNTester example name

Reviewed By: lunaleaps

Differential Revision: D26129706

fbshipit-source-id: 53e906f26dd18ef8bceca2e3700e3403e3d0421a
2021-01-29 10:15:42 -08:00
Valentin Shergin 7a290d1596 Fabric: Introducing SurfaceHandler
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
2021-01-29 07:54:19 -08:00
Igor Klemenski 5dc15222b2 Fix building RN Android from source on Windows. (#30535)
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
2021-01-28 11:53:56 -08:00
Samuel Susla fc1f0df465 Introducing: Props forwarding whe cloning shadow node
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
2021-01-28 11:21:21 -08:00
Joshua Gross 99b7052248 Implement sendAccessibilityEvent in the React(Fabric/non-Fabric) renderer
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
2021-01-27 17:37:38 -08:00
Kacie Bawiec 2840e8abf9 Add testIDs to first example in ScrollViewExample
Summary: Changelog: Internal

Reviewed By: nadiia

Differential Revision: D26075302

fbshipit-source-id: 921700c185e9ca9c2608fa18af83b7dca2d18346
2021-01-27 11:46:28 -08:00
Nadiia D 6661517162 add optional name prop to RNTester example
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
2021-01-27 03:11:26 -08:00
Ramanpreet Nara e08681cf79 Add @DoNotStrip annotations to root Pojos
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
2021-01-26 17:07:01 -08:00
Ramanpreet Nara 19ef415895 Distinguish root Pojos from non-root Pojos
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
2021-01-26 17:07:00 -08:00
Ramanpreet Nara 6506f7a680 Remove @Nullable annotation from ArrayList element types
Summary: Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D26051159

fbshipit-source-id: 54315dc505a4fb4e595847902caf501b4ecd77e2
2021-01-26 17:07:00 -08:00
Ramanpreet Nara 8461409e88 Generate pojo for Component Props
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
2021-01-26 17:07:00 -08:00
Ramanpreet Nara dc0b917fb5 Preserve directory structure in android zip
Summary:
The Codegen runs on all JavaScript specs, generating C++/Java/Jni, etc. Then, we copy only the Java files into a directory:

https://www.internalfb.com/intern/diffusion/FBS/browsefile/master/xplat/js/react-native-github/packages/react-native-codegen/DEFS.bzl?commit=3945e905d6636c005af77d29b7f45ef7b1efe00e&lines=340-347

And zip that directory up, before [creating an android_library with that zip](https://www.internalfb.com/intern/diffusion/FBS/browsefile/master/xplat/js/react-native-github/packages/react-native-codegen/DEFS.bzl?commit=3945e905d6636c005af77d29b7f45ef7b1efe00e&lines=395-414%2C442-452%2C415-442):

https://www.internalfb.com/intern/diffusion/FBS/browsefile/master/xplat/js/react-native-github/packages/react-native-codegen/DEFS.bzl?commit=3945e905d6636c005af77d29b7f45ef7b1efe00e&lines=365-371

**Problem:** We unnecessarily flatten the directory structure of all our Java files.

This diff moves all the files under the java/ folder of the Codegen output into the zip that is used to create the android_library. This way, we avoid filename collisions between two Pojos belonging to two different components (with different packages), but that have the same name.

Changelog: [Internal]

Differential Revision: D26050260

fbshipit-source-id: f92e916cd640a688997dd75c2707d77cb15de083
2021-01-26 17:07:00 -08:00
Ramanpreet Nara 8053385a12 Fix Boolean to JNI type
Summary:
We were missing a semicolon.

Changelog: [Internal]

Reviewed By: JoshuaGross, shergin

Differential Revision: D26087583

fbshipit-source-id: 8ec74cf1cba40899fba063e6c93a8d6002c3422d
2021-01-26 16:50:39 -08:00
Andrei Shikov 9f7bd62f6c Back out "Add codegen debug logging to check CI issues"
Summary: Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D25995374

fbshipit-source-id: 2b08c7023e19db74f741401b3aed8ad5eb0e23e7
2021-01-25 15:22:02 -08:00
maltoze 2aab894acf Add AbortController to eslint globals (#30691)
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
2021-01-23 13:37:39 -08:00