-
Notifications
You must be signed in to change notification settings - Fork 24.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Android] [Added] Add showSoftInputOnFocus to TextInput #25028
[Android] [Added] Add showSoftInputOnFocus to TextInput #25028
Conversation
By default is true. If set to false, it will prevent the soft input from displaying when the field is focused.
Thank you for your pull request and welcome to our community. We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file. In order for us to review and merge your code, please sign up at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need the corporate CLA signed. If you have received this in error or have any questions, please contact us at cla@fb.com. Thanks! |
Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Facebook open source project. Thanks! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mdvacca is landing this pull request. If you are a Facebook employee, you can view this diff on Phabricator.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
👍 |
This pull request was successfully merged by valerio.ponte in d88e470. When will my fix make it into a release? | Upcoming Releases |
Will this be iOS as well? |
Hmm as far as I could tell in my tests iOS isn’t affected by the same behavior, i.e. it’s possible to have an input text that doesn’t open the soft input when opened. But tbh, it’s possible I’m missing something here. |
Summary: Add prop showSoftInputOnFocus to TextInput. This fixes facebook#14045. This prop can be used to prevent the system keyboard from displaying at all when focusing an input text, for example if a custom keyboard component needs to be displayed instead. On Android, currently TextInput always open the soft keyboard when focused. This is because `requestFocus` calls `showSoftKeyboard`, which in turn instructs `InputMethodManager` to show the soft keyboard. Unfortunately even if we were to define a new input type that extends ReactEditText, there is no way to overcome this issue. This is because `showSoftKeyboard` is a private method so it can't be overriden. And at the same time `requestFocus` needs to invoke `super.requestFocus` to properly instruct Android that the field has gained focused, so overriding `requestFocus` in a subclass of ReactEditText is also not an option, as when invoking `super.requestFocus` we would end up calling again the one defined in ReactEditText. So currently the only way of doing this is to basically add a listener on the focus event that will close the soft keyboard immediately after. But for a split second it will still be displayed. The code in the PR changes `requestFocus` to honor showSoftInputOnFocus as defined in Android TextView, displaying the soft keyboard unless instructed otherwise. ## Changelog [Android] [Added] - Add showSoftInputOnFocus to TextInput Pull Request resolved: facebook#25028 Differential Revision: D15503070 Pulled By: mdvacca fbshipit-source-id: db4616fa165643d6ef2b3185008c4d279ae08092
Summary: Add prop showSoftInputOnFocus to TextInput. This fixes facebook#14045. This prop can be used to prevent the system keyboard from displaying at all when focusing an input text, for example if a custom keyboard component needs to be displayed instead. On Android, currently TextInput always open the soft keyboard when focused. This is because `requestFocus` calls `showSoftKeyboard`, which in turn instructs `InputMethodManager` to show the soft keyboard. Unfortunately even if we were to define a new input type that extends ReactEditText, there is no way to overcome this issue. This is because `showSoftKeyboard` is a private method so it can't be overriden. And at the same time `requestFocus` needs to invoke `super.requestFocus` to properly instruct Android that the field has gained focused, so overriding `requestFocus` in a subclass of ReactEditText is also not an option, as when invoking `super.requestFocus` we would end up calling again the one defined in ReactEditText. So currently the only way of doing this is to basically add a listener on the focus event that will close the soft keyboard immediately after. But for a split second it will still be displayed. The code in the PR changes `requestFocus` to honor showSoftInputOnFocus as defined in Android TextView, displaying the soft keyboard unless instructed otherwise. ## Changelog [Android] [Added] - Add showSoftInputOnFocus to TextInput Pull Request resolved: facebook#25028 Differential Revision: D15503070 Pulled By: mdvacca fbshipit-source-id: db4616fa165643d6ef2b3185008c4d279ae08092
Hi,
The soft keyboards still pop up |
Summary: Add prop showSoftInputOnFocus to TextInput. This fixes #14045. This prop can be used to prevent the system keyboard from displaying at all when focusing an input text, for example if a custom keyboard component needs to be displayed instead. On Android, currently TextInput always open the soft keyboard when focused. This is because `requestFocus` calls `showSoftKeyboard`, which in turn instructs `InputMethodManager` to show the soft keyboard. Unfortunately even if we were to define a new input type that extends ReactEditText, there is no way to overcome this issue. This is because `showSoftKeyboard` is a private method so it can't be overriden. And at the same time `requestFocus` needs to invoke `super.requestFocus` to properly instruct Android that the field has gained focused, so overriding `requestFocus` in a subclass of ReactEditText is also not an option, as when invoking `super.requestFocus` we would end up calling again the one defined in ReactEditText. So currently the only way of doing this is to basically add a listener on the focus event that will close the soft keyboard immediately after. But for a split second it will still be displayed. The code in the PR changes `requestFocus` to honor showSoftInputOnFocus as defined in Android TextView, displaying the soft keyboard unless instructed otherwise. ## Changelog [Android] [Added] - Add showSoftInputOnFocus to TextInput Pull Request resolved: #25028 Differential Revision: D15503070 Pulled By: mdvacca fbshipit-source-id: db4616fa165643d6ef2b3185008c4d279ae08092
Hi! I'm using RN 0.60.4 Try to set property showSoftInputOnFocus={false} on a TextInput but still without any effect, the keyboard still shows up!! |
Have you tried RN 0.60.5? According to release notes it should have included this PR. |
@plouh Thanks!! Upgrading to latest RN 0.60.5 and using property showSoftInputOnFocus={false} now the keyboard doesn't shows up. Excellent!! That's what I wanted!! |
On IOS the keyboard still shows up even with showSoftInputOnFocus={false}, any workaround? |
Using react-native 0.61.2 it too doesn't seem to work on android |
@riso how did you 'have an input text that doesn’t open the soft input when opened' on iOS, I cannot find any mention of a solution. |
Summary: Add prop showSoftInputOnFocus to TextInput. This fixes facebook#14045. This prop can be used to prevent the system keyboard from displaying at all when focusing an input text, for example if a custom keyboard component needs to be displayed instead. On Android, currently TextInput always open the soft keyboard when focused. This is because `requestFocus` calls `showSoftKeyboard`, which in turn instructs `InputMethodManager` to show the soft keyboard. Unfortunately even if we were to define a new input type that extends ReactEditText, there is no way to overcome this issue. This is because `showSoftKeyboard` is a private method so it can't be overriden. And at the same time `requestFocus` needs to invoke `super.requestFocus` to properly instruct Android that the field has gained focused, so overriding `requestFocus` in a subclass of ReactEditText is also not an option, as when invoking `super.requestFocus` we would end up calling again the one defined in ReactEditText. So currently the only way of doing this is to basically add a listener on the focus event that will close the soft keyboard immediately after. But for a split second it will still be displayed. The code in the PR changes `requestFocus` to honor showSoftInputOnFocus as defined in Android TextView, displaying the soft keyboard unless instructed otherwise. ## Changelog [Android] [Added] - Add showSoftInputOnFocus to TextInput Pull Request resolved: facebook#25028 Differential Revision: D15503070 Pulled By: mdvacca fbshipit-source-id: db4616fa165643d6ef2b3185008c4d279ae08092
Need this feature in iOS too |
Summary: `showSoftInputOnFocus` was added in #25028, but it was only added for Android. There was a lot of discussion on the original issue being addressed (#14045), that there is a need for this on iOS as well. The issue with iOS was brought up again on #27243. On a related note, when searching this repo's issues for `showSoftInputOnFocus`, it appears that there are several closed issues that claim that the Android implementation doesn't work (#25685, #25687, #26643). So perhaps the Android implementation needs to be looked at as well (I myself have not gotten around to confirming whether it works or not) ## Changelog [iOS] [Added] - Add showSoftInputOnFocus to TextInput Pull Request resolved: #28834 Test Plan: You'd use this just like you would in the Android implementation: ```jsx <TextInput showSoftInputOnFocus={false} /> ``` ## GIFs ### Before change ![May-04-2020 20-52-49](https://user-images.githubusercontent.com/4932784/81034028-9d89cf80-8e4a-11ea-906c-64f62504f80c.gif) ### After change ![May-04-2020 20-54-27](https://user-images.githubusercontent.com/4932784/81034035-a11d5680-8e4a-11ea-918e-119a1c9e2a19.gif) Differential Revision: D21418763 Pulled By: shergin fbshipit-source-id: 561e72fc2cf16b30446132f6b96b8aa2b4a92daf
thanks <3 |
* Remove `docs` from `jscodeshift` Summary: I removed 1 MiB from `jscodeshift` as it was shipping with docs: https://github.com/facebook/jscodeshift/commit/5885662920ed7a3077da22beed4a8f76743dd19c Changelog: [Internal] Reviewed By: yungsters Differential Revision: D21368889 fbshipit-source-id: 452fd4cedcc749d972adbb69df5c95117dd55b15 * iOS: when the bridge has been invalidated, NativeModule lookup should just return nil Summary: There's a corner case where: * The bridge gets invalidated, and native modules are cleaning up themselves (but not done yet) * Something asks for a NativeModule instance - ideally it should just get nil at this point * If TM Manager is invalidating, we get nil correctly, but we continue thru the old NativeModule lookup logic * The latter will fail anyway, and would throw a redbox (RCTLogError). So, if the bridge is invalidated, if TM Manager returns nil, we should just return nil for old NativeModule lookup. The module of interest is RCTImageLoader, which was requested by RCTImageView on deallocation. The problem is RCTImageView got dealloc'ed **after** the bridge has been invalidated, so the lookup would always fail... Bonus: RCTImageView should just keep a weak ref to the RCTImageLoader, so that: * if the imageLoader is still alive on image dealloc, it can still access them (last minute "meaningless" cleanup) * if the imageLoader is gone, then the image deallocation doesn't do anything Changelog: [iOS] [Fixed] - Fix module lookup race condition on bridge invalidation. Reviewed By: p-sun, sammy-SC Differential Revision: D21371845 fbshipit-source-id: 862dc07de18ddbfb90e87e24b8dbd001147ddce4 * Fix invalid type annotations Summary: Our parsers accept these but they are invalid. This fixes them. Changelog: [Internal] Reviewed By: yungsters Differential Revision: D21373812 fbshipit-source-id: 6084757b9f842644fe629ae5e6d85baec611588d * Fixes TextInput shaking when typing Chinese (#28805) Summary: Fixes https://github.com/facebook/react-native/issues/28488. ## Changelog [iOS] [Fixed] - Fixes TextInput shaking when typing Chinese Pull Request resolved: https://github.com/facebook/react-native/pull/28805 Test Plan: Demo see https://github.com/facebook/react-native/issues/28488. Differential Revision: D21376803 Pulled By: shergin fbshipit-source-id: b1fe6cc5f67d42ef98a6c12b8ab9990feac0e2a7 * VirtualizedList: Migrate to React.Context Summary: Migrates `VirtualizedList` off legacy context by creating `VirtualizedListContext`. Changelog: [General][Changed] - Migrated `virtualizedList` legacy context to `React.Context`. Reviewed By: TheSavior Differential Revision: D21370882 fbshipit-source-id: 2fa99ee0bc0e6b747a2d3fe7c66ee402c6b9c5af * VirtualizedList: Remove `PropTypes` Dependency Summary: Removes `PropTypes` as a dependency of `VirtualizedList` by no longer validating the return value of `getItemLayout`. Changelog: [Internal] Reviewed By: TheSavior, cpojer Differential Revision: D21370890 fbshipit-source-id: 966db3557b714987aa91179c7654a5ebf27818ad * Remove `@babel/preset-env` Summary: `babel/preset-env` pulls in a number of unused deps, like `caniuse-lite` (3 MiB) that knows about which browsers support certain features. We do not ship to browsers and always know which version of node we are using, so we don't need to pull this in. I changed `jscodeshift` to optionally depend on `babel/preset-env` instead of always pulling it in. This reduces node_modules by 7 MiB. Changelog: [Internal] Reviewed By: yungsters Differential Revision: D21374475 fbshipit-source-id: 6f55e96e990ec0ca12f17bb3657bfa5429796b93 * Add prepareForReuse to RCTSafeAreaViewComponentView Summary: Changelog: [internal] As part of recycle, we should delete state. This is a common pattern used in other components as well. Reviewed By: shergin Differential Revision: D21348782 fbshipit-source-id: a5dee2f4ccee9b19498db31dab1983d8879dca71 * chore: remove Kotlin version from the default template (#28626) Summary: The default application requires Kotlin version that is not supported by the Gradle plugin (should be at least `1.3.10`). However, instead of upgrading, we should remove it entirely. Here's why. This commit https://github.com/facebook/react-native/commit/29d3dfbd196176af98c9727c82ff2668e697d78e introduced Detox for RNTester Android application. Since the commit doesn't mention Detox for the default application and there are no Detox tests present by default in the default application, I believe that this addition was performed by a mistake. The best way is to remove Kotlin from the default template. This step is described in the Detox documentation and all users that are integrating Detox will be asked to perform it anyway. No need to do it for them. ## Changelog [ANDROID] [INTERNAL] - remove Kotlin from the default template Pull Request resolved: https://github.com/facebook/react-native/pull/28626 Test Plan: Building a brand new project with `master` should work Differential Revision: D21388961 Pulled By: shergin fbshipit-source-id: 92666aa67f92b29f4e7f9c036b332bd058cdd49e * Fix Optimized Differ (was generating extraneous Create mutations) Summary: When we call `.erase` on the TinyMap, it sets the key of the element to 0. When we call `.begin()` later, TinyMap will sometimes, but not always, clean up the underlying Vector. This means that *most* of the time, underlying erased elements will be removed from the Vector; but sometimes erased elements will still be there when iterating over it. This was causing us to generate extra "Create" mutations. To fix this, for now we just check for zeroed-out elements when iterating over the vector. Changelog: [Internal] Reviewed By: mdvacca Differential Revision: D21389371 fbshipit-source-id: 1e641050987d40a3f3e31499dcb373cfb28ae6f8 * Add warning when scrollRef does not have a scrollTo method Summary: Add a `console.warn()` call when calling `_scrollRef.scrollTo`, because `scrollTo` is not guaranteed to exist on `_scrollRef`. Context: `VirtualizedList` holds `_scrollRef`, which is usually a reference to a `ScrollView` component. However, there are several cases where it holds a `View` or other type of component instead. A custom component can be passed in to `renderScrollComponent`, and then `_scrollRef` will point to that custom component. Additionally, if two VirtualizedLists are nested with the same orientation, `_defaultRenderScrollComponent` will return a View instead of a ScrollView. Due to these possibilities, `_scrollRef` is not guaranteed to have a `scrollTo` method. Changelog: [General] [Added] - Add warning when scrollRef does not have a scrollTo method Reviewed By: JoshuaGross, TheSavior Differential Revision: D21386842 fbshipit-source-id: 01e167e0ae0edea8f29853e8b242ce88a5103b49 * Don't use #import in C++ Code (#28825) Summary: While #import is common in Objective C, it's a vendor specific extension in C++, only supported by GCC/Clang, and only when -pedantic is off. Its use causes build breaks with MSVC. Replace it with the standard #include. ## Changelog [Internal] [Fixed] - Don't use #import in C++ Code Pull Request resolved: https://github.com/facebook/react-native/pull/28825 Test Plan: We've ben running this change within react-native-windows for some time. Differential Revision: D21391233 Pulled By: shergin fbshipit-source-id: c0f94f314c46d6ac24067bbdcd5aaaeec9da283f * Fix unit test compilation on Android Summary: Before, compilation fails with P130281113. After fixing BUCK target, fails with P130281201. After all changes, the tests succeed. Changelog: [Internal] Reviewed By: mdvacca Differential Revision: D21390996 fbshipit-source-id: c85aa43b3ef7fc9642d226ae706c937b2a5a408d * Support calling LayoutAnimation APIs in Fabric from JS Summary: Call Fabric's LayoutAnimation APIs from JS. Changelog: [Internal] A step towards supporting LayoutAnimations on Fabric Reviewed By: shergin, mdvacca Differential Revision: D21297975 fbshipit-source-id: 6d530b01d8152e7c803a7c0299b918a32fb39dc0 * Differ: fix TinyMap to prevent possible crashes in `find()` and `begin()`, and prevent erased elements from being iterated over Summary: The core issue solved in D21389371 was that erased elements of a TinyMap were being iterated over, because TinyMap has somewhat-complicated logic around cleaning out the underlying vector. In some very marginal cases, vectors were not being cleaned and an iterator pointing at erased elements was being returned. The diff prevents some possible crashes in `begin()` and `find()` while making it much less likely to iterate over erased elements. We also add a unit test to catch the case fixed in D21389371, in particular. We also are keeping the code added in D21389371 (for now) since it's a cheap check, and will be a safeguard until we have rigorous testing around TinyMap. To be clear that logic should noop currently, but will prevent crashes in case guarantees around TinyMap change in the future. Currently there is only one line of code that actually uses the TinyMap iterator, so this should be safe. Reviewed By: shergin Differential Revision: D21392762 fbshipit-source-id: 36dc998958c230fad01af93338974f8889cbcf55 * Allow passing partial contentOffset to ScrollView on Android (#28817) Summary: Since support for contentOffset was added to horizontal ScrollView on android (30cc158a875a0414cf53d4d5155410eea5d5aeea) I'm seeing a crash in my app because of a library. What happens is that it passes a partial object for contentOffset so something like `{x: 1}` which causes a crash on Android. According to the flow types the object should always contain both x and y but I think we should preserve the runtime behaviour and just use 0 like iOS does. ## Changelog [Android] [Fixed] - Allow passing partial contentOffset to ScrollView on Android Pull Request resolved: https://github.com/facebook/react-native/pull/28817 Test Plan: Tested that passing partial object for contentOffset does not crash. Reviewed By: JoshuaGross Differential Revision: D21396319 Pulled By: shergin fbshipit-source-id: 4b52c868e3bfe183ff7f68a76ac34d1abd5e1069 * Pass initial props to WrapperComponent Summary: `renderApplication` receives the root component that we need to render and an optional wrapper component. There are cases where we want to use the initial props passed to the root component in the wrapper component as well (e.g.: to provide a specific context to the root component), so this adds modifies `AppContainer` to accept the initial props and inject them into the wrapper component. Changelog: [General] [Added] - Modified `renderApplication` to forward `initialProps` to `WrapperComponent` Reviewed By: fkgozali Differential Revision: D21347486 fbshipit-source-id: 1c4f702a3875077630de1a44d3ac9ef2c80bc10c * Upgrade to Jest 26 Summary: * Brings performance improvements from 25.5.x * Reduces node_modules by 3 MiB, see https://github.com/facebook/jest/pull/9950/files?short_path=63580dd#diff-63580dd1e7078ce037f10f2fee7553b9 * Breaking changes: https://github.com/facebook/jest/blob/master/CHANGELOG.md Changelog: [Internal] Reviewed By: rubennorte Differential Revision: D21369069 fbshipit-source-id: 81a9d50f8e541293a85ce3957cb962930ca05b11 * Make column match fuzzy Summary: We are currently very strict about breakpoint location matching. This diff allows some fuzz in the column, but not in the line. Changelog: [Internal] Setting Hermes breakpoints no longer requires exact column match Reviewed By: avp Differential Revision: D21343198 fbshipit-source-id: a59786a9d63f9fe1ed576835ed660ba3343affe1 * Fix type of exported Touchables: ComponentType -> AbstractComponent (#28737) Summary: Fixes https://github.com/facebook/react-native/issues/28726 When importing TouchableOpacity, it is treated as any by Flow. Replacing ComponentType with AbstractComponent works. The [Flow documentation](https://flow.org/en/docs/react/types/#toc-react-componenttype) says the following about ComponentType: > Note: In 0.89.0+, React.ComponentType is an alias for React.AbstractComponent<Config, any>, which represents a component with config type Config and any instance type. So I'm thinking that since the instance type is treated as any with ComponentType, Flow treats TouchableOpacity as any as well. ## 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] - Fix Touchable{Opacity,Bounce,Highlight} being exported as `any` (Flow) Pull Request resolved: https://github.com/facebook/react-native/pull/28737 Test Plan: I have done the same changes to react-native in my project's node_modules and seen that the components TouchableOpacity went from any to AbstractComponent with some props. Now I have a bunch of errors because I'm sending in wrong props to some touchables, which is good! Reviewed By: cpojer Differential Revision: D21362601 Pulled By: TheSavior fbshipit-source-id: 5b98cc79eaef034eccdb7f47242f9f44be2ef2b8 * Import folly and adjust whitespace to match old codegen Summary: Import folly to handle optionals (`folly::Optional<__type__>`) Sort modules and indent generated code to match output from the old codegen. While not strictly necessary as these are generated files that should not be edited by hand, I found that matching the old codegen in this regard made it less of a chore when it came to comparing the output of both codebases. Changelog: [Internal] Reviewed By: RSNara Differential Revision: D21395231 fbshipit-source-id: 289d617d7a2d93724456c80afea57a49c108cb9b * Update native module specs Summary: As titled. Reviewed By: fkgozali Differential Revision: D21417307 fbshipit-source-id: 7c6b0179f9f1a5108da241d181a24f707a083deb * Smoother scrolling in ScrollView, HorizontalScrollView Summary: Android ScrollView/HorizontalScrollView `smoothScrollTo` contains some logic that, if called multiple times in a short amount of time, will treat all calls as part of the same animation and will not lengthen the duration of the animation. This means that, for example, if the user is scrolling rapidly, multiple pages could be considered part of one animation, causing some page animations to be animated very rapidly - looking like they're not animated at all. We use a custom animation to perform `smoothScrollTo` to improve the UX. This resolves a longstanding issue in non-Fabric RN, as well as Fabric, since this code is shared between the platforms. Changelog: [Update] Android ScrollView/HorizontalScrollView scrolls using custom animations instead of default Android `smoothScrollTo` implementation, leading to smoother scrolls for paginated ScrollViews Reviewed By: mdvacca Differential Revision: D21416520 fbshipit-source-id: 6ebe63cb054a98336b6e81253d35623fe5522f89 * Cleanup unused dependencies Reviewed By: kassens Differential Revision: D21281288 fbshipit-source-id: cf566ad0628dc179b3753f2f25a11637c33dee24 * iOS: Animated image should animate at the same speed regardless of framerate Summary: In iOS 11, [CADisplayLink](https://developer.apple.com/documentation/quartzcore/cadisplaylink)'s frameInterval was deprecated in favor of preferredFramesPerSecond, but these two properties have different underlying assumptions. - set frameInterval to 2 for 30fps - set preferredFramesPerSecond to 30 for 30fps. When you use preferredFramesPerSecond, assume frameInterval is 1. This fix ensures gifs in <Image> component will animate at same speed regardless of framerate. Reviewed By: shergin Differential Revision: D21414014 fbshipit-source-id: 40ab23bab1990cf65d2802830b6835f350999537 * LogBox - Always display the first fatal error Summary: This diff fixes an off-by-one error probably caused by my font ligatures where when exactly two exceptions are thrown at the same time we would show the second exception instead of the first. If three or more were thrown, we would show the second. I also fixed some tests that had the wrong descriptions and wrong behavior enforced. Changelog: [Internal] Reviewed By: cpojer Differential Revision: D21413186 fbshipit-source-id: 8e2940c89251dc042b10c6a2a2186089b6e7b53d * Rename error titles Summary: Based on feedback we're updating these titles to be more clear for their source. Changelog: [Internal] Reviewed By: cpojer Differential Revision: D21413486 fbshipit-source-id: c144e7f759a4ff263b7ec80fa643eeb8ffac741b * Moved some NativeModule JS specs to OSS Summary: For some reason the specs were internal, but the native impl is still in github. So let's move these to github for consistency. Changelog: [Internal] Reviewed By: hramos Differential Revision: D21419934 fbshipit-source-id: f2c4486edca43c4348f3a3c6ce98f76a322bab0b * Deploy Flow v0.124.0 to xplat/js Summary: Changelog: [Internal] allow-large-files Reviewed By: samwgoldman, cpojer Differential Revision: D21413059 fbshipit-source-id: f3d111b40bfb88c182eab022925f7ae2dc47bc6b * RN: Workaround Fabric + Virtual Text Press Bug Summary: Workaround for a bug with Fabric when pressing on virtual text. Changelog: [Internal] (Note: this ignores all push blocking failures!) Reviewed By: JoshuaGross Differential Revision: D21432793 fbshipit-source-id: fe20eeadd5365707fb71edae7a76d374e26b4c86 * Fabric: Backward-compatible behaviour of `measureInWindow` and `measure` Summary: Before this change, in case of incorrect measurements, Fabric's implementation of `measure` and `measureInWindow` incorrectly returned negative height and width. Now it returns zeros (as classic React Native does). Fabric: This does not fix `measureLayout` called for virtual nodes. This is not so trivially to fix and it will be done separately. Changelog: [Internal] Fabric-specific internal change. Reviewed By: JoshuaGross, yungsters, mdvacca Differential Revision: D21433239 fbshipit-source-id: fbaf5ee35c690506822c634daac4426542c2cdcf * Upgrade to Yargs 15 Summary: Only breaking changes appear to be dropped Node 6 support: https://github.com/yargs/yargs/blob/master/CHANGELOG.md. Deduplicates quite a few copies of Yargs, yay! Changelog: [Internal] (Note: this ignores all push blocking failures!) Reviewed By: motiz88 Differential Revision: D21426137 fbshipit-source-id: b091e29ac2d9464d6ce9a716a99f7ae156a91a01 * Ez Extend logging of Fabric Summary: Quick diff to log of content of UpdateState mount item. This is useful for debugging. Note this will ONLY be logged when the constant FabricUIManager.IS_DEVELOPMENT_ENVIRONMENT is set to true changelog: [Internal][Android] internal log for fabric android Reviewed By: JoshuaGross Differential Revision: D21428345 fbshipit-source-id: d000eb6dbdd39d15935fa2102072790e17372682 * Fix measureLayout function for Virtual Nodes Summary: This diff fixes a NullPointerException thrown when calling measureLayout function on a virtual node. changelog: [Android] Fix measureLayout function for VirtualTexts Reviewed By: JoshuaGross Differential Revision: D21435030 fbshipit-source-id: aba6d81f333464e49d2d769b111842e7ae8ce769 * Update cocoapods (#28833) Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/28833 The checked-in RNTester podfile was generated using Cocoapods version 1.9.1. This doesn't match the version currently used in CircleCI, which is 1.8.4. In order to update the offline mirrors and land them without breaking CircleCI, it seems we need to switch back to 1.8.4. This diff updates the podfile back to 1.8.4 and updates the offline mirrors. Reviewed By: fkgozali Differential Revision: D21392989 fbshipit-source-id: b14aa6e2798175534e9416410ba9d6877fb718c0 * Fabric: Introducing `RunLoopObserver` Summary: `RunLoopObserver` is one of the core interfaces that bridge intrinsically platform-specific functionality to cross-platform React Native core. `RunLoopObserver` allows subscribing for notifications about changes in a run loop life cycle. Primarily it supposed to be used for observing UI (aka main) and JavaScript execution thread/run-loop. Having a `RunLoopObserver` implemented in a platform-specific manner allows building these components in a cross-platform manner: * Sync and async UI event delivery pipeline; * Timing for some animation engine; * Timers (probably additional features are required). Changelog: [Internal] Fabric-specific internal change. Reviewed By: sammy-SC Differential Revision: D21341997 fbshipit-source-id: 7ef61fb51f550dd0f2e89c64af657e0f0de029aa * Fabric: Cross-platform implementation of `SynchronousEventBeat` and `AsynchronousEventBeat` Summary: `SynchronousEventBeat` and `AsynchronousEventBeat` are a cross-platform re-implementation of run loop related parts of `MainRunLoopEventBeat` and `RuntimeEventBeat` (iOS specific classes for now). In the future, they will replace iOS- and Android-specifc event beat classes. Changelog: [Internal] Fabric-specific internal change. Reviewed By: sammy-SC Differential Revision: D21341996 fbshipit-source-id: 8eda9a5df537cd666b7728e32212a8bb5ddb3ab7 * third-party | Move glog from xplat/third-party to third-party and create temporary redirect. Summary: Move and create an empty rule that redirects as well, to handle //arvr rules Need to do this way, since ovrsource sync rules are in different repo. allow_many_files allow-large-files Steps: - [X] Move glog from xplat/third-party to /third-party - [ ] Update references in ovrsource to translate to //third-party instead of //xplat/third-party - [ ] Get rid of temporary rule - [ ] Update fbsource/third-party/glog to 0.3.5 (what we have in ovrsource) Changelog: [Internal] Update reference for glog from xplat/third-party to /third-party. Reviewed By: yfeldblum Differential Revision: D21363584 fbshipit-source-id: c1ffe2dd615077170b03d98dcfb77121537793c9 * Fix Animated type Summary: - Fixed typing of Animated and fixed the callsites Changelog: [Internal] Reviewed By: kacieb Differential Revision: D21311870 fbshipit-source-id: 386fb496ab00ef7917273dc3eb65e1ed76a8dd33 * Add virtual destructor to JSError Summary: We consume Hermes through multiple .so's, which means we have multiple (weak) typeinfo definitions of facebook::jsi::JSError. Previously we were using gnustl, which would strcmp typeinfo to decide whether a certain exception handler applies, which meant this didn't cause any major issues. However since this is deprecated, we recently switched to libc++, which does not have this by behaviour (or it does, but behind a flag I'm not sure how to enable). This causes any JS exceptions to fall through from our exception handlers and fatal the app. This problem is actually documented in the common Android NDK problems page: https://android.googlesource.com/platform/ndk/+/master/docs/user/common_problems.md#rtti_exceptions-not-working-across-library-boundaries The suggested solution is to ensure that any exception types have a key function defined (a non-pure, out-of-line virtual function). The simplest one to add is a virtual destructor. This makes the object file that holds the implementation of the destructor export a non-weak typeinfo definition which will at load time override the other weak versions. I'm not sure why we're the first to hit this. RN's JSIExecutor doesn't explicitly reference JSError which probably helps (https://github.com/facebook/react-native/blob/master/ReactCommon/jsiexecutor/jsireact/JSIExecutor.cpp#L256-L258) and they also don't use unguarded callbacks like we do. Changelog: [Internal] Reviewed By: mhorowitz Differential Revision: D21426524 fbshipit-source-id: 474284ada1ca2810045dc4402c420879447f9308 * Handle initialProps as optional in renderApplication Summary: Pass a default empty object to `AppContainer` if no `initialProps` were passed to `renderApplication`. This prevents issues on Android, where we do not pass a default empty `initialProps` from native, as we do on iOS. Changelog: [General] [Fixed] - Handle nullish `initialProps` correctly in `renderApplication` Reviewed By: motiz88 Differential Revision: D21448692 fbshipit-source-id: 9630bdc2414532999abf3bf9da25047f0482fcab * Enable with CocoaPods `:configuration` (#28796) Summary: ~~⚠️ Depends on https://github.com/facebook/flipper/pull/1086 and a new Flipper release.~~ Fixes https://github.com/facebook/react-native/commit/17f025bc26da13da795845a3f7daee65563420c0#commitcomment-38831234 Currently user’s are being told to add a definition of the `FB_SONARKIT_ENABLED` macro and examples, including those in stock React Native templates, set this for the user by making use of a `post_install` hook in the user’s `Podfile`. This leads to confusion, fragile code [when a user’s project dir structure deviates from vanilla], and is ultimately not necessary as CocoaPods already has dedicated mechanisms to: * specify build settings (through the `xcconfig` property); * and selectively include certain pods only in certain build configurations (e.g. debug). ## 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] [Changed] - Entirely control Flipper being enabled through inclusion in Podfile and optionally limiting to certain build configurations using the `:configuration` directive. Pull Request resolved: https://github.com/facebook/react-native/pull/28796 Test Plan: Tested using the changes of https://github.com/facebook/flipper/pull/1086 in a new app that uses RN `master`. Reviewed By: priteshrnandgaonkar Differential Revision: D21449754 Pulled By: passy fbshipit-source-id: 9ff7c7f4ffc32b364b1edd82b94e0b80c3997625 * Support excluding multiple platforms. Summary: Currently the schema only allows to exclude a single platform (iOS OR Android). There are cases where we need to exclude multiple. This change converts the previous `excludePlatform` string property into an `excludePlatforms` array. Changelog: [Internal][Changed] - Added support to exclude multiple platforms in Codegen. Reviewed By: sammy-SC Differential Revision: D21426950 fbshipit-source-id: eff36ffa207109274794b4b300bf6313f8286161 * Extend ParagraphAttribute to store the includeFontPadding prop Summary: This diff extends the ParagraphAttribute class to store the value of the includeFontPadding prop. Note that this is an Android only prop, I'm not creating android blocks to improve "cleanliness" of the code. changelog: [Internal][Fabric] Internal change in Fabric to support Text.includeFontPadding prop in fabric Reviewed By: shergin Differential Revision: D21446738 fbshipit-source-id: 0543e86aa18ce10f7a56bbaafe111cce0179ea86 * Extend Text measurement to support includeFontPadding prop Summary: This diff exposes the Text.includeFontPadding prop to java, then it uses the prop to calculate the height of Text components correctly. changelog: [Internal][Fabric] Internal change in Fabric to support Text.includeFontPadding prop in fabric Reviewed By: shergin Differential Revision: D21446737 fbshipit-source-id: efe73fb6b0d402c3275ac8c012fa8fa06b743bdd * Small refactor on text measure method Summary: Quick refactor of TextLayoutManager class changelog: [Internal] Reviewed By: shergin Differential Revision: D21446736 fbshipit-source-id: a32bdf534b167e128c8c0054cf6a126131fa740a * Handle optional return types/values Summary: Use folly to wrap optional return types and values as needed. Changelog: [Internal] Reviewed By: RSNara Differential Revision: D21395439 fbshipit-source-id: a0e84e20717887e79a8565332a11fef42ebd3487 * Avoid redefining id when a property is named 'id' Summary: Handle properties named 'id' as a special case. An example of a native module that ran afoul of this is `ExceptionsManager`. Observe how the ExceptionsManager spec at `Libraries/Core/NativeExceptionsManager.js` defines the ExceptionData type as containing an `id` property: ``` export type ExceptionData = { message: string, originalMessage: ?string, name: ?string, componentStack: ?string, stack: Array<StackFrame>, id: number, isFatal: boolean, // flowlint-next-line unclear-type:off extraData?: Object, ... }; ``` Prior to this change, the generated code would redefine id in the SpecReportExceptionData struct... ``` namespace JS { namespace NativeExceptionsManager { struct SpecReportExceptionData { // ...redacted... double id() const; <--- // ...redacted... SpecReportExceptionData(NSDictionary *const v) : _v(v) {} private: NSDictionary *_v; }; } } ``` ...which would result in a build time error: ``` inline double JS::NativeExceptionsManager::SpecReportExceptionData::id() const { id const p = _v[@"id"]; ^--- build time error here return RCTBridgingToDouble(p); } ``` Comparing the above example with the currently checked in `FBReactNativeSpec.h`, I see the expected output should be: ``` namespace JS { namespace NativeExceptionsManager { struct SpecReportExceptionData { // ...redacted... double id_() const; // ...redacted... SpecReportExceptionData(NSDictionary *const v) : _v(v) {} private: NSDictionary *_v; }; } } ``` ...and... ``` inline double JS::NativeExceptionsManager::SpecReportExceptionData::id_() const { id const p = _v[@"id"]; return RCTBridgingToDouble(p); } ``` Changelog: [Internal] Reviewed By: fkgozali Differential Revision: D21395463 fbshipit-source-id: e412648013ff9f70ebd294b6f5f81f1faccb4604 * Eager initialize Fabric Android classes Summary: This diff eager initializes Fabric Android classes. This should help load all the Fabric classes at Bridge load time. changelog: [Internal] Reviewed By: JoshuaGross Differential Revision: D21460507 fbshipit-source-id: 4b8d5c4e2d19e3a7eb3077027071e64ff16f1cbd * Remove Hermes.setPauseOnLoad message Summary: This removes the Hermes.setPauseOnLoad. It will be replaced by the more standard Debugger.setInstrumentationBreakpoint's "beforeScriptExecution" event. ChangeLog: [Internal] Remove Hermes.setPauseOnLoad message (to be replaced) Reviewed By: mhorowitz Differential Revision: D21418219 fbshipit-source-id: 93c53801c23487f9336b322c2bd737663ec21b97 * Add support for Debugger.setInstrumentationBreakpoint Summary: This diff adds support for the "beforeScriptWithSourceMapExecution" instrumentation breakpoint via "Debugger.setInstrumentationBreakpoint". CDP describes it as a breakpoint, but we just set a flag in the inspector. A fake breakpoint ID is synthesized for optional removal later. Changelog: [Internal] Add Debugger.setInstrumentationBreakpoint to Hermes Inspector Reviewed By: mhorowitz Differential Revision: D21418218 fbshipit-source-id: 90fa49c0954980993815322d3a7effee416ed5db * label react-native-github targets Summary: For internal code attribution. Changelog: [Internal] Reviewed By: zlern2k Differential Revision: D21468924 fbshipit-source-id: 59cd2a52e0ae46bedbf54816820a5f40b684da8b * Add script to generate native modules specs with react-native-codegen Summary: Adds a script that uses `react-native-codegen` to generate FBReactNativeSpec. The generated output should not be considered ready for production use at this time. The goal of adding this script at this time is to demonstrate the current status of native modules specs code generation in open source. For example, the generated output may be used in RNTester, with some modifications due to some naming differences in react-native-codegen's output when compared to the FBReactNativeSpec files generated by the old codegen. Usage: ``` ./scripts/generate-native-modules-specs.sh ./codegen-out ``` Changelog: [Internal] Reviewed By: TheSavior Differential Revision: D21471004 fbshipit-source-id: 5ff3c57807d9ba2c91dc7fe32d227d218732b059 * Update .gitignore (#28789) Summary: When you profile your heap and memory allocations with Memory Profiler, files with *.hprof extension are created in /android folder that has big sizes (up to 600 MB for each). These files may be needed to add to gitignore. ## 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] [Added] - Add *.hprof files to gitignore Pull Request resolved: https://github.com/facebook/react-native/pull/28789 Differential Revision: D21432927 Pulled By: hramos fbshipit-source-id: a20f12645de5ca0874c9130094e2f97fe16b2203 * Codegen: Add prepublish script to build Flow files (#28827) Summary: *This is a follow-up to https://github.com/facebook/react-native/issues/28645, redone using a build script based off of Metro's build script instead of using `flow-remove-types` and `flow-copy-source`.* This pull request adds a build step to `react-native-codegen` that builds the Flow-annotated JS files so that users of the NPM module `react-native-codegen` do not need to use require hooks to be able to import it. A new build script, `scripts/build.js` is added that builds every JS file in `src/` into a `lib/` folder, and also copies over the original Flow annotated files to `lib/` with a `.js.flow` extension, so users of `react-native-codegen` can still typecheck against it using Flow. The shell scripts in `src` are also copied over. It is based off of the [build script from Metro](https://github.com/facebook/metro/blob/00867816eb9b2f69c8af9cebb523e9e4d280671a/scripts/build.js) ## Changelog [General] [Added] - Codegen: Add prepublish script to build Flow files Pull Request resolved: https://github.com/facebook/react-native/pull/28827 Test Plan: I am able to make use of the Codegen scripts without needing to use the `flow-node` CLI or the `flow-remove-types/register` require hook. Reviewed By: cpojer Differential Revision: D21412173 Pulled By: hramos fbshipit-source-id: 26ae67cdd04652ca4700a069a234a25558773cb1 * Remove RCTLogError from RCTScrollViewManager.calculateChildFrames Summary: Changelog: [Internal] Reviewed By: mdvacca Differential Revision: D21483553 fbshipit-source-id: 0c681979a4988c36cfa6f05aa5bca896590f9e3d * Enable animations in bridgeless mode on iOS Reviewed By: ejanzer Differential Revision: D21465166 fbshipit-source-id: b34e8e97330b897e20d9a4b05dba1826df569e16 * Expose RuntimeExecutor on CatalystInstance (#28851) Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/28851 This diff creates a RuntimeExecutor that uses the bridge and exposes it on CatalystInstanceImpl. Changelog: [Internal] Reviewed By: mdvacca, RSNara Differential Revision: D21051949 fbshipit-source-id: b3977fc14fa19089f33e297d29cedba0d067526d * Inject ImagePipeline into FrescoModule Summary: This diff refactors the FrescoModule in order to receive an ImagePipeline as a parameter. This is necessary to ensure the same ImagePipeline is used by every RN module changelog: [Internal][Android] Reviewed By: JoshuaGross Differential Revision: D21428346 fbshipit-source-id: 70a6cc57c8585fe74b6d0b0d1fd86c539974ec23 * Fabric: Calling JSVM GC on memory pressure event on iOS Summary: This change is especially important for Fabric when a lot of objects (mostly `ShadowNode`s) have shared ownership. Without this change, JSVM could not know that bunch of natively allocated objects should be deallocated. Changelog: [Internal] Fabric-specific internal change. Reviewed By: dulinriley Differential Revision: D21484773 fbshipit-source-id: 46e32de0f108082e60df346884c9287023156149 * TextInput: Default `blurOnSubmit` in JS Summary: Consolidates the logic for the default value of `blurOnSubmit` on `TextInput` in the JavaScript component. This only materially impacts Fabric. Changelog: [Internal] Reviewed By: mdvacca Differential Revision: D21491482 fbshipit-source-id: 16d8aba32e7d0321a4583e87e03405ea587e35d4 * Fix taps not working after scrolling / scroll position not being updated in C++ Summary: Problem: ScrollView offset was not being reported to the C++ ScrollView side of Fabric. This results in taps not working correctly, for example if you tap a button inside scroll view after you scrolled, the tap might not trigger anything. The root cause of this is our implementation of detecting whether scroll view has stopped scrolling. To make this more robust, I now require that multiple "frames" have not scrolled because it's easy to trigger race conditions by scrolling very fast. We also explicitly call `updateStateOnScroll` in a couple more places. Changelog: [Internal] Reviewed By: mdvacca Differential Revision: D21496396 fbshipit-source-id: 2e565dd2fc4fc1ce582daa8a449c520e7cb19be0 * Fabric: Changes in UIManager::getNewestCloneOfShadowNode to make it safer Summary: There is no need to use a raw pointer to a shared pointer as a return value of `UIManager::getNewestCloneOfShadowNode`. If it would be a very hot path, we could you a raw pointer to the node instead but it's not a hot path. Prooving that using a raw pointer here is safe is quite complex (and I don't know if it's safe or not). So, I changed it to just a shared pointer. Changelog: [Internal] Fabric-specific internal change. Reviewed By: JoshuaGross Differential Revision: D21464833 fbshipit-source-id: 813a3c9fca0147afb322db6855a0ce8fd2d47909 * Fabric: Making `UIManager::getRelativeLayoutMetrics` safer Summary: In this method we have to maintain a retaining pointer to the node in order to access it as a raw pointer. See also a comment in the codee. Changelog: [Internal] Fabric-specific internal change. Reviewed By: JoshuaGross Differential Revision: D21464834 fbshipit-source-id: 69f6894009509e5feca291fab12c019208933816 * Fabric: Making `UIManager::getNewestCloneOfShadowNode` even more safer Summary: We cannot use a raw pointer here because the tree might progress right after we call to `shadowTree.tryCommit` and we will get a dangling pointer as a result. Changelog: [Internal] Fabric-specific internal change. Reviewed By: mdvacca Differential Revision: D21464832 fbshipit-source-id: 3998b39d29db672da54d4adcb6be55cd3d44d862 * Fabric: Checks for corner cases in UIManager::getNewestCloneOfShadowNode Summary: We should check for corner cases. Another interesting detail is behavior. Now (and previously) we return nullptr if case we could not find the most recent node. But maybe we should return the given node instead? Changelog: [Internal] Fabric-specific internal change. Reviewed By: mdvacca Differential Revision: D21480874 fbshipit-source-id: bb943c4508ec025316a3665d652e4b5e06dd795c * OSS: fixed incorrect license headers on some files Summary: https://github.com/facebook/react-native/commit/de667fffa4589766b5b4cb3dcf148c7f10267a5d#commitcomment-39068402 had incorrect license headers. This fixed them. Changelog: [General] [Fixed] - fixed license headers on some files Reviewed By: cpojer Differential Revision: D21496796 fbshipit-source-id: f9d6b0cf4af0ecf6caacbae2396d73efbc4975fe * Fabric: Fixed incorrect name of the prop value `justifyContent=space-between` Summary: The name of the value was incorrect. Changelog: [Internal] Fabric-specific internal change. Reviewed By: mdvacca Differential Revision: D21496651 fbshipit-source-id: 464c98436bb8d5f2b6275b7eab1c32d187e2b23c * Fabric: Initializing EventBeat::OwnerBox with non-null value ahead of time Summary: We use `EventBeat::OwnerBox` in the `EventBeat` infra to represent weak ownership of classes that contain that, so those classes can ensure own life-time at some critical points. Before this diff, we stored a pointer to EventDispatcher right after we create it. However, some components that we build require to have a valid pointer from the beginning (even before the EventDispatcher is created). To satisfy this requirement, we create a dummy pointer first and use it as an owner, then we merge (share control block) the pointer to an EventDispatcher into that. It works because the owner pointer never gets dereferenced (it's `void *`), so it does not matter which object it represents while it represents correct ownership. In the future, this approach will allow us to remove the concept of `OwnerBox` completely and use just `std::weak_ptr<void>` instead. Changelog: [Internal] Fabric-specific internal change. Reviewed By: mdvacca Differential Revision: D21441109 fbshipit-source-id: 7457c77bd31cd577f38a26e28e27eb7e33b6ad24 * Fabric: Using `PlatformRunLoopObserver` instead of `MainRunLoopEventBeat` and `RuntimeEventBeat` on iOS (gated) Summary: This diff implements iOS-specific `PlatformRunLoopObserver` (and `MainRunLoopObserver`) that then being glued together with `SynchronousEventBeat` replaces `MainRunLoopEventBeat`, and then same thing glued with `AsynchronousEventBeat` replaces `RuntimeEventBeat`. So, instead of two platform-specific classes we had on iOS (for that needs), now we have only one (that can be reused for a more broad variety of applications). Changelog: [Internal] Fabric-specific internal change. Reviewed By: sammy-SC Differential Revision: D21341998 fbshipit-source-id: fafde4e678770f7fcf9c1ff87acc02812a37e708 * Fix skewX/skewY/perspective/matrix on iOS (#28863) Summary: See discussion on https://github.com/facebook/react-native/commit/c68195929b3d7f7cc1370e36f3e22b4cbd2d2707#commitcomment-38965326 This PR fixes skewX/skewY/perspective/matrix on iOS as seen on this video: https://youtu.be/LK9iOKk62nw?t=115 ## Changelog [iOS] [Fixed] Bug with skewX/skewY/perspective/matrix transforms. Pull Request resolved: https://github.com/facebook/react-native/pull/28863 Test Plan: Try that the following transform as been fixed on iOS ```tsx <View style={{ transform: [{ rotateZ: Math.PI / 2}, { skewX: Math.PI/6 }] }} /> ``` Differential Revision: D21493022 Pulled By: shergin fbshipit-source-id: 4bf3550941e8acd8fdb87fe1143b21639c95b059 * Fix skewX on Android and in the JS decomposition (#28862) Summary: This issue fixes https://github.com/facebook/react-native/issues/27649. By using 2d decomposition that transforms a skewX into a rotate/scale/rotate, the skewX issue on Android was still there which made me suspect that the issue came from the decomposition algorithm. Then I noticed that the bug existed in the JavaScript decomposition as well which led me to a fix on the JS and therefore on the Android side most likely. ## Changelog [Android] [Fixed] skewX transforms Pull Request resolved: https://github.com/facebook/react-native/pull/28862 Test Plan: Check that skewX works on Android. On JS, making sure that processTransform() doesn't skip, you can try the following sequence: ```tsx const matrix = processTransform([{ skewX: `${Math.PI / 3}rad` }]); const result = MatrixMath.decomposeMatrix(matrix); console.log({ result }); ``` Differential Revision: D21493021 Pulled By: shergin fbshipit-source-id: 89f7aca5fbfd0f0f8c6f90a26bd76bf8550acaa5 * implemented showSoftInputOnFocus for iOS (#28834) Summary: `showSoftInputOnFocus` was added in https://github.com/facebook/react-native/issues/25028, but it was only added for Android. There was a lot of discussion on the original issue being addressed (https://github.com/facebook/react-native/issues/14045), that there is a need for this on iOS as well. The issue with iOS was brought up again on https://github.com/facebook/react-native/issues/27243. On a related note, when searching this repo's issues for `showSoftInputOnFocus`, it appears that there are several closed issues that claim that the Android implementation doesn't work (https://github.com/facebook/react-native/issues/25685, https://github.com/facebook/react-native/issues/25687, https://github.com/facebook/react-native/issues/26643). So perhaps the Android implementation needs to be looked at as well (I myself have not gotten around to confirming whether it works or not) ## Changelog [iOS] [Added] - Add showSoftInputOnFocus to TextInput Pull Request resolved: https://github.com/facebook/react-native/pull/28834 Test Plan: You'd use this just like you would in the Android implementation: ```jsx <TextInput showSoftInputOnFocus={false} /> ``` ## GIFs ### Before change ![May-04-2020 20-52-49](https://user-images.githubusercontent.com/4932784/81034028-9d89cf80-8e4a-11ea-906c-64f62504f80c.gif) ### After change ![May-04-2020 20-54-27](https://user-images.githubusercontent.com/4932784/81034035-a11d5680-8e4a-11ea-918e-119a1c9e2a19.gif) Differential Revision: D21418763 Pulled By: shergin fbshipit-source-id: 561e72fc2cf16b30446132f6b96b8aa2b4a92daf * Fabric: Support for sync `RuntimeExecutor` in `executeSynchronouslyOnSameThread_CAN_DEADLOCK` Summary: The approach is quite simple: we check the thread id, and if it matches the caller thread id, we unlock mutexes which lead to the normal uninterrupted execution flow. Changelog: [Internal] Fabric-specific internal change. Reviewed By: RSNara Differential Revision: D21328313 fbshipit-source-id: 4290b8a0357dbad3563d7da9464c03ecce5ded7c * Use plugin architecture for Paragraph component Summary: Leverage plugin infra for `Paragraph` Changelog: [Internal] Reviewed By: mdvacca Differential Revision: D21404704 fbshipit-source-id: 7565014f1d88c4a0a47e0f10fdb3656b8276b1d0 * Use plugins for TextInput component Summary: Leverage plugin infra for `TextInput` Changelog: [Internal] Reviewed By: mdvacca Differential Revision: D21407584 fbshipit-source-id: 48b1a69aa834ab956724e6617197da57ccf99aa7 * Use plugins for View component Summary: Leverage plugin infra for `View` Changelog: [Internal] Reviewed By: mdvacca Differential Revision: D21407611 fbshipit-source-id: d72d1e75bbd9d06c79544437bdd88f890086c587 * Move SegmentedControl components to separate file and make them function based Summary: Changelog: [Internal] Separate SegmentControl examples into separate file and make them functional based Reviewed By: mdvacca Differential Revision: D21475596 fbshipit-source-id: 19165232f2a8edefa66f122944621f93265ff704 * Add comments to a test case in LayoutableShadowNodeTest Summary: Changelog: [Internal] Reviewed By: JoshuaGross Differential Revision: D21500371 fbshipit-source-id: daec07f82f43aae9cdc31f67599e30873ca108b9 * xplat code ownership Summary: For internal code attribution. Changelog: [Internal] Reviewed By: zlern2k Differential Revision: D21496969 fbshipit-source-id: 9fa27a758df19c16fd2087ce964132eaa70dc91f * Always run the momentum scroll Runnable so scroll position is updated on Fabric Summary: This early return is a very minor perf optimization, and it complicates things on Fabric: if scroll perf logging is disabled, the scroll position in C++ (State) doesn't get updated for the scrollview. Just remove it. Always run the Runnable, no matter what. Changelog: [Internal] Reviewed By: sammy-SC Differential Revision: D21503695 fbshipit-source-id: 13dfe232d692ff544bff725a2344a66b572f5444 * Use UIManagerHelper to access EventDispatcher in ReactViewManager Summary: ReactViewManager uses the bridge (CatalystInstance) to access the UIManagerModule in its onClick method. This doesn't work in bridgeless mode, so I'm replacing this callsite with the new API, which uses UIManagerHelper + the reactTag to look up the appropriate UIManager (Paper or Fabric), and get the EventDispatcher from that. Changelog: [Internal] Reviewed By: JoshuaGross Differential Revision: D21510243 fbshipit-source-id: c2c6111e73c49ca6bf873819db8ece71c66417e4 * Mention using bundler to install cocoapods in RNTester README (#28873) Summary: This makes sure the proper version of cocoapods gets used, this will avoid noise in diffs if someone ends up updating pods with a different version. ## Changelog [Internal] [Changed] - Mention using bundler to install cocoapods in RNTester README Pull Request resolved: https://github.com/facebook/react-native/pull/28873 Test Plan: N/A Differential Revision: D21519862 Pulled By: shergin fbshipit-source-id: 3dc555bc3aee6bee10127ba5b5862302a63346c4 * Break retain cycle in RCTLegacyViewManagerInteropCoordinator Summary: Breaks retain cycle by having weak reference to bridge. Reviewed By: shergin Differential Revision: D21501419 fbshipit-source-id: 7526ceefceb59e296c6f4944cac5069cb62b33a5 * Migrate Android view managers to type-safe commands generated by JS codegen Summary: ## Changelog: [General] [Changed] - Migrate Android view managers to type-safe commands generated by JS codegen. Reviewed By: JoshuaGross, mdvacca Differential Revision: D21406461 fbshipit-source-id: 93584b240314254675a36a58c4d0c0880d6889fb * Add package name / bundle ID to bundle URL in development Summary: Adds the package name (Android) / bundle ID (iOS) as a new URL parameter named `app` in the bundle URL. This currently has no effect on Metro, which will ignore it for bundling / caching purposes. Changelog: [General] - Add package name / bundle ID to bundle URL in development Reviewed By: cpojer Differential Revision: D21429764 fbshipit-source-id: 394fe50dba72219f7594ebeac9486a8264a836a6 * Forward all bundle URL params through HMR and bundle splitting Summary: Forwards any extra parameters set on the main bundle URL (in development) to the derived bundle URLs used in hot reloading and bundle splitting. Changelog: [General] - Forward URL parameters from main bundle to hot reloaded bundles Reviewed By: cpojer Differential Revision: D21455592 fbshipit-source-id: e1c375e3b6a0f3387372f1d96498dbf7d5237a09 * imp: Add titlePlaceholder in template.config.js (#26218) Summary: In the latest `react-native-cli` we've added more flexibility for setting application title. New config key was introduced - `titlePlaceholder` - which will be changed during init process. PR: https://github.com/react-native-community/cli/pull/650 ## Changelog [General] [Added] - Introduce `titlePlaceholder` for template configuration. Pull Request resolved: https://github.com/facebook/react-native/pull/26218 Test Plan: Initialization works with the default template Differential Revision: D17091492 Pulled By: shergin fbshipit-source-id: 239110f2ad6f817d750575fa366ab49d146b36c1 * Fix opacity not being animated on Text component Reviewed By: shergin Differential Revision: D21523725 fbshipit-source-id: 80be40fd1314b7e1cbaa827ca52f917ba5bc916e * Download image of size based on image view size, not image size Summary: Changelog: [internal] Fabric asks server for images of their real size and scale, not images of size that they would take up on the screen once rendered. Also scale of the screen is incorrect. This causes images to be twice as large as they have to be. Look at the size of the first image size here in Paper, it is `{310.5, 207}`. {F235394066} If you compare it with Fabric, there it is `{800, 381}` {F235394115} It isn't just the size, but scale of request image as well. Fabric always asks for image of scale 1, unlike Paper which takes screen scale into account. Reviewed By: shergin Differential Revision: D21255794 fbshipit-source-id: 9db3ccafec1c09cedc5db5ac0a435a28a4c30c85 * Fabric: Fixed incorrect memory management in Scheduler Summary: The previous implementation was incorrect causing a memory leak. In the new approach, we use a shared pointer to optional to be able to construct that ahead of time and then fill with actual value. Changelog: [Internal] Fabric-specific internal change. Reviewed By: sammy-SC Differential Revision: D21516794 fbshipit-source-id: ddcbf8a1ad2b1f629ae4ff2842edeb7bb2a275a6 * Fixing typo in comment (#28882) Summary: I was reading the code and noticed the typo. ## Changelog Doesn't affect the code. [General] [Fixed] - Message Pull Request resolved: https://github.com/facebook/react-native/pull/28882 Differential Revision: D21529436 Pulled By: shergin fbshipit-source-id: 82929a6f1fe7b5510ee17fff547aae9d5125891c * iOS: Fix Animated image crash when CADisplayLink target in RCTWeakProxy is nil Summary: ## Problem When self is nil, this may crash in RCTUIImageViewAnimated.m. ``` _displayLink = [CADisplayLink displayLinkWithTarget:[RCTWeakProxy weakProxyWithTarget:self] selector:selector(displayDidRefresh:)]; ``` ## Fix Replace `RCTWeakProxy` with a concrete class `RCTDisplayWeakRefreshable` that has the displayDidRefresh method, that calls the displayDidRefresh method in its weak target. ### Original Github Issue https://github.com/facebook/react-native/pull/28070#issuecomment-619295254 Changelog: [iOS] [Fixed] - Fix Animated image crash when CADisplayLink target in RCTWeakProxy is nil Reviewed By: shergin Differential Revision: D21419385 fbshipit-source-id: da7c3c38f81ea54f633da7f59359e07680ea2faf * Disable animations on Android again Summary: We don't yet have native driver support for animations in bridgeless mode on Android, which leads to some weird bugs (like an overlay that never disappears). Let's just disable animations on Android again. Reviewed By: mdvacca Differential Revision: D21537982 fbshipit-source-id: b4e8882a414fecbd52dd25e02325b5c588ee68c0 * Get redbox working in bridgeless mode, disable logbox Summary: This enables redbox in bridgeless mode, by removing a dep on the bridge. It also disables full screen logbox, since I couldn't figure out how to get it working without the bridge. Reviewed By: rickhanlonii, ejanzer Differential Revision: D21440233 fbshipit-source-id: cb1730fefe1639135fdf06039031975d53f95229 * Add dark mode to loading progress Summary: This diff updates the loading banner to respect the RCTAppearance dev mode setting. Changelog: [General] [iOS] Add dark mode support to loading banner Reviewed By: fkgozali Differential Revision: D21429148 fbshipit-source-id: d7d9e778245112a19accf813dcff693f0d187a38 * Cleanup logbox imports Summary: Was looking at removing logbox from CoreModules, realized it had a bunch of extra deps. Changelog: [Internal] Reviewed By: rickhanlonii Differential Revision: D21535374 fbshipit-source-id: 2427cc66fa34635b49ac4b4fafaf0b6481f5687d * Fix precision of TextInlineViews in Android Summary: TextInlineViews in Android was incorrectly converting values to from float to int, this produced to loose precision and to render incomplete texts in some components. This diff changed the types from int to float, avoiding loose precision. The impact of this bug is not that high because in the conversion to int we were using Math.ceil(), which was already rounding the result to the next pixel. changeLog: [Android][Fixed] Fix precision of TextInlineViews in Fabric Android Reviewed By: JoshuaGross, shergin Differential Revision: D21541159 fbshipit-source-id: 4741ab96964c35af1c1b7d3e821e505ecef2efce * When debugger is attached continue to receive console messages Summary: I noticed an issue when the hermes debugger was attached. Console messages would no longer appear in the terminal. This is because the hermes inspector overrides the console object with its own to intercept messages and send them to the debug client. With this change I made it so that messages are sent to the original console as well instead of completely replacing it. Changelog: [General][Fixed] - When Hermes debugger is enabled continue to send log messages to the console Reviewed By: mhorowitz Differential Revision: D21509895 fbshipit-source-id: 6d91c4b82682e404679533be14b3e5f12e687e79 * Add support for ScrollView.centerContent in Fabric Summary: Changelog: [Internal] ScrollView didn't support centerContent prop. The implementation is copied over from Paper. I added an example of this prop in RNTester. Reviewed By: JoshuaGross Differential Revision: D21548270 fbshipit-source-id: 28f6c8d769c5a6bc1d111b33970a06b95c259132 * Pressable: Rename pressRectOffset to pressRetentionOffset to be consistent with other touchables Summary: Text and the other Touchables have this prop called pressRetentionOffset. Pressable should be consistent with that. Changelog: [Breaking][General]: Pressable: Rename pressRectOffset to pressRetentionOffset to be consistent with other touchables Reviewed By: yungsters Differential Revision: D21552255 fbshipit-source-id: 31e64bad9e48ac98e4934dd2f4c0a7f526de5cb6 * Back out "Fabric: Calling JSVM GC on memory pressure event on iOS" Summary: Reverted for now because it causes a crash. Original commit changeset: 46e32de0f108 (D21484773) Changelog: [Internal] Reviewed By: sammy-SC, kacieb Differential Revision: D21555488 fbshipit-source-id: 555a143fe8cf4c8806d910803f104271454f5797 * LayoutAnimations: have each Props struct do its own interpolation Summary: Each ComponentDescriptor becomes capable of doing its own interpolation over props for animation purposes. This new custom interpolator is called by default by the ConcreteComponentDescriptor, but `ComponentDescriptor::interpolateProps` is a virtual function and each ComponentDescriptor can provide custom interpolation if necessary. For now, only View does any actual interpolation, to support LayoutAnimations. Changelog: [Internal] Reviewed By: mdvacca Differential Revision: D20965310 fbshipit-source-id: e1c1588107848e94c155efecb0da1cc1619ae544 * Extend ReactShadowNode API to expose flex props Summary: This diff extends the ReactShadowNode API to expose flex props, this is going to be used by some components that require access to it changeLog: [Android][Added] Exposed getFlex method as part of ReactShadowNode API Reviewed By: JoshuaGross Differential Revision: D21554663 fbshipit-source-id: 26c9a3fe5f72a84120b16b553ab08231817c0efa * Fabric: Unifying interface of stub TextLayoutManager with actual ones Summary: The interface of css/TextLayoutManager now matches acual platform-specific implementations, so now CXX tests compiles and usable. Changelog: [Internal] Fabric-specific internal change. Reviewed By: sammy-SC Differential Revision: D21518656 fbshipit-source-id: cece3bea14c70410eea22abafb424f7a2cb201c0 * Delete playTouchSound from UIManagerModule Summary: This diff deletes the deprecated PlayTouchSound method from UIManagerModules. I verified there are no callsites of this method in Facebook sourcecode changelog: [BREAKING][Android] Deletes the method PlayTouchSound method from UIManagerModule, this method was moved to the SoundManagerModule class. Motivation: I'm cleaning up my fabric backlog before lockdown Reviewed By: JoshuaGross, TheSavior Differential Revision: D21487612 fbshipit-source-id: f630e2b7f927e0b607a30b9f4904feb63a561ab9 * Revisit deprecated methods in UIManagerModule and update javadoc Summary: Ez diff that revisits deprecated methods in UIManagerModule and update javadoc Motivation: I'm cleaning up my fabric backlog before lockdown changelog: [Android] Update documentation of UIManagerModule methods Reviewed By: JoshuaGross Differential Revision: D21487609 fbshipit-source-id: 896ae21e02d5b1aa57b7158d714986fd1f8c9c5c * Fix dev tool hotkets in RNTester Summary: This diff fixed hotkeys for dev tools like cmd+d, cmd+r, and cmd+i when Turbo Modules are enabled until we have a proper way to eagerly initialize turbo modules. Changelog: [Internal] Reviewed By: RSNara Differential Revision: D21517482 fbshipit-source-id: 8c68bc126361aa961a4f05c93dc19ada32fe44c7 * Introduce NativeModulePerfLogger Summary: ## Description This diff introduces `NativeModulePerfLogger`, its BUCK, Cocoapod, android-ndk targets. This diff also wires up those targets into the React Native bridge and TurboModules targets, so that we get signal on if the code compiles. This diff also introduces `TurboModulePerfLogger`, which is a namespace that holds the `NativeModulePerfLogger` that'll do perf-logging for TurboModules. ## How will perflogging work on iOS? 1. Each application will, during React Native initialization, create a NativeModule perf logger. 2. If TurboModules are enabled, we'll call `TurboModulePerfLogger::setInstance(perfLogger)`. If TurboModules are disabled, we'll call `NativeModulePerfLogger::setInstance(perfLogger)`. 3. TurboModules, when they're created and used, will log events via `TurboModulePerfLogger::getInstance()`. NativeModules (i.e: bridge modules), when they're created and used, will log events via the `NativeModulePerfLogger::getInstance()`. > **Note:** The NativeModule system will log events for non-TurboModules as well. Maybe we should log events for only NativeModules that conform to the `TurboModule` interface, when TurboModules are disabled. This'll ensure a fair comparison between the two systems. ## How will perflogging work on Android? Please see the subsequent diff. allow-large-files Changelog: [Both][Added] - Introduce `NativeModulePerfLogger` Reviewed By: PeteTheHeat Differential Revision: D21318053 fbshipit-source-id: 6ddf5b5a80bdc4076d2dd6588067e2b0ec8c2c6b * Switch TurboModules over to NativeModulePerfLogger Reviewed By: PeteTheHeat Differential Revision: D21363243 fbshipit-source-id: 9836b6651107c924ab9ab8e1ed73b156aed58d9f * Instrument RCTModuleData create Summary: `RCTModuleData` holds our NativeModule classes/objects. This diff instruments `RCTModuleData` create. Changelog: [Internal] Reviewed By: PeteTheHeat Differential Revision: D21415433 fbshipit-source-id: 7738f763c185e20f756d9bb2eff4a9493cde74e8 * Instrument module create Summary: `RCTModuleData instance` is the entry-point for creating and initializing NativeModules on iOS. This diff instruments module-create for the legacy NativeModule system. Changelog: [Internal] Reviewed By: PeteTheHeat Differential Revision: D21415435 fbshipit-source-id: 8554e41cba9105ef528a9a63c49042b99ebf8751 * Instrument JS requires Summary: This diff instruments two markers: - JSRequireBeginning: From the start of the JS require to when we start creating the platform NativeModule - JSRequireEnding: From the end of platform NativeModule create to the end of the JS require In order to accomplish this, I had modify `ModuleRegistry::ModuleRegistry()` to accept a `std::shared_ptr<NativeModulePerfLogger>`. I also had to implement the public method `ModuleRegistry::getNativeModulePerfLogger()` so that `JSINativeModules` could start logging the JS require beginning and ending. Changelog: [Internal] Reviewed By: PeteTheHeat Differential Revision: D21418803 fbshipit-source-id: 53828817ae41f23f3f04a95b1d3ac0012735da48 * Instrument async method call batch preprocessing Summary: NativeModule async method calls are queued up on the JS side, and flushed to C++ on every Native -> JS call. Before we execute the batch of async NativeModule method calls, we convert it (a JS object) from a `jsi::Value` to a `folly::dynamic` object in `JSIExecutor::callNativeModules`. Then, in `JsToNativeBridge::callNativeModules`, we convert this `folly::dynamic` object into an `std::vector<MethodCall>`, before finally looping over these `MethodCall`s and invoking each NativeModule async method call. The markers I'm adding in this diff measure this `jsi::Value -> folly::dynamic -> std::vector<MethodCall>` pre-processing. Changelog: [Internal] Reviewed By: PeteTheHeat Differential Revision: D21435455 fbshipit-source-id: 4c5a9e2b73c1a2a49d7a8f224a0d30afe3a0c79c * Instrument sync and async method calls (#28893) Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/28893 `JSIExecutor::callSerializableNativeHook` converts the arguments from `JSI::Value` to `folly::dynamic`. Then, `RCTNativeModule` converts the arguments from `folly:…
Summary
Add prop showSoftInputOnFocus to TextInput. This fixes #14045. This prop can be used to prevent the system keyboard from displaying at all when focusing an input text, for example if a custom keyboard component needs to be displayed instead.
On Android, currently TextInput always open the soft keyboard when focused. This is because
requestFocus
callsshowSoftKeyboard
, which in turn instructsInputMethodManager
to show the soft keyboard.Unfortunately even if we were to define a new input type that extends ReactEditText, there is no way to overcome this issue.
This is because
showSoftKeyboard
is a private method so it can't be overriden. And at the same timerequestFocus
needs to invokesuper.requestFocus
to properly instruct Android that the field has gained focused, so overridingrequestFocus
in a subclass of ReactEditText is also not an option, as when invokingsuper.requestFocus
we would end up calling again the one defined in ReactEditText.So currently the only way of doing this is to basically add a listener on the focus event that will close the soft keyboard immediately after. But for a split second it will still be displayed.
The code in the PR changes
requestFocus
to honor showSoftInputOnFocus as defined in Android TextView, displaying the soft keyboard unless instructed otherwise.Changelog
[Android] [Added] - Add showSoftInputOnFocus to TextInput
Test Plan
Changed the sample app adding the following TextInput:
The following video demonstrates the new behavior
https://drive.google.com/file/d/1OAQTMdb64UQTDotOnNTOsTTbLlormkNA/view?usp=sharing