Commit Graph

13073 Commits

Author SHA1 Message Date
Rafael Oleza 15f0a7b76c Add getRunModuleStatement config param to configure the require() statements
Reviewed By: cpojer

Differential Revision: D7334078

fbshipit-source-id: c19340567c634e3173ee707e92389eaaa4e724e9
2018-03-20 07:24:56 -07:00
Rafael Oleza 6f339b6fcb Deprecate postProcessModules config param
Reviewed By: mjesun

Differential Revision: D7320671

fbshipit-source-id: 979108f0931f9ee0dd820025782137d4c726d19f
2018-03-20 07:24:56 -07:00
Naor Matania ad6938cda1 Revert D7319513: Depend on local version of babel-plugin-react-transform
Differential Revision:
D7319513

Original commit changeset: 4945ec753087

fbshipit-source-id: 98de6a0fda19732c02ad780953497f9d9b451dea
2018-03-20 06:46:58 -07:00
Jeff Hampton f6bcd73ed7 feat: Remove platform check in requireNativeComponent to support additional platforms
Summary:
Using platform checks can make it difficult to incorporate changes for other platforms (e.g. Windows).
 Using a check for the underlying function accomplishes the same goal without relying on an Android-specific check.  This change allows this JS file to be re-used instead of copied and modified.

[X] Run Jest tests
[X] Test in RNTester on simulators
[X] Test in Playground

No related PR's found :)

[GENERAL] [ENHANCEMENT] [Libraries/ReactNative/requireFabricComponent.js] - Simplified check against UIManager to support additional platforms, removing Android-specific check
Closes https://github.com/facebook/react-native/pull/18381

Differential Revision: D7336214

Pulled By: hramos

fbshipit-source-id: e936f1fdcf36556c528115ee3f79197883d7b7d4
2018-03-20 05:32:50 -07:00
Peter van der Zee fa7c322af4 Depend on local version of babel-plugin-react-transform
Reviewed By: jeanlauliac

Differential Revision: D7319513

fbshipit-source-id: 4945ec753087206cd01eca4ba9464672d5fb05ba
2018-03-20 04:55:39 -07:00
Charles Dick aabd5d1458 Use map instead of array
Reviewed By: dcaspi

Differential Revision: D7327839

fbshipit-source-id: e48d2b9f34e337d14f9519eac16b6a15fa56deb5
2018-03-20 04:17:55 -07:00
Andrew Chen (Eng) af42829404 Fix TextRenderingTestCase
Reviewed By: mdvacca

Differential Revision: D7330681

fbshipit-source-id: 5dd2a60382d01fb841f16851a9b2027e2b08e748
2018-03-20 01:01:53 -07:00
Andrew Chen (Eng) f136ae1362 Add test for FabricText
Reviewed By: mdvacca

Differential Revision: D7326562

fbshipit-source-id: e1229f84496e9181475979d757066e3796a24a3f
2018-03-20 01:01:53 -07:00
Andrew Chen (Eng) c49afb174f Add debug logs to FabricUIManager
Reviewed By: mdvacca

Differential Revision: D7310879

fbshipit-source-id: 3c874fd4dbd75dd865f7d94e7e31f538ef67eb66
2018-03-20 01:01:53 -07:00
Andrew Chen (Eng) 785c8f7eb9 Use native as the source of truth to decide if a test should use Fabric
Reviewed By: fkgozali

Differential Revision: D7304221

fbshipit-source-id: cdd7053e6ce6522474df261db5710e2d9c013be6
2018-03-20 01:01:53 -07:00
Sam Goldman 0d924dd629 Upgrade to Flow v0.68.0
Reviewed By: gabelevi

Differential Revision: D7310349

fbshipit-source-id: 70d29815dd7912704aec8a015c970be3fafeeba3
2018-03-19 18:31:36 -07:00
David Vacca 5347ecfd29 Fix removal of ReactShadowNode
Reviewed By: achen1

Differential Revision: D7323294

fbshipit-source-id: 411aa1bcd93cc4f9df78f64ceb0c0d8c127bc3b0
2018-03-19 18:31:36 -07:00
David Vacca cc3d45d2e9 Add logging to debug Fabric diffing algorithm
Reviewed By: achen1

Differential Revision: D7319185

fbshipit-source-id: fe47c21db5e1415aebe806f0d74b1f65f667a397
2018-03-19 18:31:36 -07:00
David Vacca 7d3de1016a Implement Fabric Reconciler
Reviewed By: achen1

Differential Revision: D7240208

fbshipit-source-id: 236b76146c50fb7f357190b08f8a5bfcef7f6645
2018-03-19 18:31:36 -07:00
David Vacca 3f84a0a6f4 Extend ReactShadowNode in order to have a reference to the ReactShadowNode that was used to clone a node
Reviewed By: achen1

Differential Revision: D7289345

fbshipit-source-id: 34bfba8aca43299a3a8929a0e3eb85721f736dd0
2018-03-19 18:31:36 -07:00
David Vacca b43afcdde9 Change cloning mechanism for mutableCopyWithNewChildren method
Reviewed By: achen1

Differential Revision: D7239873

fbshipit-source-id: d931e753c3a0b26d439eb450d62af93a672641f4
2018-03-19 18:31:36 -07:00
David Vacca 0930fef46d Disable YogaNode cloning in Android
Reviewed By: achen1

Differential Revision: D7313239

fbshipit-source-id: ecf905a22e04a2115ab968fd29f7582301f0f3c9
2018-03-19 18:31:36 -07:00
Kevin Gozali e2462e9016 iOS: set the default measure size correctly for RCTSurfaceHostingView
Summary: The RCTRootView default needs to be translated during init of RCTSurfaceHostingView correctly.

Reviewed By: shergin

Differential Revision: D7327918

fbshipit-source-id: 67a2a42b554782b37a032cc0470d794554cc1e5a
2018-03-19 17:36:03 -07:00
Valentin Shergin b808bfdce2 Fabric: Introducting `ShadowNode.sourceNode`, the node used in copy-constructor
Summary: We will need this later in the diffing alogrithm.

Reviewed By: fkgozali

Differential Revision: D7330337

fbshipit-source-id: 3da44a62e4d5f30deed28b18a5779544153244f3
2018-03-19 17:08:31 -07:00
Valentin Shergin 39383d1189 Fabric: Improved YogaLayoutableShadowNode printing
Summary: `LTR` is actually a default value for `direction` here, because an `inherit` value makes no sense for YGLayout (because it's *computed* value by definition).

Reviewed By: fkgozali

Differential Revision: D7330335

fbshipit-source-id: b3c7736c104689f2296e150f0cf57d622483d537
2018-03-19 17:08:31 -07:00
Valentin Shergin ff288b7416 Fabric: Complete implementation of `layoutMetricsFromYogaNode`
Summary: That was simply incomplete.

Reviewed By: fkgozali

Differential Revision: D7330336

fbshipit-source-id: c495c7f61d8e551fa963bfa6cc0408343eb8439b
2018-03-19 17:08:31 -07:00
Valentin Shergin a5a34565e0 Fabric: Proper return value of `LayoutableShadowNode::setLayoutMetrics()`
Summary: `LayoutableShadowNode::setLayoutMetrics()` must return `false` is nothing was changes.

Reviewed By: fkgozali

Differential Revision: D7330334

fbshipit-source-id: 700d50b0047919fa2b919acfa72825f100cd496f
2018-03-19 17:08:31 -07:00
Valentin Shergin aaaa946e6d Fabric: Equality operators for geometry types
Summary: We will need this soon.

Reviewed By: fkgozali

Differential Revision: D7330338

fbshipit-source-id: 30aeadc182893e86c6a039c74d245f9b56624151
2018-03-19 17:08:31 -07:00
Frederic Barthelemy 75a735976d RCTObjcExecutor: fix initializer-list initialization order build warning.
Summary:
Fixes: #18384

Previously line 42 had a warning of: `Field 'm_jsThread' will be initialized after field 'm_delegate'`

This appears to be because the private member fields are declared in a different order than the initializer-list was told to initialize things.

I chose to re-order the initializer list because that fixes the warning by matching the code structure to what the compiler was telling us it was going to do.

An alternate fix would be to change the order of the member variables declared in the `private:` section to match the coded order in the initializer list. This might be the right move if the initializer list had the correct intent, but this would be a breaking change from a behavior perspective, so I'd need somebody with more knowledge to suggest this is the right move.

A. Examine line to see the warning is gone.
B. Get a C++ guru to figure out the intent of this file and see if this actually exposed a bug that recommends we go with the alternate fix suggested above.

[IOS][MINOR][React/CxxBridge/] - Build warning fix

<!--
Help reviewers and the release process by writing your own release notes

**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 ]   [ {File}      ]
[ IOS      ]   [ FEATURE     ]   [ {Directory} ]   |-----------|
[ ANDROID  ]   [ MINOR       ]   [ {Framework} ] - | {Message} |
[----------]   [-------------]   [-------------]   |-----------|

[CATEGORY] [TYPE] [LOCATION] - 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
-->
Closes https://github.com/facebook/react-native/pull/18385

Differential Revision: D7328272

Pulled By: mhorowitz

fbshipit-source-id: 59d7ace6222c4609ac7d023f97e522e85e02a9db
2018-03-19 15:51:59 -07:00
Naris Siamwalla 12535ae69d Fix clang-6 strictness surrounding virtual destructors
Reviewed By: smeenai

Differential Revision: D7326765

fbshipit-source-id: 9df477dfa89812e05e79b5e6d510bcbbc793381c
2018-03-19 15:00:09 -07:00
Peter Argany ff70ecf868 Fixed <TextInput> bug with autocapitalization
Reviewed By: shergin

Differential Revision: D7304936

fbshipit-source-id: ef587db89b64e7111dfdeb049c3a1a334c15430b
2018-03-19 14:20:18 -07:00
Héctor Ramos 41db09d573 Remove @xplat cell syntax in open source, part 2
Differential Revision: D7325421

fbshipit-source-id: 95e3ee0a6c41292b1d2e1fc8b0691861ad69468f
2018-03-19 12:30:59 -07:00
Mehdi Mulani 9d45de60ac Properly tear down the reachabilityRef in RCTNetInfo
Summary: The pull request that added this (#17397) simply forgot to remove the callback, which would cause crashes if the RCTNetInfo module was ever deallocated. While that usually doesn't happen in apps, it can if the user logs out and you need to wipe all the RCT modules (to remove user data, for instance).

Reviewed By: PeteTheHeat

Differential Revision: D7322999

fbshipit-source-id: e49ec7311b39920f7b7743a5854c0dda1dbccc73
2018-03-19 11:00:23 -07:00
Andrew Chen (Eng) 12c208cbd4 Create a new instrumentation test that does not enforce rendering a single RN component
Reviewed By: mdvacca

Differential Revision: D7293466

fbshipit-source-id: 8ddaf9a52f4d6324e8b37f3c6fd4d3e0db6f3a12
2018-03-19 11:00:23 -07:00
Peter Argany 15bc6d1e0b Added console warning to InputAccessoryView
Reviewed By: mmmulani

Differential Revision: D7305377

fbshipit-source-id: 4a9888b5592014956c3aa44baffb2ac3a0329b88
2018-03-19 10:17:15 -07:00
Dmitry Zakharov c73242938c Make access to SourceCode Native Extension lazy
Reviewed By: fromcelticpark

Differential Revision: D6987478

fbshipit-source-id: 6d600131239be34480bd1c5a0ca84b4fab360386
2018-03-19 09:33:31 -07:00
Cristiano Santos def789cd7e Wrong height when TextInput has an empty string
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!

-->

The caret/cursor did not appear when the TextInput was empty. Found that the cause was because the frame of the TextInput had an height of 0

Just fill and clear a TextInput and the caret/cursor will always appear there.

<!--
Help reviewers and the release process by writing your own release notes

**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 ]   [ {File}      ]
[ IOS      ]   [ FEATURE     ]   [ {Directory} ]   |-----------|
[ ANDROID  ]   [ MINOR       ]   [ {Framework} ] - | {Message} |
[----------]   [-------------]   [-------------]   |-----------|

[CATEGORY] [TYPE] [LOCATION] - 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
-->
[IOS] [BUGFIX] [TextInput] - This was causing the cursor/caret to not appear since the size of the frame had an height of 0.
Closes https://github.com/facebook/react-native/pull/18355

Differential Revision: D7319723

Pulled By: shergin

fbshipit-source-id: b0249ab5493b6ac310d1898ff20c0bad78cf82c9
2018-03-19 02:46:34 -07:00
Kevin Gozali 53a0470b83 iOS JSC: Use ICxxExceptionManager to report exception
Reviewed By: shergin

Differential Revision: D7224945

fbshipit-source-id: 8aadbc04c700d6e965be311085d95332571b00b0
2018-03-19 00:06:57 -07:00
Kevin Gozali f42b5892a1 iOS C++: Add ICxxExceptionManager to access RCTExceptionsManager native module
Summary: It is sometimes useful to report soft/fatal errors from C++ (native) to the same RCTExceptionsManager that is already handling JS exceptions. `ICxxExceptionManager` is an approach to provide such access, which impl provided for ObjC++.

Reviewed By: shergin

Differential Revision: D7224944

fbshipit-source-id: 8c607226b67851d46f4c787f5b6e6c8cb6a1afea
2018-03-19 00:06:57 -07:00
tuncaulubilge 263d04d756 Added nestedScrollEnabled prop to scroll view for android
Summary:
Nested scrolling in scrollViews, listViews and flatLists are enabled on iOS by default, but needs to be enabled manually on Android. This PR introduces a `nestedScrollEnabled` property to ScrollViews to support nested scrolling on Android 21 and above.

Enabling nested scroll will resolve issues with coordinator layout in android and required to support a collapsing toolbar.

Tested on the test app. We are also using this property in our app currently to support scrolling behaviour required by coordinator layouts.

[ANDROID] [ENHANCEMENT] [ScrollView] - Added a prop to enable nested scrolling
Closes https://github.com/facebook/react-native/pull/18299

Reviewed By: sahrens

Differential Revision: D7256604

Pulled By: mdvacca

fbshipit-source-id: fb8b7f1b5bed39837a2066db7f2a8798d52a3fd6
2018-03-18 20:16:15 -07:00
Valentin Shergin 378da73201 DebugStringConvertibleOptions: Formating
Summary:
DebugStringConvertibleOptions allows pretty-format debug strings.
https://pxl.cl/ch0m

Reviewed By: fkgozali

Differential Revision: D7312622

fbshipit-source-id: 0ed62520bbc521790bedf5a6d18c796b42f85658
2018-03-18 19:17:39 -07:00
Valentin Shergin 4cda0df2e5 Switching to the new FabricUIManager and all new shadow tree infra
Reviewed By: fkgozali

Differential Revision: D7230670

fbshipit-source-id: bca7d2859b87931c0d15406782b7d689de1d8c36
2018-03-18 19:17:39 -07:00
Valentin Shergin c2ad59a277 `fabric/uimanager` module
Summary: `fabric/uimanager` implements FabricUIModule.

Reviewed By: fkgozali

Differential Revision: D7230669

fbshipit-source-id: db6228021352598feac7854b5871d9d6c5c85119
2018-03-18 19:17:39 -07:00
Valentin Shergin 965e60b05a `fabric/view` module
Summary: Defines `<View>`: Yoga-powered, Accessible and styleable component.

Reviewed By: fkgozali

Differential Revision: D7230673

fbshipit-source-id: 08a1d8626c0b41260fafdca938d4fe9489b1b793
2018-03-18 19:17:39 -07:00
Valentin Shergin 6b0960cbdb Introducing `ConcreteShadowNode`
Summary: ConcreteShadowNode defines a template which connects typed Props and typed ShadowNode.

Reviewed By: fkgozali

Differential Revision: D7230667

fbshipit-source-id: be28314d6846d69960e921da852f01232951f965
2018-03-18 19:17:39 -07:00
Valentin Shergin 811d5bfc73 Introducing LayoutableShadowNode
Summary: LayoutableShadowNode defines a unified interface (and set of primitives) essential for laying out shadow nodes.

Reviewed By: fkgozali

Differential Revision: D7230668

fbshipit-source-id: d8c1772d4c3bd1f87c41f7240a39aecebf3696ae
2018-03-18 19:17:39 -07:00
Valentin Shergin 840638c441 Introducing `ComponentDescriptor`
Summary:
Abstract class and default template implementation.
`ComponentDescriptor`s define basic logic of managing (creation, cloning, applying props) ShadowNode of particular type.

Reviewed By: fkgozali

Differential Revision: D7230671

fbshipit-source-id: c32636f4db0716b55a1637f61c4f1872fc52cea7
2018-03-18 19:17:39 -07:00
Valentin Shergin 608d1fb590 `fabric/graphics` module: all about graphics
Summary: `fabric/graphics` provides graphics primitives; the implementation should be platform-specific eventually.

Reviewed By: fkgozali

Differential Revision: D7230675

fbshipit-source-id: ff05d2673072fad5ee6f331f0155561969e1a8b6
2018-03-18 19:17:39 -07:00
Valentin Shergin c623455845 Abstract classes for ShadowNode and Props
Summary: Foundation clases for Fabric designed to be "const-first".

Reviewed By: fkgozali

Differential Revision: D7230672

fbshipit-source-id: 433acd35a7958d5d577358b0a306923f970e573f
2018-03-18 19:17:39 -07:00
Valentin Shergin d16772a31e Sealable: fixed semantic; atomic type for the flag variable
Summary:
* Fixed semantic: all kinds of derivative instances lose `sealed` flag (which is expected);
 * Using atomic<bool> for `sealed_` ivar.

Reviewed By: fkgozali

Differential Revision: D7230674

fbshipit-source-id: abe786610c20a45a0fabb9068120e24adeeeac7f
2018-03-18 19:17:39 -07:00
Kevin Gozali 1c53471911 iOS OSS: fixed RNTester - missing RCTInputAccessoryShadowView.* in .xcodeproj
Reviewed By: yungsters

Differential Revision: D7317380

fbshipit-source-id: 0a40d62c70cd3c3a875e5a418f4b77fecb0417b1
2018-03-17 22:01:15 -07:00
Hunkyo Jung 541485c7fe Add inverted prop in SectionListExample
Summary:
This PR adds an option to pass`inverted` prop to SectionListExample in RNTester. FlatListExample already has this option but it's not available in SectionListExample.

Run RNTester app on device or simulator and select SectionListExample. Depending on switching `inverted` option, you can see either inverted list or not.

[GENERAL][ENHANCEMENT][RNTeater] - Add inverted prop to SectionListExample
Closes https://github.com/facebook/react-native/pull/18370

Differential Revision: D7317168

Pulled By: hramos

fbshipit-source-id: c6c212c705e686281f23954775cc3465cce3c8df
2018-03-17 20:23:22 -07:00
Héctor Ramos 6f588b31be Fix Android job
Summary:
Yarn is not used in the Android step, not directly

Test Plan
Circle

Release Notes

[GENERAL][MINOR][.circleci] - Fix Android CI job
Closes https://github.com/facebook/react-native/pull/18421

Differential Revision: D7314158

Pulled By: hramos

fbshipit-source-id: ad40346b6a1c1f63a1b952fd05cbe9398d9c59a1
2018-03-16 18:56:08 -07:00
Jamie Lynch c2fd54fcb2 Enable obfuscation in ProGuard rules by default
Summary:
This PR enables obfuscation in ProGuard by default when creating a new project, and documents how developers can turn obfuscation off if they desire.

The ProGuard phase is currently disabled by default. If a developer wanted to enable ProGuard, the first thing they would see is the following line in their build.gradle file: `def enableProguardInReleaseBuilds = false`

It's really easy to assume that enabling this flag will setup code shrinking and obfuscation, as this is the default behaviour for a completely native Android Studio project, or when running ProGuard from the command line directly.

However, the generated ProGuard rules override the default behaviour. Without visually inspecting the rules file, searching for a mapping file, or analyzing the Dex file classes, this isn't immediately obvious, as the APK will be smaller, and gradle will show the Proguard task as completing.

Personally I find this confusing and really wasn't expecting for obfuscation to be disabled - most Android Error Reporting services allow deobfuscation of stacktraces via mapping files.

1. Create a new project using `react-native init MyProject`
2. Observe that `-dontobfuscate` is commented out

[ANDROID] [MINOR] [ProGuard] - Enables obfuscation by default in newly created projects
Closes https://github.com/facebook/react-native/pull/17754

Differential Revision: D7251680

Pulled By: hramos

fbshipit-source-id: cf9ca7753640643377a51daa4fa9065516197340
2018-03-16 18:56:08 -07:00
miguelsm 353c070be9 Add a way to dismiss PopupMenu elements
Summary:
In native Android apps, like the YouTube app, context menus are closed when the device orientation changes.

In React Native apps instead, when having a [PopupMenu](https://developer.android.com/reference/android/widget/PopupMenu.html) open and rotating the device, the PopupMenu is not dismissed and appears in a wrong position on the screen.

This PR exposes a `dismissPopupMenu` method to allow the application to dismiss any open PopupMenu:

```(javascript)
UIManager.dismissPopupMenu()
```
Closes https://github.com/facebook/react-native/pull/15636

Differential Revision: D6837663

Pulled By: hramos

fbshipit-source-id: 7b0f4f04341129ad45c703a50897e17d93651974
2018-03-16 17:22:05 -07:00