Summary:
This flow type is wrong, probably just a copy paste mistake.
Pull Request resolved: https://github.com/facebook/react-native/pull/21271
Differential Revision: D10006741
Pulled By: TheSavior
fbshipit-source-id: eba0116ec39ba00f000d9bf789ae9214990355a1
Summary:
I've seen quite a few PRs try to change sync'ed files so let's add this warning and hope people read it.
Not sure if it's better / possible to put it in the oss folder instead.
Pull Request resolved: https://github.com/facebook/react-native/pull/21251
Differential Revision: D9993401
Pulled By: hramos
fbshipit-source-id: 05d22c7f8da1eba97a83d2b7dbc66d9324695a1b
Summary:
`new Date().getTime()` is equal to `Date.now()`.
`Date.now()` avoids an allocation, which can save some GC time.
This micro-optimization isn't worth it in most places, but since MessageQueue is one of the hottest pieces of JS in RN, it's worth it.
Reviewed By: javache
Differential Revision: D9972334
fbshipit-source-id: 05d78fd65304f0f27115d76b8b52db11a52c86a0
Summary: This will probably not fix the crash but the current implementation certenly is/was not thread-safe.
Reviewed By: javache
Differential Revision: D9977538
fbshipit-source-id: a9cac05c313ff51efefbd7c228a1160a3aa75b54
Summary:
Fixes#20797
As mentioned in #20797 when running `react-native run-ios Xcode 9.2 will complain about the nullability of pointers in `RCTLinkingManager.h`.
Pull Request resolved: https://github.com/facebook/react-native/pull/20798
Differential Revision: D9988581
Pulled By: hramos
fbshipit-source-id: e3ce7736da97d314a421c2c1ab71577864081642
Summary:
RN animations currently ignore the `Slow Animations` option on the iOS simulator because we don't use UIKit animations directly. This uses a private api to get the slow coefficient and use it in the native animated driver. We only compile the private api code on simulator so this won't cause issues for app store approval. One possible issue is that the api changes in new iOS versions but I think it's reasonable to do this.
Note that this won't work with JS driven animations, we could expose the slow coefficient as a constant and use that in JS but I decided not to implement it.
Pull Request resolved: https://github.com/facebook/react-native/pull/21157
Differential Revision: D9980306
Pulled By: sahrens
fbshipit-source-id: bdbce2e469261a75cb4b9a251e8e8f212bb9c4e7
Summary:
This PR exposes the `onScrollToTop` event on iOS using the same event-forwarding infrastructure as other ScrollView events. (As such, its `nativeEvent` object reflects the same fields as other ScrollView events.)
Motivation:
----------
If your app is only interested in knowing the position of a ScrollView after a scroll has completed, it can use `onScrollEndDrag` and `onMomentumScrollEnd` to inspect the `contentOffset` after a drag-initiated scroll has finished. (This is much less expensive than observing the `onScroll` event if you only want to know the end position.) However, neither of these `End` events fire if the ScrollView is scrolled to the top by tapping the status bar.
By exposing `onScrollToTop`, it is now possible for an app to cheaply know when such a scroll has completed.
Pull Request resolved: https://github.com/facebook/react-native/pull/21204
Differential Revision: D9943618
Pulled By: hramos
fbshipit-source-id: ac5ee42b7f12d94655ffda617f8f811138da7f6f
Summary:
This file was created recently but is not used as the WKWebview was integrated directly into the Webview.ios.js
Removing this file to clarify the situation
Pull Request resolved: https://github.com/facebook/react-native/pull/21182
Differential Revision: D9942905
Pulled By: hramos
fbshipit-source-id: 19e9fba94280428edd1deab4a54f8c5dc42a6bfa
Summary:
Currently the warning is always triggered, even on iOS. This simply adds a platform check and tweak the message.
Pull Request resolved: https://github.com/facebook/react-native/pull/21174
Differential Revision: D9929679
Pulled By: hramos
fbshipit-source-id: 383f4a820cf5bf261dbfdcff3b950f9812a65e00
Summary:
They are bad :D
And they affect us when trying to migrate to the babel runtime helpers
Reviewed By: pvdz
Differential Revision: D9829462
fbshipit-source-id: 15240a56e707e13775d57714646e4960cfe202df
Summary:
Prepack does not understand how to use a random key as an object property. Instead, at build time, it generates a deterministic property name based on a deterministic seed for `Math.random()`.
Prepack would like to move away from this, and keep all the `Math.random()` unevaluated and left in the bundle.
Since this is the only usage of `Math.random()` that can't be handled by the abstract interpreter, it should be changed.
Note that the randomness is not required here at all, it just has to be *some* unique key.
Reviewed By: davidaurelio
Differential Revision: D9882757
fbshipit-source-id: 21c213db9716d2faeb8745d811a620b088a83781
Summary:
Use `tools/scm/optimize-gitignore.py` to optimize gitignores in fbcode,
fbandroid, and fbobjc, by moving rules to subdirectories.
Reviewed By: phillco
Differential Revision: D9660076
fbshipit-source-id: 3321ebaafb93e387a11fab000ba9e80afc88b210
Summary:
Adding the new `textContentType` options from iOS 12. `newPassword` helps the OS know to put a password field into the keychain, and `oneTimeCode` hints that the field will take input from an SMS one time code.
Pull Request resolved: https://github.com/facebook/react-native/pull/21079
Differential Revision: D9813328
Pulled By: TheSavior
fbshipit-source-id: d2c04b41121b32f185af38ea4c642924e261a043
Summary:
NaN is not handled consistently by the bridge in all cases,
so detect it and complain. In order to make the complaint more
obvious, use JSON.stringify on the value, and a replacer so that some
of the censoring which normally takes place doesn't get in the way of
clarity.
Reviewed By: mmmulani
Differential Revision: D9779799
fbshipit-source-id: 6c1a6bfe05ecaa3aeb558acc49dfd54461e1ba74
Summary: Fixes a redbox about setting both the accessor and the value for an object. It looks like it's actually coming from PolyfillFunctions, where we set the value as well as spreading in the object descriptor for modules in DEV.
Reviewed By: yungsters
Differential Revision: D9792991
fbshipit-source-id: a2fa5d1820c5eddfd8244722771e76de62f89976
Summary:
To avoid "js engine: ..." appearing everywhere, only add this information
to the error message when react native is reporting errors to the server.
Reviewed By: yungsters
Differential Revision: D9754371
fbshipit-source-id: a8001480c75ccf93c953c79f26470df678871cb3
Summary:
Original commit changeset: cec3802d30b7
See my comment on original diff: D9307123
The diff regresses ImageBackground in some cases, so I'm reverting until we can re-work the diff to handle existing usages in an expected way.
Differential Revision: D9790698
fbshipit-source-id: 23ad670e004980f22bd1413eca3692f51beff717
Summary: This diff adds a new property in ReactWebView to be able to configure allowFileAccess
Reviewed By: achen1
Differential Revision: D9789466
fbshipit-source-id: 39d042ac6ef69e44f006a4c4b0c2dd900f84dbc9
Summary: In some cases, the custom implementation of this prop is undesirable, so this allows to turn it off.
Reviewed By: yungsters
Differential Revision: D9759228
fbshipit-source-id: 4f61cd900c2da9046977c11a61606a4f5f961177
Summary: When symbolication fails, allow retrying without having to reload the current JS VM.
Reviewed By: ejanzer
Differential Revision: D9760666
fbshipit-source-id: 63837c81fe77a9b0b897a858e3d64bc7dcf2c3bd
Summary: Changes YellowBox to use feather icons for the left and right navigation so that we are not dependent on the system's (sometimes funky) unicode icons.
Reviewed By: ejanzer
Differential Revision: D9759134
fbshipit-source-id: b957c24afdccc04bfe78ae4750777c387c2acef4
Summary: This change drops the year from the copyright headers and the LICENSE file.
Reviewed By: yungsters
Differential Revision: D9727774
fbshipit-source-id: df4fc1e4390733fe774b1a160dd41b4a3d83302a
Summary:
Fixing error
node_modules/react-native/Libraries/NativeAnimation/RCTNativeAnimatedNodesManager.h:12:9: 'RCTAnimation/RCTValueAnimatedNode.h' file not found
I'm integrating react native into an existing app through cocoa pods and similar to other PRs
PR https://github.com/facebook/react-native/pull/16192
PR https://github.com/facebook/react-native/pull/16271
PR https://github.com/facebook/react-native/pull/17764
When integrating with cocoa pods
```
pod 'React', :path => './node_modules/react-native', :subspecs => [
'Core',
'DevSupport', # Include this to enable In-App Devmenu if RN >= 0.43
'RCTText',
'RCTNetwork',
'RCTWebSocket', # needed for debugging
'RCTImage',
'RCTWebSocket',
'BatchedBridge',
'RCTLinkingIOS',
'RCTActionSheet',
'RCTAnimation'
]
```
With `RCTAnimation` being the important part for this PR.
Also note without this PR and the other PR's above if anyone is trying to integrate react native into an existing app i.e. through cocoa pods they won't be able too. I think the latest working version is
My app wouldn't build without changing this line
PR https://github.com/facebook/react-native/pull/16192
PR https://github.com/facebook/react-native/pull/16271
PR https://github.com/facebook/react-native/pull/17764
[IOS] [BREAKING] [PODS] - Fixed RCTAnimation import for integrating with cocoapods
Pull Request resolved: https://github.com/facebook/react-native/pull/18050
Differential Revision: D9235162
Pulled By: hramos
fbshipit-source-id: 426daccf8d8952658e262d5a0e4623c72c38542c
Summary: This relied on NaN being turned into null (through JSON.stringify), which would then be handled by Yoga gracefully. But in some cases we do not call JSON.stringify and thus pass NaN directly to Yoga causing a problem.
Reviewed By: fkgozali
Differential Revision: D9764488
fbshipit-source-id: 021c9ffafba8f9bcef2476756a12df33c367bcb1
Summary: ImageBackground assigned its Image the same `width` and `height` styles as itself. This became an issue for ImageBackground instances that were assigned (non 100%) percentage size values. For example, if the `width` and/or `height` of the ImageBackground was set to be 50%, it would be half the size of the current component it is in (as intended), but the Image would be 50% of the ImageBackground, which is only 25% the size of the ImageBackground's parent component.
Reviewed By: shergin
Differential Revision: D9307123
fbshipit-source-id: cec3802d30b72c44f66dd3a53693ebd669cc8db4
Summary:
Switches to the `nullthrows` package instead of using `fbjs/lib/nullthrows`.
The version of `nullthrows` in `fbjs` is outdated and already missing features that exist in the standalone `nullthrows` package.
Also, this mitigates the inevitable collision between `nullthrows` (as a Haste module) and `nullthrows` (as a `node_modules` dependency).
Reviewed By: zertosh
Differential Revision: D9733178
fbshipit-source-id: 1b589d48c1ed57cebf2088b796ad72e212534c0a
Summary:
This fixes issues #18954 and #15497
The transformation from Set to (an reversed) Array does not work on Android devices when the remote debugging was started with `react-native run-android`.
<!--
Required: Write your motivation here.
If this PR fixes an issue, type "Fixes #issueNumber" to automatically close the issue when the PR is merged.
-->
Add the following code to your App.js and run the app with `react-native run-android` in an Android device:
```
componentDidMount() {
BackHandler.addEventListener('hardwareBackPress', () => {
console.warn('Callback called. Do not close app. Do nothing at all.');
return true; // Do not close the app.
});
}
```
After adding this, the app should NOT close when you press the back button. Without this fix, the app closes (which is the default behaviour).
See also the comments from Victoriayangx in #18954 and #15497.
<!--
Does this PR require a documentation change?
Create a PR at https://github.com/facebook/react-native-website and add a link to it here.
-->
<!--
Required.
Help reviewers and the release process by writing your own release notes. See below for an example.
-->
[ANDROID] [BUGFIX] [BackHandler] - Fix that BackHandler was not called on Android
<!--
**INTERNAL and MINOR tagged notes will not be included in the next version's final release notes.**
CATEGORY
[----------] TYPE
[ CLI ] [-------------] LOCATION
[ DOCS ] [ BREAKING ] [-------------]
[ GENERAL ] [ BUGFIX ] [ {Component} ]
[ INTERNAL ] [ ENHANCEMENT ] [ {Filename} ]
[ IOS ] [ FEATURE ] [ {Directory} ] |-----------|
[ ANDROID ] [ MINOR ] [ {Framework} ] - | {Message} |
[----------] [-------------] [-------------] |-----------|
EXAMPLES:
[IOS] [BREAKING] [FlatList] - Change a thing that breaks other things
[ANDROID] [BUGFIX] [TextInput] - Did a thing to TextInput
[CLI] [FEATURE] [local-cli/info/info.js] - CLI easier to do things with
[DOCS] [BUGFIX] [GettingStarted.md] - Accidentally a thing/word
[GENERAL] [ENHANCEMENT] [Yoga] - Added new yoga thing/position
[INTERNAL] [FEATURE] [./scripts] - Added thing to script that nobody will see
-->
Pull Request resolved: https://github.com/facebook/react-native/pull/19077
Reviewed By: yns88
Differential Revision: D9692298
Pulled By: hramos
fbshipit-source-id: 4526b07a4924055ebc9c42e02615c27aa5c97fbb
Summary:
Legacy navigator impl. There are other alternatives that should be used instead.
Part of the slimmening effort as described here: https://github.com/react-native-community/discussions-and-proposals/issues/6
Reviewed By: TheSavior
Differential Revision: D9677824
fbshipit-source-id: 24ae500751d2a8c398f246d36604a58f0b3c113b
Summary:
D8842691 split AccessibilityTraits into multiple RN properties. However, the accessor code did not support REMOVING traits.
This results in buttons that were disabled (AccessibilityTraits & NotEnabled === true) never being enabled.
Fix the issue by making the split accessors properly mask in the bits, allowing you unset them without disturbing bits managed by the other accessor.
NOTE: setting AccessibilityTraits and AccessibilityRole or AccessibilityStates will still result in bugs.
Reviewed By: shergin
Differential Revision: D9661970
fbshipit-source-id: 77d70dd0754f2eaf8cbf895bfc13757c697a76d8
Summary:
**Motivation**
Whenever a user changes the system font size to its maximum allowable setting, React Native apps that allow font scaling can become unusable because the text gets too big. Experimenting with a native app like iMessage on iOS, the font size used for non-body text (e.g. header, navigational elements) is capped while the body text (e.g. text in the message bubbles) is allowed to grow.
This PR introduces a new prop on `<Text>` and `<TextInput>` called `maxFontSizeMultiplier`. This enables devs to set the maximum allowed text scale factor on a Text/TextInput. The default is 0 which means no limit.
Another PR will add this feature to Android.
**Test Plan**
I created a test app which utilizes all categories of values of `maxFontSizeMultiplier`:
- `undefined`: inherit from parent
- `0`: no limit
- `1`, `1.2`: fixed limits
I tried this with `Text`, `TextInput` with `value`, and `TextInput` with children. For `Text`, I also verified that nesting works properly (if a child `Text` doesn't specify `maxFontSizeMultiplier`, it inherits it from its parent).
Lastly, we've been using a version of this in Skype for several months.
**Release Notes**
[GENERAL] [ENHANCEMENT] [Text/TextInput] - Added maxFontSizeMultiplier prop to prevent some text from getting unusably large as user increases OS's font scale setting (iOS)
Adam Comella
Microsoft Corp.
Pull Request resolved: https://github.com/facebook/react-native/pull/20915
Differential Revision: D9646739
Pulled By: shergin
fbshipit-source-id: c823f59c1e342c22d6297b88b2cb11c5a1f10310
Summary: Added `snapToStart` and `snapToEnd` props to ScrollView which work together with `snapToOffsets` and determine whether the beginning and end of the list automatically count as snap offsets or not. If not, the list is allowed to free-scroll between its start/end and the first/last snap offset.
Reviewed By: sahrens
Differential Revision: D9442386
fbshipit-source-id: 47a5fdb20f884542434b01b1f0a486ed2b478c6e
Summary:
* Added snapToOffsets prop to ScrollView. Allows snapping at arbitrary points.
* Fixed pagingEnabled not being overridden by snapToInterval on iOS.
* Fixed Android *requiring* pagingEnabled to be defined alongside snapToInterval.
* Added support for decelerationRate on Android.
* Fixed snapping implementation. It was not calculating end position correctly at all (velocity is not a linear offset).
* Resolves https://github.com/facebook/react-native/issues/20155
* Added support for new content being added during scroll (mirrors existing functionality in vertical ScrollView).
* Added support for snapToInterval.
* Resolves https://github.com/facebook/react-native/issues/19552
Reviewed By: yungsters
Differential Revision: D9405703
fbshipit-source-id: b3c367b8079e6810794b0165dfdbcff4abff2eda
Summary: Splitting this into a separate diff for OSS
Reviewed By: yungsters
Differential Revision: D9551085
fbshipit-source-id: 8ca08351c6b89cd0011aab3c47ef6cc28b763450
Summary:
Makes a couple improvements to `ViewPropTypes`.
- Remove deprecated transform props. We are now using exact object types, so they are already disallowed.
- Remove garbage types for `accessibilityLabel`.
Reviewed By: TheSavior
Differential Revision: D9542088
fbshipit-source-id: f9128353e19cff22caf52c896c9c137f01aea276
Summary: This diff reverts the changes in the name for AndroidHorizontalScrollView and AndroidHorizontalScrollContentView that caused a redbox for continuous OTA users
Reviewed By: fkgozali
Differential Revision: D9561972
fbshipit-source-id: 3d8e9ee8bb6081107bc8d315af16885bb003148e
Summary: This diff implements the HorizontalScrollView component for Android Fabric C++, as part of this diff I also re-named the components AndroidHorizontalScrollContentView for RCTAndroidHorizontalScrollContentView and AndroidHorizontalScrollView for RCTAndroidHorizontalScrollView. This might sound against our plan of removing the RCT preffix, but it is to make it simpler to map components between current implementation of RN and Fabric (otherwise we don't know when to add the RCT preffix in Android side to find the right View Manager), later we can just remove the preffix from C++, Android, iOS and JS.
Reviewed By: shergin, achen1
Differential Revision: D9122729
fbshipit-source-id: e9299552857c6dd0c18abfa5fa49a3d50e221729
Summary:
Currently, modifying a component that renders a FlatLists while Hot Reloading is enabled will trigger an invariant inside FlatList for changing viewabilityConfig on the fly. This happens because it checks object equality between the configs.
By checking equality of the config's *properties* instead, we maintain the efficacy of the invariant but keep it from falsely triggering during development.
Reviewed By: sahrens
Differential Revision: D9466129
fbshipit-source-id: 67149e9e70ad7b2e2584bb7ec03e2dea26ef45e8
Summary: Apparently different apps have different implementations of view managers that support different props. This is a problem that we will need to address. Unfortunately, this means we can't have a static config defined in JS. We will need to find another approach to this problem.
Reviewed By: sahrens
Differential Revision: D9500178
fbshipit-source-id: b591559164fcf29f5fd43e13a0f2da15011491c6
Summary: This adds a callback for <Text> to get metrics about the rendered text. It's divided by line but that could be changed to "fragments" (which makes more sense for multi-lingual). Right now by line is convenient as you frequently want to know where the first and last line end (though we could make this work with fragments I suppose).
Reviewed By: shergin
Differential Revision: D9440914
fbshipit-source-id: bb011bb7a52438380d3f604ffe7019b98c18d978
Summary:
Changes the Flow prop types for `Image`, `Text`, and `View` to be nullable and optional.
This makes these components easier to compose.
Reviewed By: sahrens
Differential Revision: D9494285
fbshipit-source-id: c3f17147f063b31217b239a3abc085d1850f8df9
Summary: Moving this config to native for android so we skip the native lookup for the config.
Reviewed By: yungsters
Differential Revision: D9485645
fbshipit-source-id: cc0a6e9f12dad0c08aac32ca210373c388d307d6
Summary: Replace the non-compliant `Object.assign` with a spec compliant version from Mozilla. Since its spec compliant we can apply conditionally only when a native version is not available.
Reviewed By: yungsters
Differential Revision: D8896359
fbshipit-source-id: 4999fe3094eba2206293bbe28760a4e46cbee6aa