Summary:
Changes `Dimensions.addEventListener` to return an `EventSubscription` object that has a `remove()` method on it.
In an upcoming commit, calling `Dimensions.removeEventListener` will lead to a deprecation warning.
Changelog:
[General][Change] - `Dimensions.addEventListener` now returns an `EventSubscription`.
Reviewed By: kacieb
Differential Revision: D26808827
fbshipit-source-id: 0cfdc65b83c177f60937c1aa3a4cf633592f73d7
Summary:
This NativeModule will now be type-safe, and TurboModule-compatible.
Changelog: [Internal]
Reviewed By: fkgozali
Differential Revision: D26956332
fbshipit-source-id: 6651a003c70819934869dd6a8c664ef984d0efcb
Summary:
Add a stickyHeaderHiddenOnScroll option to keep the sticky header hidden during scrolling down, and only slide in when scrolling up
Changelog:
[General][Added] - Add a stickyHeaderHiddenOnScroll option to keep the sticky header hidden during scrolling down, and only slide in when scrolling up
Reviewed By: JoshuaGross
Differential Revision: D26900810
fbshipit-source-id: 6bfb1a4da07fff0763223d60836df187f9d95dd6
Summary:
This diff creates a new unstable method (unstable_hasComponent) to expose `global.__nativeComponentRegistry__hasComponent` into NativeComponentRegistry.js
changelog: [internal] internal
Reviewed By: yungsters
Differential Revision: D26716903
fbshipit-source-id: 52ff63b2779f41770b292cfc0b9022b1669d59fe
Summary:
This diff migrates AndroidDropdownPicker to use NativeComponentRegistry instead of requireNativeComponent. The intention is to unify the way the component is registered and enable StaticViewConfigs for this component
changelog: [internal] internal
Reviewed By: yungsters
Differential Revision: D26810196
fbshipit-source-id: 7be0396d49d9e1413d424ab1be035cbb6a211706
Summary:
This diff migrates AndroidDialogPicker to use NativeComponentRegistry instead of requireNativeComponent. The intention is to unify the way the component is registered and enable StaticViewConfigs for this component
changelog: [internal] internal
Reviewed By: yungsters
Differential Revision: D26799476
fbshipit-source-id: d6605f60cc083d1d22b4f0fc0a2f79881502b1b4
Summary:
This diff migrates RCTPicker to use NativeComponentRegistry instead of requireNativeComponent. The intention is to unify the way the component is registered and enable StaticViewConfigs for this component
changelog: [internal] internal
Reviewed By: yungsters
Differential Revision: D26799477
fbshipit-source-id: 2f5935e0a4796c7a76921762a087cf7823ebd62e
Summary:
Changelog: [internal]
Add missing implementation of caretHidden to multiline text input. This will work for both React Native Classic and New React Native Renderer.
Reviewed By: shergin
Differential Revision: D26818087
fbshipit-source-id: 3597604a6bd414a4a3b292d809d63a18efa8acb3
Summary:
Debugging with not having Metro console.log() working in Venice is inconvenient.
After PeteTheHeat's fixes in diff series D26624224 the ground issues should be gone, so I tried removing the guard for Android and it worked.
The only issue I found is that when connected to Hermes Debugger in Flipper it keeps refreshing (reloading?), I posted here https://fb.workplace.com/groups/2308952995990093/permalink/2899448643607189/, with this found, I think it's a good start to iterate on since there are no crashes and this would help us a lot on Venice debugging.
Changelog:
[Android][Changed] - Remove developer tool guard for android
Reviewed By: PeteTheHeat
Differential Revision: D26779418
fbshipit-source-id: 96bb18771e01a25f84f845833a4f71e70433ef2b
Summary:
Changes `Appearance.addChangeListener` to return an `EventSubscription` object that has a `remove()` method on it.
In an upcoming commit, calling `Appearance.removeChangeListener` will lead to a deprecation warning.
Changelog:
[General][Change] - `Appearance.addChangeListener` now returns an `EventSubscription`.
Reviewed By: kacieb
Differential Revision: D26696388
fbshipit-source-id: d0bdeffff3a2a366b3c11b6dc1417dfb2f1455c2
Summary:
# The bug
Sticky headers would not "stick" to the top of the ScrollView on initial render. On subsequent redners, all sticking would work correctly.
# Why the bug existed
This code to initialize the animated values used for sticky headers was in `UNSAFE_componentWillMount` prior to D26375818 (1641d46529). `UNSAFE_componentWillMount` is called before `render`.
In D26375818 (1641d46529), I moved the code into `componentDidMount`, which is called after `render`.
This caused a problem because code in `render` was relying on these initializations being done already.
# How I resolved the bug
To resolve this, I initialize these values in the constructor.
# Reference
Docs for React mount ordering: https://reactjs.org/docs/react-component.html#mounting
Changelog:
[General][Fixed] Fix sticky header not sticking on first render in ScrollView
Reviewed By: nadiia
Differential Revision: D26792003
fbshipit-source-id: c575e8cdd1d986ce3c38941d95d763e329e74874
Summary:
Changelog:
[General][Changed] Hide caret in the TextInput during test runs.
Reviewed By: lunaleaps
Differential Revision: D26728766
fbshipit-source-id: b75827f00b4d5c6243d93106093f97b40dc4b366
Summary:
`React.ElementRef<HostComponent<mixed>>` is an inexact object type, which can not be spread into an exact object type, as is happening here. This error is masked in types-first mode, but causes the instance type of this component to be `any`. In a future version of Flow, this issue will be fixed, so this change unblocks upgrading Flow.
This change is likely to cause code using `TextInput` refs to find errors which were missed before.
Changelog:
[General][Fixed] - Fixed Flow typing of TextInput refs
Reviewed By: yungsters
Differential Revision: D26733314
fbshipit-source-id: 8aa26ce5b49357b279f76dd1767a17a9fb4dd4f1
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:
This diff broke scrolling on Profile React Native surfaces. Please see the task for repro steps. Backing this out.
Changelog:
[General][Changed] - Back out "React Native sync for revisions c3e20f1...4d28eca"
build-break
overriding_review_checks_triggers_an_audit_and_retroactive_review
Oncall Short Name: fbandroid_sheriff
Reviewed By: JoshuaGross
Differential Revision: D26708096
fbshipit-source-id: 40f1e7473b8cc041073b2658d46f9500281da99e
Summary:
We recently fixed RTL scrolling in Fabric on iOS: D26608231 (e5921f7f38)
Turns out, the mechanism for RTL scrolling on Android is completely different. It requires that content be wrapped in a "directional content view", which is `View` in LTR and `AndroidHorizontalScrollContentView` in RTL, backed by `ReactHorizontalScrollContainerView.java`.
iOS doesn't require that and just uses View and some custom logic in ScrollView itself.
In the future it would be great to align the platforms, but for now, for backwards-compat with non-Fabric and so we don't have to tear apart ScrollView.js, we codegen the AndroidHorizontalScrollContentView so it exists in C++, register the component, and stop mapping it to View explicitly in C++.
Changelog: [Internal]
Reviewed By: sammy-SC
Differential Revision: D26659686
fbshipit-source-id: 3b9c646dbdb7fe9527d24d42bdc6acb1aca00945
Summary:
Changelog:
[General][Added] - Added `debugName` parameter to `renderApplication` to use as the display name for the React root tree
Reviewed By: rickhanlonii
Differential Revision: D26637787
fbshipit-source-id: 3ddc037573f4434101a9d3dcb5592a127193481c
Summary:
"The instance should not stick around after unmount..." - Tim Yung, 2021
I have a hypothesis that, if a component instance of an animated component sticks around after unmount, it could cause memory leaks due to references to Fabric ShadowNodes across the JSI (this would not impact non-Fabric... in theory).
Wild guess. If OOMs disappear then maybe this hypothesis is correct, but it's a long shot. I figure there's ~no harm in doing this cleanup here anyway.
Changelog: [Internal]
Reviewed By: sammy-SC
Differential Revision: D26650348
fbshipit-source-id: 90633db650b65755cacfb52344e7b53e46c9b125
Summary:
There's logic in Animated JS that prevents flattening of animated views in Fabric. However, we cannot actually detect Fabric vs non-Fabric in the first render pass; in the past we defaulted to assuming non-Fabric. Now we assume Fabric for View flattening purposes.
Changelog: [Internal]
Reviewed By: shergin
Differential Revision: D26647393
fbshipit-source-id: c91b51aeeb4f352cc502bc018f086e36fd1ffd85
Summary:
This PR fixes few suppressed Flow issues in `VirtualizedList` component.
I have also removed few no longer valid Flow suppressions in `ActivityIndicator` and `ReactNativeTestTools`.
## Changelog
[General] [Fixed] - Flow: fix few issues in `VirtualizedList`,
[General] [Removed] - Flow: remove few no longer valid suppressions in `ReactNativeTestTools`
Pull Request resolved: https://github.com/facebook/react-native/pull/30128
Test Plan: Successful run of `yarn flow` check.
Reviewed By: kacieb
Differential Revision: D26489398
Pulled By: lunaleaps
fbshipit-source-id: db71d8bfeb3b6dc5a2738a73ac6644aef4a0311b
Summary:
Changelog: [Internal]
I'm trying to get Fast refresh working in bridgeless mode. I need the ` require('./setUpReactRefresh');` line to be executed to do so.
I'm not sure why this was commented out in the first place, it seems to be working fine in FBiOS/FB4A.
Reviewed By: p-sun
Differential Revision: D26289573
fbshipit-source-id: 6151f781c31e3aadaebfeb759d3eb776e8b525cc
Summary:
This diff removes `UNSAFE_componentWillReceiveProps` and adds the changes to `componentDidUpdate` instead.
Why use `componentDidUpdate`? When reading through the [React docs on removing UNSAFE_componentWillReceiveProps](https://reactjs.org/docs/react-component.html#unsafe_componentwillreceiveprops), it says:
> If you need to perform a side effect (for example, data fetching or an animation) in response to a change in props, use componentDidUpdate lifecycle instead.
The original usage of `UNSAFE_componentWillReceiveProps` updates the content inset when `props.contentInset` changes. However, we don't always want it to update if the content inset hasn't changed, as calling `setValue` will reset the animated value unnecessarily, and kill any current animations (which we don't want to do). [React Native doc on setValue for reference](https://reactnative.dev/docs/animatedvalue#setvalue).
Changelog:
[General] Use componentDidUpdate instead of UNSAFE_componentwillReceiveProps in ScrollView
Reviewed By: lunaleaps
Differential Revision: D26487276
fbshipit-source-id: 77419deacf5db676cd721b58f34932bd6ca2399f
Summary:
Simplifies `RCTDeviceEventEmitter` to simply be an `EventEmitter`.
The only thing special about it is that all native events are emitted on it and that `NativeEventEmitter` composes it.
Changelog:
[General][Removed] - Removed `RCTDeviceEventEmitter.sharedSubscribers`.
Reviewed By: RSNara
Differential Revision: D26163660
fbshipit-source-id: aedff8323d86947220fc293a74a19a3981fd875a
Summary:
Previously this branch of code only ran on Fabric+iOS. It is also needed for non-Fabric+Android in case `setLayoutAnimationEnabledExperimental` is not called on Android and an animation is queued up.
Changelog: [Internal]
Reviewed By: ShikaSD
Differential Revision: D26466482
fbshipit-source-id: 11c50bf94daa287a619f2b623785b60675eb6cf0
Summary:
The purpose of this diff is to move all of the ScrollResponder methods into ScrollView to delete ScrollResponder.Mixin.
NOTE: ScrollResponder.Mixin uses a variable named "state" but it does not use React state correctly. Instead of calling `setState()`, state is set using `this.state.item = 123` ([example](https://www.internalfb.com/intern/diffusion/FBS/browsefile/master/xplat/js/react-native-github/Libraries/Components/ScrollResponder.js?lines=315)). This means these are not actually React state - these are functionally just variables. In this stack, these "state" items from ScrollResponder are turned into regular internal variables.
Changelog:
[General][Removed] Moved ScrollResponder.Mixin methods into ScrollView to Remove ScrollResponder.js
Reviewed By: lunaleaps, nadiia
Differential Revision: D20715880
fbshipit-source-id: 99441434a6dc1c8ff3f435e7d6ec2840821e4e05
Summary:
Removing log in PaperUIManager since this is logging warn messages for "Text" components
changelog: [internal] internal
Differential Revision: D26315745
fbshipit-source-id: 8871148b0fc1791e1723962f1f2477cd5e0c562d
Summary:
Rewrites `NativeEventEmitter` to not extend `EventEmitter` and to compose `RCTDeviceEventEmitter` instead of (mis)using its exported `sharedSubscriber` property.
This makes it easier to reason about `NativeEventEmitter`. Also, the extraneous methods on `EventEmitter` are no longer inherited.
Changelog:
[General][Removed] - `NativeEventEmitter` no longer inherits from `EventEmitter`, so it no longer implements `removeListener` and `removeSubscription`. Instead, use the `remove()` method on the subscription object returned by `addListener`.
Reviewed By: rubennorte
Differential Revision: D26163562
fbshipit-source-id: c1aadb99bdefbaa36fece57ce74604e414f94d4d
Summary:
Simplifies `Keyboard` by removing redundant methods and changing `addEventListener` to return an `EventSubscription`.
Changelog:
[General][Changed] - `Keyboard.addListener` now returns an `EventSubscription` object.
[General][Removed] - Removed `Keyboard.removeListener`. Instead, use the `remove()` method on the object returned by `Keyboard.addListener`.
[General][Removed] - `Keyboard` no longer inherits from `NativeEventEmitter`, so it no longer implements `removeAllListeners`, and `removeSubscription`.
Reviewed By: milroc
Differential Revision: D26163536
fbshipit-source-id: b4bd91627cd027a13fcba269a253823913eb7589
Summary:
Tweaks LogBox so that if all stack frames are collapsed, start off without collapsing any of them.
It saves developers from one extra interaction to make the LogBox actually useful for errors where every frame is ignored.
Changelog:
[General][Changed] - LogBox will not initially collapse stack frames if every frame would be collapsed.
Differential Revision: D26266195
fbshipit-source-id: dcdbe0834da5fc3a0bf49fb7857de30dd7e4b8cb
Summary:
It is currently possible to activate a disabled Pressable with VoiceOver/TalkBack. This fixes this.
Changelog:
[General][Fixed] Fix disabled prop not disabling onPress for voice assistant
Reviewed By: blavalla
Differential Revision: D26225448
fbshipit-source-id: 67fa10f9e5c50143d986dc709a2fb639fdc3e718
Summary:
FabricUIManager does not support it, the declaration is not correct.
Changelog: [Internal] Fabric-specific internal change.
Created from Diffusion's 'Open in Editor' feature.
Differential Revision: D26241483
fbshipit-source-id: 8a894dc847bce9c196d8ac2e1601853e4fe03e1d
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:
Removes the checks in `RCTDeviceEventEmitter` that were initially added to migrate call sites to other modules when `NativeEventEmitter` was introduced.
This set of checks is problematic for a few reasons:
1. Does not cover many other events that have since been introduced, so the small list covered is arbitrary.
2. Prevents composition of `RCTDeviceEventEmitter` in the implementation of those modules.
3. Code bloat.
Changelog:
[General][Removed] - `RCTDeviceEventEmitter` no longer throws for `SttatusBar`, `Keyboard`, and `AppState` events. However, you are still recommended to use the more appropriate modules for listening to these events.
Reviewed By: lunaleaps
Differential Revision: D26163602
fbshipit-source-id: 316287bfdf2947fe85d022a3f83a205e89c432ba
Summary:
When NativeUIManager.getConstantsForViewManager throws an exception from native, we just swallow that exception and set null as the view config. Instead, we should log that an error occurred. This way, we can tell if the NativeModule sync method call returned undefined, or if the NativeModule sync method call thew an exception.
I'll take a look and see if we can add this logging higher up in the native stack, so that we can actually capture the stack information from this NativeModule sync method call failure.
Created from Diffusion's 'Open in Editor' feature.
Changelog: [Internal]
Reviewed By: mdvacca
Differential Revision: D26227379
fbshipit-source-id: 02b516d247f82f873f059005e6a2cc6f2a64fdb5
Summary:
Deletes `Linking.removeEventListener` in favor of returning the `EventSubscription` returned by `NativeEventEmitter.addListener`.
Changelog:
[General][Added] - `Linking.addEventListener` now returns a subscription with a `remove()` method.
[General][Removed] - Removed `Linking.removeEventListener`. Instead, call `remove()` on the subscription returned by `Linking.addEventListener`.
Reviewed By: rubennorte, wtfil
Differential Revision: D26155896
fbshipit-source-id: 1176ec6eae1c0fff2d68acf5411a18da530b212a
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:
Changes the to-be-legacy `_EventSubscription` and `_EmitterSubscription` classes to implement the event-agnostic `EventSubscription` interface.
This interface is valuable because it abstracts away the event definitions.
Changelog:
[Internal]
Reviewed By: lunaleaps
Differential Revision: D26155911
fbshipit-source-id: f94280976d4f9219f4780ac8fae0d5fbc1865386
Summary:
Simplifies the implementation of `DevSettings`. The fact that it uses `NativeEventEmitter` is an implementation detail and does not need to be exposed via inheritance.
This also enables more code to be removed from production builds (because the development implementation is now statically enclosed by `__DEV__`).
Changelog:
[General][Changed] - `DevSettings` no longer inherits from `NativeEventEmitter`
Reviewed By: RSNara
Differential Revision: D26140148
fbshipit-source-id: 99fa9d0c6ce8e365f89936aa12a4720f7a04b984
Summary:
Removes the `options` argument in the `NativeEventEmitter` constructor. It was only being used for an experimental flag that is no longer necessary.
Changelog:
[General][Removed] - Removed second optional argument of `NativeEventEmitter` constructor
Reviewed By: RSNara
Differential Revision: D26138239
fbshipit-source-id: 0481ce44f0464668e3a6e7ffaf079d17c87afd42
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
Summary:
See comments. On iOS in Fabric, LayoutAnimations is only conditionally enabled; whereas on Android it's always enabled. That means for code on iOS that relies on the onComplete callback, there might be bugs.
Ensure the callback is always called on iOS by racing a timer with the animation completion.
This will be deleted before Fabric "ships" fully.
Impact is minimal since this change is scoped to only run on iOS and under Fabric.
Changelog: [Internal]
Reviewed By: sammy-SC
Differential Revision: D26166237
fbshipit-source-id: 9a07a402845c379e1511f199eef3d3e249e1eb06
Summary:
Refactors `RCTNeworking.ios.js` so that event registration does not get passed along to `NativeNetworkingIOS`. Instead, we go straight to `RCTDeviceEventEmitter` (which is what `NativeEventEmitter` ultimately does when `nativeModule` is not supplied).
This optimization reduces overhead of making network requests, and it is made possible because `NativeNetworkingIOS` does not actually do any meaningful work when `startObserving` is invoked.
Changelog:
[iOS][Removed] - Removed event methods except `addListener` from `Networking`
Reviewed By: lunaleaps
Differential Revision: D26137965
fbshipit-source-id: b6e0288689459ddb8ecf8d34dce6250d3b0ecb59
Summary:
Changelog: [internal]
`[self _invalidatePlaceholderVisibility]` wasn't triggered in multiline text input in Fabric. Even in Paper it was triggered what to me seems like coincidence rather than intention (I might be wrong). This is more explicit, visibility of placeholder text needs to be re-evaluated every time placeholder text is changed.
Reviewed By: shergin
Differential Revision: D26172754
fbshipit-source-id: 3a767d333b79c266a3d70a96883b1289fff16750
Summary:
This is just cleanup. When I migrated components to `Pressability` instead of `Touchable`, I left `TOUCH_TARGET_DEBUG` alone to minimize moving pieces. But I had created `PressabilityDebug` as the eventual destination for this logic.
Now that `Text` is migrated away from `Touchable` (see D26106824 (f275514f27)), this cleans up the final internal reference to `Touchable`.
Changelog:
[General][Changed] - `Touchable.renderDebugView` now accepts `ColorValue` instead of `string | number`.
[General][Removed] - Removed `Touchable.TOUCH_TARGET_DEBUG` property.
Reviewed By: kacieb
Differential Revision: D26108570
fbshipit-source-id: 2694c9a9c29182ae04a77ba6c2e4406fcd5a277e
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:
Rewrites the `Text` component using modern best practices.
Notably, `Text` no longer depends on `Touchable` and now instead depends on `Pressability`.
Changelog:
[Internal]
Reviewed By: mdvacca
Differential Revision: D26106824
fbshipit-source-id: 0797e66075ae03c51dd5b4b3395b21ae92c39ba6
Summary:
This diff adds TextInput in the list of components that support static view configs
changelog: [internal]
Reviewed By: yungsters
Differential Revision: D26040854
fbshipit-source-id: d6b5d3a78ef4657acf3f2c4ebe527ad4ca40bcb5
Summary:
This diff removes the call to UIManager.getViewManagerConfig into the deprecatedPropType method when static view configs are enabled
This was necessary to avoid innecessary calls to UIManager.getViewManagerConfig and to avoid loading UIManagerModule classes when static view configs are enabled
changelog: [internal] internal
Reviewed By: fkgozali, yungsters
Differential Revision: D26040855
fbshipit-source-id: 82cad9f4abe9898e781fd989ebaa03497dad926b
Summary:
This diff refactors the StaticViewConfigsPaperUIManager to avoid loading NativeUIManager.
This is part of a experiment to prevent loading UIManagerModule class in native.
changelog: [internal]
Reviewed By: JoshuaGross
Differential Revision: D25630215
fbshipit-source-id: 40d6f3b36ad4c3377820b1dcf0bd949db063d899
Summary:
This diff changes the flow types of RefreshControl.size prop from 'int' to string'. For more context see previous diff of the stack.
This diff will be landed as soon as the native release containing D25933458 (65975dd28d) goes to production.
It's important to clarify that there are currently no usages of this prop in production
Changelog: [Android][Changed] - RefreshControl.size prop changed its type to string, the valid values are: 'default' and 'large'
Reviewed By: JoshuaGross
Differential Revision: D25933457
fbshipit-source-id: 2f34566f2f8a097e6d40f63c09ecb3ada2fd8409
Summary:
NativeModule schema targets will now take the form '{library_name}-codegen-modules-schema'.
NOTE: Will launch the necessary diffs to make the same refactor in our component codegen.
Changelog: [Internal]
Differential Revision: D25968071
fbshipit-source-id: 1d7c9f4679e4ae6c26c9a29a74fa7b7ea76460eb
Summary:
Since `RCTNetworking` overrides init, it requires main queue setup. Native module infra currently throw a yellowbox if a module forgets it.
This diff fixes that.
{F361182429}
Changelog: [Internal]
Reviewed By: shergin
Differential Revision: D25962402
fbshipit-source-id: d847117cbfe0a191dc1882898711693c6fda68cd
Summary:
This diff changes the type of the SwipeRefreshLayoutManager.size prop from Int to String in Fabric.
The current implementation of this prop allows JS developers to use "int" type when fabric is enables and "int or string" types when using Fabric is disabled.
Since long term we want to only support "string" type for this prop, I'm changing the type of the prop to be String.
After my diff Fabric will start supporting only "string" types, non fabric screens will keep supporting "int or string" values.
**Will this break production?**
No, because there are no usages of RefreshControl.Size prop in fbsource
**What about if someone start using this prop next week?**
IMO It's very unlikely because of the nature of this prop, I will be monitoring next week and if there's an usage it will be detected by flow when trying to land D25933457.
Changelog: [Android][Changed] - RefreshControl.size prop changed its type to string, the valid values are: 'default' and 'large'
Reviewed By: JoshuaGross
Differential Revision: D25933458
fbshipit-source-id: 55067d7405b063f1e8d9bb7a5fd7731f5f168960
Summary:
Changelog:
[Internal][Fixed] - Add a default value for the cache breaker value
Reviewed By: fkgozali
Differential Revision: D25907137
fbshipit-source-id: 243346cbc67d1a85519bb469f4d68d61676ba547
Summary:
Restore the `android_hyphenationFrequency` attribute in the view config for `Text`. This was accidentally dropped by D23708205 (06ce643565) (06ce643565).
Changelog:
[Android][Fixed] - Restore `android_hyphenationFrequency` on `Text`.
Reviewed By: mdvacca
Differential Revision: D25889971
fbshipit-source-id: 622eef618370efdd9a8b060ccd3272e25de218fa
Summary:
Changelog: [internal]
Revert a change introduced in https://github.com/facebook/react-native/pull/30333 where rickhanlonii asked it to be reverted as well.
The change breaks sticky header in Fabric.
Reviewed By: rubennorte
Differential Revision: D25883861
fbshipit-source-id: b01305c6def390d0664c7be939ab3fc72186a07a
Summary:
allow-large-files
Changelog: [iOS] Remove iOS10/tvOS10 suppport
Similar to D19265731 (674b591809) for iOS9.
I just ran this command:
`find . -type f -exec sed -i '' 's/{ :ios => "10.0" }/{ :ios => "11.0" }/' {} +`
and then updated pods
Reviewed By: fkgozali
Differential Revision: D25693227
fbshipit-source-id: 0073d57ecbb268c52d21962cef202316857bcbd2
Summary:
This change contains the suppressions for the up coming v0.142.0 Flow release.
The new suppressions are a result the following changes:
* Disallow flowing functions or inexact objects to indexed objects to improve object soundness. This can cause errors if you are passing a function or inexact objects when an indexed object is expected.
* Flow now processes imports before checking the body of a file. In some rare cases this can expose previously skipped errors due to the processing order.
Reviewed By: mroch
Differential Revision: D25820434
fbshipit-source-id: 59cc1d852ffc8cc39f0d5112ce485fb33f05c092
Summary:
Adds types to Event Emitters and migrates the most relevant modules using them in `react-native`.
The most relevant file of this diff is `react-native/Libraries/vendor/emitter/__flowtests__/EventEmitter-flowtest.js` with the Flow tests showing and testing the behavior of the new types
Changelog: [Internal] Add types for Event Emitters and subclasses
Reviewed By: motiz88
Differential Revision: D25587936
fbshipit-source-id: feeb09f9ad15d383cdd82deaaaba0d12b94e868b
Summary:
The `Systrace` and `Refresh` dependencies are injected into the `metroRequire` implementation by assigning the values to e.g. `require.Systrace = ...`.
The issue with this approach is that some `require` implementations might not support extending the `require` object or doing so results in a degraded performance. An example where this is the case is Hermes where changing the `require` object forces Hermes to opt out of the static require optimization.
This diff extends Metro so that the `Systrace` and `Refresh` implementation can either be injected by assigning to `require.Systrace` or by exposing the implementation in the global scope. It further changes the `Systrace` and `Refresh` modules to inject the instances using the global scope instead of extending `require`.
Changelog:
[Internal][Changed] - Expose Systrace and ReactRefresh as globals instead of extending require.
Reviewed By: motiz88
Differential Revision: D25693381
fbshipit-source-id: 254d66d43e7a56d3310cf1a17d5146b8d1307562
Summary:
This prevents having to modify too many files when we add the proper typing for that module
Changelog: [Internal]
Reviewed By: nadiia
Differential Revision: D25586848
fbshipit-source-id: 16001ada4a37a58f83b6e5a4400daebf9257be72
Summary:
Migrates all usages of `NativeEventEmitter` to `NativeEventEmitter<$FlowFixMe>`.
This prevents having to modify a very large number of files in the same change that adds support for typed events. It adds an unused typed parameter to `NativeEventEmitter` so we can change all usages to add `$FlowFixMe`.
Changelog: [Internal]
Reviewed By: nadiia
Differential Revision: D25575774
fbshipit-source-id: c7979e1502e980401d9c03456282eba333c1606d
Summary:
Migrates `CodegenTypes` and its transitive dependencies to Flow strict to unblock this mode in Native Modules and Native Components.
Changelog: [Internal]
Reviewed By: TheSavior
Differential Revision: D25540629
fbshipit-source-id: 7bed2ee58af7a789b50932734c7a86cf1719e2c5
Summary:
This new type will be valid in Flow strict mode and can be used by native modules and components to replace `Object`, with the same semantics.
This unblocks the migration of the most modules in the React Native package to Flow strict.
Changelog: [Internal] Add UnsafeObject type compatible with Flow strict mode to use in native modules and components
Reviewed By: RSNara
Differential Revision: D25540631
fbshipit-source-id: 60b80bbc84a53aecc747e3a1799cdf551e1859cd
Summary:
Consolidate CocoaPods codegen scripts under a single `use_react_native_codegen!` method in `react_native_pods.rb`.
This is the first step towards making the codegen scripts library-agnostic. There are still a handful of hardcoded assumptions in place (e.g. the output directory structure, the use of a separate directory for components), but with some work one would be able to add codegen support to arbitrary CocoaPods podspecs.
The codegen script no longer takes a CODEGEN_PATH argument, and will instead attempt to use the local react-native-codegen package if available, and fallback to using the node_modules/react-native-codegen package if not.
## Usage
The `use_react_native_codegen!` method has two arguments:
- `spec`, a pod [Specification](https://www.rubydoc.info/github/CocoaPods/Core/Pod/Specification) object.
- `options`, an optional object. Supported keys:
- `:srcs_dir`, the path to your JavaScript sources. Your native module or component specs should be located somewhere in this directory.
Changelog: [Internal]
Reviewed By: mdvacca
Differential Revision: D25728053
fbshipit-source-id: feec587b656d5b220598ce6196ea6bb34a9580a9
Summary:
Even though replacing an error with a warning does not look like a future-proof solution here are the reasons for this:
* The measuring operation might just fail because of the async nature of React Native. And here, from my understanding, we don't even have a good reason for measuring. Auto-scrolling to selected textinput (which is the reason for this code, AFAIK) is a standard feature that OS does for all text input. I suspect that this (very old) feature was built in a timeframe where this system feature was originally broken (sometime before 2016).
* This product-facing API does not have an error-callback, so just loggin an error here is as (not) actionable as logging a warning.
* The error callback was never implemented in the pre-Fabric world, so it *never* got called for years, and now when Fabric is starting calling in some cases, it is being "punished" for this. In the next diff, I will try to retrofit this feature back to Paper to reach parity with Paper.
Changelog: [Internal]
Differential Revision: D25700156
fbshipit-source-id: 319a146b17cc2130848148ad11adbde16e86c5d5
Summary:
## Changes
All `rn_library(codegen_modules = True)` must now also specify native_module_android_package_name, like so:
```
rn_library(
name = "FBAuth"
codegen_modules = True,
native_module_spec_name = "Foo",
native_module_android_package_name = "com.facebook.fbreact.specs",
)
```
This will generate the FBAuth Java spec files under the appropriate directory: "com/facebook/fbreact/specs". It will also make the code-generated specs have the appropriate package name: "com.facebook.fbreact.specs".
Changelog: [Internal]
Reviewed By: shergin
Differential Revision: D25723176
fbshipit-source-id: 6efec1cbee43d70110c0ef23e2422e08609b61d4
Summary:
The `isFabric` method used in createAnimatedComponent is unreliable (another reason in a long list of reasons why you should not duplicate this code elsewhere, and why we want to delete it ASAP).
In particular, during the first render, the ref component has not been set yet, so we /cannot/ detect if the component is Fabric or non-Fabric and assume it's non-Fabric.
In Fabric, this causes `collapsable` and `nativeID` values to change after the first render.
To reduce this re-rendering, but not eliminate it for all components, I've introduced a flag that indicates if a component will /never/ be flattened. In particular, Image components, ScrollViews, Text cannot ever be flattened,
so we should always pass `collapsable:false` and the same nativeID prop for those components. For Animated <View>s and other components, the re-rendering issue is still a problem in Fabric for now.
Changelog: [Internal]
Reviewed By: mdvacca
Differential Revision: D25720322
fbshipit-source-id: fe3234d8ae974911a2b5f82e4f6a093216f43d4b
Summary:
Changelog:
[Internal][Added] - Create a general utils for assets and add a cache breaker utility to set/get a urlparam for remote assets.
Reviewed By: motiz88
Differential Revision: D25521331
fbshipit-source-id: 042e52a27e826bc9993e80bc68cc6fc68abaf224
Summary:
Changelog: [internal]
Return original image instead of calling `abort()` when malloc fails.
Should we show a redbox? I don't think so, the redbox wouldn't be actionable for product engineer.
Reviewed By: PeteTheHeat
Differential Revision: D25678532
fbshipit-source-id: dd44d5e87198a0f76767ea40fe111ed347a7669a
Summary:
Original PR contents:
This pull request updates the Podspecs and associated build scripts, and some source files so they build on OSS. RNTester now compiles with `fabric_enabled` again.
The following changes have been made:
* Various spots that were pointing to the old `ReactCommon/fabric` location have now been updated to `ReactCommon/react/renderer`
* Files that were attempting to use internal FB header `FBRCTFabricComponentsPlugins.h` were changed to use `RCTFabricComponentsPlugins.h`
* `RCTFabricComponentsPlugins` in OSS was updated to include the `Image` fabric component (thanks tsapeta)
* Replaced old `generate-rncore.sh` build script with new `generate-rncore.js` script which does not require `flow-node` and uses the `react-native-codegen` API directly, so there is no longer any need for an interim `schema-rncore.json` file.
* Updated Yoga podspec which wasn't fully synced with changes from the main Yoga repo
* Updated Fabric podspec with additional needed subspecs
Additions to PR by hramos:
* Replaced use of generate-rncore scripts with the original generate-native-modules-specs.sh script, which is now generate-specs.sh and supports both codegen for Native Modules and Components now (TurboModules/Fabric).
* Codegen now runs at build time as part of the Xcode build pipeline instead of as part of `pod install`. The build script is injected by the FBReactNativeSpec pod, as the pod is part of both Fabric and non-Fabric builds.
## Changelog
[General] [Fixed] - RNTester compiles with `fabric_enabled` again
Pull Request resolved: https://github.com/facebook/react-native/pull/29810
Test Plan:
RNTester now compiles and runs in the simulator again when `fabric_enabled` is set to `true`.
```
cd xplat/js/react-native-github/packages/rn-tester
USE_FABRIC=1 pod install
open RNTesterPods.xcworkspace
# Build and run
```
Reviewed By: fkgozali
Differential Revision: D24058507
Pulled By: hramos
fbshipit-source-id: 8b2ea3694e6cb9aa23f83f087e2995fd4320e2bb
Summary:
## Context
When you add/remove listeners from event emitters in JavaScript on iOS, we [call the NativeModule's addListener/removeListener methods](https://fburl.com/diffusion/4878jv6p). These addListener() and removeListener() methods [are implemented on the RCTEventEmitter class](https://fburl.com/diffusion/y913pqhy). All event emitters on iOS are subclasses of RCTEventEmitter.
The only purpose of calling RCTEventEmitter's addListener() and removeListener() methods is to call the [subclasses' startObservation, and stopObservation methods](https://fburl.com/diffusion/rpzyfppk), and [increment/decrement a listenerCount member variable](https://fburl.com/diffusion/ktl8if26) in RCTEventEmitter, which helps catch memory leaks.
RCTNetworking is a subclass of RCTEventEmitter, but it doesn't implement these startObserving/stopObserving methods. Since the [listenerCount is only used to show warnings](https://fburl.com/diffusion/i45lobil), in D24272560 (82187bfb6b), I disabled observation in RCTNetworking on the native side. Then in D24272663 (dabca52f77), I disabled RCTNetworking.addListener/removeListener NativeModule calls in JavaScript. This was gated via a QE/MC.
## Problem
The default initializer of RCTNetworking doesn't initialize with observation disabled. This broke antwerp when we shipped the experiment in D24272663 (dabca52f77). This diff fixes that problem.
Changelog: [Internal]
Reviewed By: fkgozali
Differential Revision: D25671343
fbshipit-source-id: d9a8ba5324a23ade8f4b0bf2ec093f3e4fb494dc
Summary:
## Context
Every time we call RCTNetworking.sendRequest(), we [set up six event listeners inside XMLHttpRequest](https://fburl.com/diffusion/85k6ou5w) by calling RCTNetworking.addListener(). Seeing how RCTNetworking.addListener() is implemented, each call results in two async NativeModule call: [one to addListener()](https://fburl.com/diffusion/ng21jek6), and [another to removeEventListener()](https://fburl.com/diffusion/nua3y973).
For RCTNetworking, both of these NativeModule calls are unnecessary, as explained in D24272663 (dabca52f77)
> RCTNetworking.startObserving and RCTNetworking.stopObserving don't exist. The main purpose of RCTEventEmitter.addListener is to call these methods, and increment the _listeners counter, so that we can start dispatching events when _listeners > 0. In D24272560 (82187bfb6b), I made RCTEventEmitter dispatch events even when _listeners <= 0. This is sufficient for us to stop calling these two RCTNetworking methods entirely.
Therefore, this experiment gets rid of on average 6-8 NativeModule method calls for every network call we make in React Native on iOS.
Reviewed By: PeteTheHeat
Differential Revision: D25618704
fbshipit-source-id: 0da20475a0882ed737cf32de27f266fd2cd016af
Summary:
All NativeModules that used to use the bridge to require other NativeModules now require other NativeModules via the Venice-compatible RCTModuleRegistry abstraction. Therefore, we can safely get rid of synthesize bridge = _bridge from them.
## How did I generate this diff?
1. Search for all NativeModules that have `synthesize bridge =`
2. Remove the `synthesize bridge = _bridge` from each NativeModule, and if it doesn't contain `_bridge`, `setBridge:`, or `elf.bridge`, add it to this codemod.
Changelog: [Internal]
Reviewed By: PeteTheHeat
Differential Revision: D25551295
fbshipit-source-id: 585d50ad55cb9ab083e430b07e1cf30e31f0d3c5
Summary:
According to https://github.com/facebook/react-native/issues/20011, the first onPress will not work after pull to refresh.
Dive into the code, found out that is because the state `isTouching` in `Libraries/Components/ScrollResponder.js` is not updated after the pull to refresh.
Update the `isTouching` state in `scrollResponderHandleResponderRelease` to fix 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
-->
[iOS] [Fixed] - First press not working after pull to refresh
Pull Request resolved: https://github.com/facebook/react-native/pull/30291
Test Plan:
### Before
- The first onPress fail
![ezgif-4-c6aa5383e898](https://user-images.githubusercontent.com/48589760/97789482-cd4c4100-1bfb-11eb-8a6b-649e8a966b99.gif)
### After
- The first onPress success
![ezgif-4-195f9f6c302e](https://user-images.githubusercontent.com/48589760/97789488-da693000-1bfb-11eb-9a87-f005e61b8ad0.gif)
Eli:
I tested this myself internally using this code sample:
```
'use strict';
import PlaygroundRoute from 'PlaygroundRoute';
import type {SurfaceProps} from 'Surface';
import TetraText from 'TetraText';
import TetraView from 'TetraView';
import {TouchableOpacity, Text, View, ScrollView, RefreshControl, StyleSheet} from 'react-native';
import * as React from 'react';
type Props = SurfaceProps<PlaygroundRoute>;
class App extends React.Component<{}> {
constructor() {
super();
this.state = {refreshing: true, items: []};
}
componentDidMount() {
this.refresh();
}
refresh = () => {
this.setState({
refreshing: true,
items: [],
});
setTimeout(
() =>
this.setState({
refreshing: false,
items: [0, 1, 2, 3, 4, 5],
}),
1500,
);
};
renderItem = ({item}) => {
return (
<TouchableOpacity onPress={() => alert('pressed!')} key={`${item}`}>
<Text style={{width: '100%', height: 48, backgroundColor: 'white'}}>
{item}
</Text>
<View style={{width: '100%', height: 1, backgroundColor: 'gray'}} />
</TouchableOpacity>
);
};
render() {
return (
<View style={{flex: 1, padding: 48}}>
<ScrollView
style={{
flex: 1,
backgroundColor: '#aaa',
borderColor: 'gray',
borderWidth: 1,
}}
keyExtractor={item => `${item}`}
refreshControl={
<RefreshControl
refreshing={this.state.refreshing}
onRefresh={this.refresh}
/>
}>
{this.state.items.map(item => this.renderItem({item}))}
</ScrollView>
</View>
);
}
}
export default function Playground(props: Props): React.Node {
return (
<App />
);
}
const styles = StyleSheet.create({
container: {
padding: 10,
paddingTop: 30,
},
});
```
{F351458967}
Reviewed By: appden
Differential Revision: D25574927
Pulled By: TheSavior
fbshipit-source-id: 7abf8a2f947d94150419e51d46a19e792441c981
Summary:
RCTBlobManager actually has the name "BlobModule", not "BlobManager".
Changelog: [Internal]
Reviewed By: PeteTheHeat
Differential Revision: D25569865
fbshipit-source-id: f6b41300bda6485cef3f18d3d0308dad9c002b77
Summary:
Changelog: [General][Fixed] Fix stalling UI due to a bug in KeyboardAvoidingView
I introduced this bug in D22764192 (b08fff6f86).
The stalling was caused by onLayout in JavaScript triggering native layout which called onLayout in JavaScript without terminating condition.
The fix is to only cause native layout once from JavaScript's onLayout function. This makes sure both Fabric and Paper works correctly and UI stall isn't caused.
Resolves:
https://github.com/facebook/react-native/issues/30495https://github.com/facebook/react-native/issues/30532
Reviewed By: TheSavior
Differential Revision: D25522362
fbshipit-source-id: 602e540bb1c40ae4f421b3e6ebc5a047cd920c17
Summary:
This small PR introduces the following changes to the `Pressability`:
* fixes typo in internal `isActivationTransiton` variable name
* assigns `onPressMove` to variable before check and potential usage (this is the common pattern in this file)
* utilizes destructuring assignment to simplify passing coordinates to `_touchActivatePosition`
## Changelog
[Internal] [Fixed] - Pressability: fix typo in variable, follow event check pattern, small tweak
Pull Request resolved: https://github.com/facebook/react-native/pull/30151
Test Plan: Successful `yarn test` run.
Reviewed By: kacieb
Differential Revision: D25545662
Pulled By: nadiia
fbshipit-source-id: 8d311fe21b485ee707e05dad120322b3027e686b
Summary:
All NativeModules that use `[RCTBridge moduleForName:]` to access other NativeModules are now instead using the Venice-compatible RCTModuleRegistry to access other NativeModules.
Changelog: [Internal]
Reviewed By: shergin
Differential Revision: D25508910
fbshipit-source-id: 85fc390063af264f2f2843e5640fa7336a784ab4
Summary:
All NativeModules that use `[RCTBridge moduleForClass:]` to access other NativeModules are now instead using the Venice-compatible RCTModuleRegistry to access other NativeModules.
Changelog: [Internal]
Reviewed By: shergin
Differential Revision: D25508277
fbshipit-source-id: 1b415a5ad4055290940879e100ceaa84ae83feeb
Summary:
All NativeModules that access the _bridge from self to require the WebSocketModule NativeModule now instead get the WebSocketModule NativeModule from the _moduleRegistry.
Changelog: [Internal]
Reviewed By: PeteTheHeat
Differential Revision: D25500433
fbshipit-source-id: 21aebc5684dd6a058de4e35b042c9fb255ffcb33
Summary:
Spotted a few errors in Codemod that migrated bridge.networking calls to [_moduleRegistry moduleForName:"Networking"] calls. This diff fixes those mistakes.
Changelog: [Internal]
Reviewed By: PeteTheHeat
Differential Revision: D25499699
fbshipit-source-id: 29f296fc1011cf65d30e083e0ef001e3185edbfb
Summary:
All NativeModules that access the _bridge from self to require the Networking NativeModule now instead get the Networking NativeModule from the _moduleRegistry.
NOTE: xbgs .networking reveal any other usages. So, there won't be a manual migration diff associated with this codemod.
Changelog: [Internal]
Reviewed By: PeteTheHeat
Differential Revision: D25499412
fbshipit-source-id: 7b0e33135c6c91ffc1e041ad3ab95f1346a8bc22
Summary:
All NativeModules that access the _bridge from self to require the ImageStoreManager now instead get the ImageStoreManager from the `_moduleRegistry`.
Changelog: [Internal]
Reviewed By: PeteTheHeat
Differential Revision: D25498774
fbshipit-source-id: 1d97888ed2ef8d295aa35cf08cb9e9f3bc33ed05
Summary:
While investigating a bridgeless networking issue, I noticed something very peculiar. **Two** networking turbo modules are built and used in bridgeless mode. Upon debugging, I realized that each of them have a different `TurboModuleHolder`. The reason is the following:
1. In JS, the module's name is [Networking](https://fburl.com/diffusion/f2xu4wie)
2. In ObjC, we call the module "RCTNetworking" (examples in this diff)
3. Both scenarios end up creating the correct Turbo Module: [RCTNetworking](https://www.internalfb.com/intern/diffusion/FBS/browsefile/master/xplat/js/react-native-github/Libraries/Network/RCTNetworking.mm?link_ref=search), but the `TurboModuleHolder` doesn't know that "RCTNetworking" and "Networking" are the same. Any other modules accessed this way will have the same issue.
An alternative solution would be to tell `TurboModuleHolder` to strip the `RCT` suffix, which would solve the problem globally. RSNara thoughts?
Changelog: [Internal]
Reviewed By: RSNara
Differential Revision: D25477044
fbshipit-source-id: 02219de578ef4d19e579110e4242883a30cefcd6
Summary:
This is an extension of D25449795. I searched for all usages of .eventDispatcher within NativeModules, and migrated them all to the Venice-compatible RCTModuleRegistry API.
Changelog: [Internal]
Reviewed By: PeteTheHeat
Differential Revision: D25473844
fbshipit-source-id: 2b8deec236e019f3adfb59fadd745c249ff822f4
Summary:
All NativeModules that use the bridge to require the eventDispatcher are now instead using the RCTModuleRegistry I introduced in D25412847 (0ed81b28d3).
## What does this codemod do?
For all ObjC files that contain `synthesize bridge = _bridge`, migrate calls that access the React Native bridge from `self`, and use it to load the event dispatcher.
**Thoughts on Codemod Safety:** If we can access the bridge from self, then that means that if we synthesize the module registry, we can access the module registry from self. Therefore, this codemod is safe.
Changelog: [Internal]
Reviewed By: PeteTheHeat
Differential Revision: D25449795
fbshipit-source-id: 2f7235d14659e73d673ae08763dc2cccdde55a19
Summary:
This should be a noop. It just makes writing codemods easier.
Changelog: [Internal]
Reviewed By: PeteTheHeat
Differential Revision: D25442218
fbshipit-source-id: dba0c35a6f566e83ed5b7142075fff6929efeada
Summary:
This commit:
* Generate Fabric component Java files along side Java NativeModule specs, when `USE_FABRIC=1` is set
* Adjust the component codegen to place output files in a subdir based on package name
* Adjust existing Buck targets to filter the right nativemodule vs component java files (this avoids duplicated symbols)
* Compiles the Java output during build time on RNTester/ReactAndroid (Gradle)
Not in this commit:
* Fabric C++ files
* Removing checked-in generated component files.
Changelog: [Internal]
Reviewed By: mdvacca
Differential Revision: D25416614
fbshipit-source-id: fd670ead2198c9b5a65812c692b7aed9f3d7cd58
Summary:
Changelog: [internal]
In D25386708 (408bcdeedb) `synthesize bridge` was removed. But two modules actually depend on this.
`RCTFileReaderModule` and `VerseThreadView` which both use it.
Reviewed By: RSNara
Differential Revision: D25423574
fbshipit-source-id: daf95d9b27841cf8d205d8ea2666d5aa69a6d720
Summary:
This is a codemod. All these NativeModules demand access to the bridge. However, they don't use it.
Changelog: [Internal]
Reviewed By: PeteTheHeat, RoelCastano
Differential Revision: D25386708
fbshipit-source-id: f05f4777d2527e96e53581e7ac58f6be47411dce
Summary:
As part of the initialization of Native View configs, the PaperUIManager.getViewManagerConfig() method calls the native side to lazy initialize iOS Native components. This is necessaary to make ensure that native classes are loaded and initialized before a view is created.
Note that this requirement is only necessary when Fabric is disabled.
As part of JS ViewConfigs, we removed the native call to lazy initialize iOS native components. This causes a crash during the creation of NativeViews when JS ViewConfigs are enabled and Fabric is disabled. The rootcase of the exception is that native classes are not properly initialized when the createView method is executed in iOS.
This diff forces the lazy initialization of iOS Native components when JS View configs are enabled and Fabric is disabled. This new mechanism is executed as part of the creation of views and it's ONLY going to be executed when the user navigates to a NON-FABRIC screen, JS ViewConfigs are enabled and the component is not initialized yet.
The extra cost should be minimal or zero.
changelog: [internal] internal
Reviewed By: fkgozali
Differential Revision: D25387014
fbshipit-source-id: fe3bc42f803a805192b419bfb4b7a6b5b1b71b60
Summary:
UserFlow API now takes configuration parameter, which is required. It contains of 2 arguments:
* triggerSource
* cancelOnBackround
Reviewed By: swillard13
Differential Revision: D25094721
fbshipit-source-id: 64a468c2168265ade9f8d4cea4beb911637544fa
Summary:
this diff fixes the next error:
```
'RCTImageView' has a view config that does not match native. 'validAttributes' is missing: internal_analyticTag
in RCTImageView (at Image.ios.js:149)
in ImageAnalyticsTagContext.Consumer (at Image.ios.js:146)
in Image (at TintedIcon.js:55)
in TintedIcon (at TetraIcon.js:98)
in TetraIcon (at FDSCheckbox.js:67)
in FDSCheckbox (at TetraListCell.js:820)
in TetraAddOnSecondary (at TetraListCell.js:576)
in TetraPressable (at TetraListCell.js:603)
in TetraListCell (created by TetraListCell)
in TetraListCell (at RNInternalSettingsUnit.js:35)
in TetraList (at RNInternalSettingsUnit.js:32)
in RNInternalSettingsUnit (at RNInternalSettingsDeveloperModeUnit.new.js:73)
in RNInternalSettingsDeveloperModeUnit (at RNInternalSettingsSurface.js:79)
in RNInternalSettingsSurface (at withDefaultErrorBoundary.js:30)
in DefaultError(React.lazy(RNInternalSettingsSurfaceForFacebook)) (at renderApplication.js:47)
```
changelog: [internal] internal
Reviewed By: fkgozali
Differential Revision: D25313414
fbshipit-source-id: ab951d25ac6a80809a2977c80ff059f667cc5595
Summary: Changelog: [Internal] backout change dispatching main queue before using it
Reviewed By: shergin
Differential Revision: D25319046
fbshipit-source-id: 4f8952e577cfd9033fb2c2248b9b056a0d468b5d
Summary:
Move the codegen invocation out of Podfiles and into the FBReactNativeSpec Pod itself. With this change, developers do not need to modify their existing project's Podfiles, and yet the codegen will be integrated into their projects automatically by way of the FBReactNativeSpec Pod.
This is accomplished in part by injecting a script build phase into the Pods Xcode project that is generated by CocoaPods. The build phase will save the output of the codegen script to a log in the derived files directory. The codegen will be executed if the codegen log file is not present, or if the contents of the Libraries directory has changed.
The codegen will thus be invoked in these situations:
**RNTester:**
* When `packages/rn-tester/RNTesterPods.xcworkspace` is built, if the codegen output logfile is not present or if the input files have changed.
**OSS React Native apps:**
* When `ios/AwesomeProject.xcworkspace` is built, if the codegen output file is not present or if the input files have changed. Normally, this should not happen, as we do not expect folks to update the contents of `node_modules/react-native/Libraries`.
Pull Request resolved: https://github.com/facebook/react-native/pull/30449
Changelog: [Internal] - Moved codegen invocation out of Podfile and into FBReactNativeSpec Pod
Reviewed By: fkgozali
Differential Revision: D25138896
fbshipit-source-id: 4779f822459cea2c30fd544eee19a49e8d80153d
Summary:
As titled - attempt to mitigate a JS error on iOS while we work on getting JS view configs. It seems like this happens when the bridge is invalid.
Changelog: [Fixed][iOS] Don't throw an error if the UIManager returns null when fetching a view config
Reviewed By: kacieb
Differential Revision: D25247203
fbshipit-source-id: e2003f99b818f9657c60ff95b266be74fe18a94b
Summary:
Migrates `View` to use `NativeComponentRegistry`, which enables configuring it to avoid reflection by using a static `ViewConfig`.
Changelog:
[Internal]
Reviewed By: JoshuaGross
Differential Revision: D25136054
fbshipit-source-id: f2abda1105bd2a8b396db6f1a640430b62bbcdaf
Summary: Changelog: [Internal] `self.component` is main thread affined so we need to dispatch to main queue before using it.
Reviewed By: shergin
Differential Revision: D25163182
fbshipit-source-id: a7da0324982354215e0ccb47615f7f121200f12a
Summary:
Creates `NativeComponentRegistry.getWithFallback_DEPRECATED`. This is deprecated from inception because it exists only to support a pattern that should not be necessary.
For any given `NativeX` component, the JavaScript module that calls `NativeComponentRegistry.get('NativeX', …)` should only exist in the JavaScript bundle if the native binary actually supports that native component.
But in today's transitional state of the world, there are JavaScript modules that use `UIManager.getViewManagerConfig('NativeX')` as a means of feature detection.
The purpose of `NativeComponentRegistry.getWithFallback_DEPRECATED` is to bridge this transitional gap. Component should migrate toward initializing the `NativeComponentRegistry` with a runtime configuration provider that enumerates all supported native components. If the native component is not supported, it should return null.
Changelog:
[Internal]
Reviewed By: fkgozali
Differential Revision: D25109988
fbshipit-source-id: 76f7077904594ca63495d8338905c43712ea02e0
Summary:
Migrates `ImageView` to use `NativeComponentRegistry`, which enables configuring it to avoid reflection by using a static `ViewConfig`.
Changelog:
[Internal]
Reviewed By: JoshuaGross
Differential Revision: D25104446
fbshipit-source-id: dd01bf01ead94ca6632b2653b45becf408953bcf
Summary:
There may be assumptions that `Native*.js` contains TurboModule. In order to avoid introducing unplanned breaking changes (especially right before the holidays), roll this back for now.
In doing so, I also realized that I forgot to migrate over `ScrollContentViewNativeComponent`. This does that, too.
Changelog:
[Internal]
Reviewed By: RSNara
Differential Revision: D25129324
fbshipit-source-id: 343c4b800969dab91f7cd9f2bf253788c94d38e6
Summary:
The Flow team has been building a new implementation of the system that typechecks the body of generic functions and classes. This system is more sound than the previous approach and detects errors that were uncaught previously. This diff turns on the new generic system by setting generate_tests=false in the .flowconfig, and suppresses newly discovered errors.
This diff modifies and re-signs some generated modules, because syncing from www pulled in a ton of other changes that have runtime differences, and I'm not equipped to verify that the changes are safe to land.
Changelog: [Internal]
Reviewed By: panagosg7
Differential Revision: D24801184
fbshipit-source-id: bb31fe4c5a4107d183649b436a548df5ff42e217
Summary:
Migrates `ScrollView` (and its related native components) to use `NativeComponentRegistry`. This will enable it to be configured using experiments to conditionally use the native `ViewConfig` or verify the static `ViewConfig`.
This also cleans up a bunch of the modules and types related to defining the native `ScrollView` component.
This also proposes adopting the same module naming protocol was has been adopted for TurboModules (i.e. `NativeScrollView` instead of `ScrollViewNativeComponent`).
Changelog:
[Internal]
Reviewed By: JoshuaGross
Differential Revision: D25098530
fbshipit-source-id: ff1394bfac023daf58e85d5f9068e4f8da3538be
Summary:
Fixes some of the type errors in `ScrollView` that were previously being suppressed by comments. This also slightly simplifies the implementation of `ScrollView`.
Changelog:
[Internal]
Reviewed By: kacieb
Differential Revision: D25097225
fbshipit-source-id: a444db8179c91e264671d8f32431b93c4da8dfc4
Summary:
Rewrites `splitLayoutProps`, which is only used by `ScrollView`.
- Improve type safety by avoiding `DangerouslyImpreciseStyle`.
- Avoid allocating objects when it is not necessary.
- Avoid allocating a object enumeratig layout props by using a switch statement.
Changelog:
[Internal]
Reviewed By: JoshuaGross, kacieb
Differential Revision: D25097226
fbshipit-source-id: 2050c03b681024212c06a48b7eb05f28c14415f9
Summary:
Refactors `flattenStyle` so that it preserves the style type of the argument. This lets us avoid using `DangerouslyImpreciseStyleProp` where we can.
Changelog:
[Internal]
Reviewed By: JoshuaGross, nadiia, kacieb
Differential Revision: D25097227
fbshipit-source-id: df6af6fefab25dbb62e3c81897c3cef98619a9c7
Summary:
This is an extension of https://github.com/facebook/react-native/issues/29798 which was reverted due to cases where the soft keyboard could not be dismissed.
## 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] - Avoid eating clicks/taps into ScrollView when using physical keyboard
Pull Request resolved: https://github.com/facebook/react-native/pull/30374
Test Plan: Validated with iOS simulator that taps on default ScrollView will dismiss soft keyboard and be eaten if open, but taps are not eaten when emulating a connected physical keyboard.
Reviewed By: kacieb
Differential Revision: D24935077
Pulled By: lyahdav
fbshipit-source-id: 19d9cf64547e40a35f9363896e3abbdccb95b546
Summary:
Creates `NativeComponentRegistry` which makes native component initialization more declarative and configurable through an optionally configurable provider.
The next diff converts `ScrollView` to use this new abstraction as a demonstration. The plan would be to use this to replace all current manual call sites of `registerGeneratedViewConfig`, and then the ones generated via the Babel plugin.
Migrating to this will not change any production behavior, but it will enable verification of `ViewConfig` in development.
Changelog:
[Internal]
Reviewed By: JoshuaGross
Differential Revision: D25084468
fbshipit-source-id: 9c758ddc279bf937a401a868a066907a94098f37
Summary:
Updates `ReactScrollViewManager` and the `ViewConfig` for `ScrollView` so that they are equivalent.
- `inverted` was missing.
- `contentOffset` was missing differ on Android. (However, there does not seem to be any perceivable behavior difference besides the native `ViewConfig` being different.)
Changelog:
[Internal]
Reviewed By: JoshuaGross
Differential Revision: D25084470
fbshipit-source-id: 8bea3b7a692c1038819a4147b174583a4faa71e9
Summary:
Refactors the conversion of a `PartialViewConfig` into a `ViewConfig` to a separate function so that it can be reused.
Changelog:
[Internal]
Reviewed By: JoshuaGross
Differential Revision: D25084469
fbshipit-source-id: 8a7f53ff2c68860697c791c37a6abbfd3213a0f9
Summary:
Fixes types in `registerGeneratedViewConfig` and also removes some unnecessary hacks for the `ReactNativeViewViewConfig` type.
Changelog:
[Internal]
Reviewed By: JoshuaGross
Differential Revision: D25076608
fbshipit-source-id: 5cb2060e11db598b42fbb7f2f8aecfd7f4b262ef
Summary:
Cleans up the Flow types for React Native ViewConfig. After this diff, we will have two new canonical types:
- `ViewConfig` which is what we get from native and what is registered in the `ReactNativeViewConfigRegistry`.
- `PartialViewConfig` which is what we generate statically and augment at runtime before registering with the `ReactNativeViewConfigRegistry`.
Changelog:
[Internal]
Reviewed By: JoshuaGross
Differential Revision: D25075299
fbshipit-source-id: 4b53927b2db437b615447b711e83db355d0cfa55
Summary:
Hoists the call to `getNativeComponentAttributes` out of the verification function so that it's easier to keep track of when this function is and is not called.
The purpose of this will become clearer in a future refactor.
Changelog:
[Internal]
Reviewed By: ejanzer
Differential Revision: D25072600
fbshipit-source-id: bc42461baae3476fa7ecb6186c4256dd23921ed5