Summary:
If you are a product developer and you need to fix your app's issues related to iPhone X limitations asap,
you can temporary use `DeviceInfo.isIPhoneX_deprecated`.
You can, but you should not. Please consider use new <SafeAreaView>.
This prop was initially named so ugly because we are trying to discourage the community to use it.
However, we understand that sometimes we need a "band-aid" to prevent our apps bleeding.
Note: This prop (DeviceInfo.isIPhoneX_deprecated) will be removed completely after 06/18.
Reviewed By: fkgozali
Differential Revision: D5946329
fbshipit-source-id: 5d6dcaf0e2d175327d59cde4b5ec2e01cd77ec70
Summary:
Reasons:
* It is more clear and readable;
* It is more semantical;
* It allows us to add some magic (and complexity, to be fair) to the RCTExecuteOnUIManagerQueue. (See next diffs in the stack.)
Reviewed By: javache
Differential Revision: D5935466
fbshipit-source-id: aeb18d6e11c047eb19182a656da581b6ce073602
Summary:
This fixes [#15801](https://github.com/facebook/react-native/issues/15801)
We ran into a strange crash on iOS (debug only). After removing the clutter I was able to reproduce it in a tiny app. You can check it out [here.](https://github.com/simonracz/textinput_stress)
The UI in JS and native are not always in sync (which is okay). Due to this, a native view might call back into JS, which is no longer present in the shadow view hierarchy there. I think this should be also okay.
TextInput in some cases calls into [setIntrinsicContentView](6d67e2dbbc/React/Modules/RCTUIManager.m (L382)), where it triggers an overly enthusiastic `NSAssert` and crashes the app.
Check out [textinput_stress](https://github.com/simonracz/textinput_stress)
Rotate the simulator a few times to see the crash or the lack of crash.
Closes https://github.com/facebook/react-native/pull/16170
Differential Revision: D5959776
Pulled By: shergin
fbshipit-source-id: f39f5a3f1d86b330ecf7cbccd90871bc01fd69d9
Summary:
After this diff the intrinsic content size of <TextInput> reflects the size of text inside EditText,
it means that if there is no additional style constraints, <TextInput> will grow with containing text.
If you want to constraint minimum or maximum height, just do it via Yoga styling.
Reviewed By: achen1
Differential Revision: D5828366
fbshipit-source-id: eccd0cb4ccf724c7096c947332a64a0a1e402673
Summary:
In some cases we need a way to provide some peice of data to shadow node
to improve layout (or do something similar), `setLocalData` allows to do this.
Reviewed By: AaaChiuuu
Differential Revision: D5828368
fbshipit-source-id: bf6a04f460dc7695a16269426d365b78909bc8eb
Summary:
This is required for D5874536, wherein I'll be introducing direction-aware props for borders.
When a view's border changes due to a direction update, only the frames of its children update. Therefore, only the children `UIView`s get a chance to be re-rendered. This is incorrect because the view that's had its borders changed also needs to re-render. So, I keep a track of the layout direction in a property on all shadow views. Then, when I update that prop within `applyLayoutNode`, I push shadow views into the `viewsWithNewFrames` set.
Reviewed By: mmmulani
Differential Revision: D5944488
fbshipit-source-id: 3f23e9973f3555612920703cdb6cec38e6360d2d
Summary:
Currently, only `Text` supports the `allowFontScaling` prop. This commit adds support for it on `TextInput`.
As part of this change, the TextInput setters for font attributes (e.g. size, weight) had to be refactored. The problem with them is that they use RCTFont's helpers which create a new font based on an existing font. These helpers lose information. In particular, they lose the scaleMultiplier.
For example, suppose the font size is 12 and the device's font multiplier is set to 1.5. So we'd create a font with size 12 and scaleMultiplier 1.5 which is an effective size of 18 (which is the only thing stored in the font). Next, suppose the device's font multiplier changes to 1. So we'd use an RCTFont helper to create a new font based on the existing font but with a scaleMultiplier of 1. However, the font didn't store the font size (12) and scaleMultiplier (1.5) separately. It just knows the (effective) font size of 18. So RCTFont thinks the new font has a font size of 18 and a scaleMultiplier of 1 so its effective font size is 18. This is incorrect and it should have been 12.
To fix this, the font attributes are now all stored individually. Anytime one of them changes, updateFont is called which recreates the font from scratch. This happens to fix some bugs around fontStyle and fontWeight which were reported several times before: #13730, #12738, #2140, #8533.
Created a test app where I verified that `allowFontScaling` works properly for `TextInputs` for all values (`undefined`, `true`, `false`) for a variety of `TextInputs`:
- Singleline TextInput
- Singleline TextInput's placeholder
- Multiline TextInput
- Multiline TextInput's placeholder
- Multiline TextInput using children instead of `value`
Also, verified switching `fontSize`, `fontWeight`, `fontStyle` and `fontFamily` through a bunch of combinations works properly.
Lastly, my team has been using this change in our app.
Adam Comella
Microsoft Corp.
Closes https://github.com/facebook/react-native/pull/14030
Reviewed By: TheSavior
Differential Revision: D5899959
Pulled By: shergin
fbshipit-source-id: c8c8c4d4d670cd2a142286e79bfffef3b58cecd3
Summary: Now it compiles and works.
Reviewed By: fromcelticpark
Differential Revision: D5952026
fbshipit-source-id: df0408108ab29b77592d78b29553d2e65686f2f2
Summary:
<!--
Thank you for sending the PR! We appreciate you spending the time to work on these changes.
Help us understand your motivation by explaining why you decided to make this change.
You can learn more about contributing to React Native here: http://facebook.github.io/react-native/docs/contributing.html
Happy contributing!
-->
Referencing #16142
Closes https://github.com/facebook/react-native/pull/16146
Differential Revision: D5950544
Pulled By: TheSavior
fbshipit-source-id: 6a679ed2ca1fdb91a4240f02e68bbef858b5b645
Summary:
The Android ViewManager already has disabled set to false by default. When setting it in defaultProps we send it over for every text view, which is unnecessary.
On platforms that don't support disabled this may also cause unnecessary log noise.
Closes https://github.com/facebook/react-native/pull/16139
Differential Revision: D5944334
Pulled By: javache
fbshipit-source-id: 54c4b65f345cd284759d01d075522f5aa2f74298
Summary:
/**
* param {number} value
* param {number} min
* param {number} max
* return {number}
*/
should be:
/**
* param {number} min
* param {number} value
* param {number} max
* return {number}
*/
<!--
Thank you for sending the PR! We appreciate you spending the time to work on these changes.
Help us understand your motivation by explaining why you decided to make this change.
You can learn more about contributing to React Native here: http://facebook.github.io/react-native/docs/contributing.html
Happy contributing!
-->
(Write your motivation here.)
(Write your test plan here. If you changed any code, please provide us with clear instructions on how you verified your changes work. Bonus points for screenshots and videos!)
Closes https://github.com/facebook/react-native/pull/16077
Differential Revision: D5938021
Pulled By: shergin
fbshipit-source-id: 3a6e4ff5ab39a657bc0d9271ae2a2600998b2ddf
Summary:
See https://github.com/facebook/react-native/issues/14423
This adds checks after download that each file is present, and has the
correct sha1 hash. If not, it will retry several times, and fail if
it can't successfully download the file. If a file is downloaded, the
unpack and command will run, even if the third-party dir already
exists. The diagnostics printed in the event of failure are improved.
This should be self-healing for anybody who has a bad ~/.rncache
directory. The checksum will fail, and the files will be
redownloaded.
Reviewed By: hramos
Differential Revision: D5930707
fbshipit-source-id: cb15af949294243448ccc3995ec3f0396b1922b6
Summary:
in the example code for configuring animations, Easing.back should be Easing.back()
<!--
Thank you for sending the PR!
If you changed any code, please provide us with clear instructions on how you verified your changes work. In other words, a test plan is *required*. Bonus points for screenshots and videos!
Please read the Contribution Guidelines at https://github.com/facebook/react-native/blob/master/CONTRIBUTING.md to learn more about contributing to React Native.
Happy contributing!
-->
Closes https://github.com/facebook/react-native/pull/15273
Differential Revision: D5929874
Pulled By: shergin
fbshipit-source-id: 89921d0dda899e1697ee1fa5d96752964a2dc3f9
Summary:
local-cli now depends on the node-notifier package but it wasn't listed in package.json.
Closes https://github.com/facebook/react-native/pull/15905
Reviewed By: TheSavior
Differential Revision: D5814773
Pulled By: hramos
fbshipit-source-id: 3c397b0a21fea5009f35a69515e70a6d78ece375
Summary: Allows handling the case of wanting to scroll beyond the measured window.
Reviewed By: TheSavior
Differential Revision: D5915331
fbshipit-source-id: 329927632f4d04f213567ce4bbe547b04b8ea86d
Summary:
Basic implementation of the proposal in #15271
Note that this should not affect facebook internally since they are not using OSS releases.
Points to consider:
- How strict should the version match be, right now I just match exact versions.
- Wasn't able to use haste for ReactNativeVersion because I was getting duplicate module provider caused by the template file in scripts/versiontemplates. I tried adding the scripts folder to modulePathIgnorePatterns in package.json but that didn't help.
- Redscreen vs. warning, I think warning is useless because if the app crashes you won't have time to see the warning.
- Should the check and native modules be __DEV__ only?
**Test plan**
Tested that it works when version match and that it redscreens when versions don't before getting other errors on Android and iOS.
Closes https://github.com/facebook/react-native/pull/15518
Differential Revision: D5813551
Pulled By: hramos
fbshipit-source-id: 901757e25724b0f22bf39de172b56309d0dd5a95
Summary: ... because it was recently implemented for Android.
Reviewed By: mmmulani
Differential Revision: D5916305
fbshipit-source-id: b8af0f8712e36aee5c44f7ede41da25fc944134f