Summary:
A registry for components. The registry allows to refer to component view instance by react tag.
It also has recycle-pool-like interface (and eventually the pool will be implemented).
Reviewed By: mdvacca
Differential Revision: D7507519
fbshipit-source-id: ed74203fb4d0694490b0dc23aae0aa067b3fc55b
Summary:
MountItem is a small granular light-weight instruction describing a change in the component view tree.
All instruction are supposed to be small and standard. All additional logic must be implemented in component view subclasses.
No more opaque and untyped objcblocks.
All that allows mounting manager to control and optimize an execution of those items (eventually).
Besides that five we probably will need `perform imperative instruction` (for execution something like `scrollTo`) and `update local data` (for updating local state of something like text input).
Reviewed By: mdvacca
Differential Revision: D7507518
fbshipit-source-id: 745b93125231a02cbc152cfa6c6baf423d100f81
Summary:
All methods of RCTComponentViewProtocol are non-optional,
but this default implementation removes necessity to implement all of them manually.
Reviewed By: mdvacca
Differential Revision: D7507522
fbshipit-source-id: e4dff97e8bf64e79d2f1ffca94f0549bd4b5e2fa
Summary: RCTComponentViewProtocol is a protocol for all UIView instances which are managed by React/MountingManager.
Reviewed By: mdvacca
Differential Revision: D7507520
fbshipit-source-id: dcbed8c5d0cc97f72942508aeccb445833ade271
Summary: UIManager uses UIManagerDelegate to communicate about shadow tree changes to another parts of the system.
Reviewed By: fkgozali
Differential Revision: D7503484
fbshipit-source-id: 0afe0f0d6cad31fe2ee9d61235d02b379cfe8217
Summary:
We have to call shallowSourceNode() in all cases of cloning which were not caused by UIManager instructions,
otherwise the diffing alogorith might produce incorrect mutation instructions.
Reviewed By: mdvacca
Differential Revision: D7503383
fbshipit-source-id: b33e5c39b7ba8cbd0f925fd29b3af379441a40a4
Summary: We have to call `ensureunSealed()` only if the node was changed.
Reviewed By: mdvacca
Differential Revision: D7503388
fbshipit-source-id: a3d07d50fa983ef93c14fa771711fa783fdf4c12
Summary:
Previously we generated `removed` *or* `delete` instruction, but sometimes we have to generate both.
So, basically we did it wrong. :(
Reviewed By: mdvacca
Differential Revision: D7503386
fbshipit-source-id: 8ee476abd29f088f31dc776f6e6a68d5293fbb35
Summary:
The method replaces the current source node with its source node.
It's useful when we have to clone some node but don't want to change a source node pointer.
Reviewed By: fkgozali
Differential Revision: D7503384
fbshipit-source-id: 81ec64079c7e99cb9abdda2af10d85281a94e1b1
Summary:
Quite trivial.
Note that std::unordered_map's `operator[]` is not `const`, so we have to use `at` instead.
Reviewed By: mdvacca
Differential Revision: D7467799
fbshipit-source-id: df38b21dccee4b347f7c070600af0d52f38d6570
Summary:
The first and quite naive implementation of The Diffing algorithm.
The exact set of instructions, their semantic, order, amount, and excessiveness are still unclear.
The concept should be verified by comprehensive testing with working native views rendering layer.
Reviewed By: mdvacca
Differential Revision: D7467790
fbshipit-source-id: 08f2f646e058cac8a4b73bf7b148e2748633348d
Summary:
Motivation:
* We never should call `markDirtyAndPropogate()` during tree construction/mutation because it might affect trees in different thread/dimentions;
* In Fabric we basically always have to dirty nodes ourselves manually duting tree construction;
* In Fabric we don't have "scoped/limited" tree mutations which require recursive dirtying; any mutation is creation of the new tree instance;
* Default value of the `isDirty` flag is "false", so we have to change this right after creation of Yoga node (and after cloning).
Reviewed By: mdvacca
Differential Revision: D7467797
fbshipit-source-id: 2c9144271dceea6ba2b95173209b99b5d86fbd87
Summary:
The modern Concurent Yoga's concept is:
We have to set parent/owner reference as part of `appendChild` process only if the current reference to parent/owner is `null`.
The motivation:
* Null-parent indicates that this node was not attached to anything yet;
* So, in this case there is no any concurrent memory access because we always create and (first time) attach the node on same thread;
* Simmetrical parent-child relationship indicates that we don't need to (re)clone assosiated ShadowNode (nor Yoga node).
Reviewed By: mdvacca
Differential Revision: D7467791
fbshipit-source-id: 9a7f517380fde3bb00272de18fd5dc13edb52071
Summary: Previously we recreate a vector with pointers to child nodes every single time we modify the collection. That was okay but recently I realized that the we can simply make a copy of the vector one time during object construction and then mutate it freely.
Reviewed By: mdvacca
Differential Revision: D7467796
fbshipit-source-id: 660f1706a19ae5f07c34c509f411ce9d67b93b35
Summary:
Computed `layoutMetrics` are also considered as part of ViewShadowNode's value.
In the future we probably have to add something like `localData` and `imperativeCommands`.
We need all this for diffing algorithm and mointing phase.
Reviewed By: mdvacca
Differential Revision: D7467800
fbshipit-source-id: 8a0dcf1fd2f97dc501d6969cb0b0f6a2c6a648b4
Summary: Using methods of the base class instead of custom implementation.
Reviewed By: fkgozali
Differential Revision: D7467795
fbshipit-source-id: 4d168b72880f6900bf8b747e1d655c10140e0c79
Summary: We have to have getters for all props/fields.
Reviewed By: mdvacca
Differential Revision: D7467792
fbshipit-source-id: 1492aad2d3398e6c14e0e354047730cf91201175
Summary: Two additional types of instructions were added and now all of them have explicitly clear semantic.
Reviewed By: fkgozali
Differential Revision: D7467798
fbshipit-source-id: 83c0e774d56975be504aa3fe892035f5f724f809
Summary: Slightly new approach: Some non-const methods might not always mutate objects, so sometimes we should call `ensureUnsealed()` only inside conditional branches where we actually mutate an instance.
Reviewed By: fkgozali
Differential Revision: D7467793
fbshipit-source-id: 1b9f229cf6816e54e0df36699a571fdb612d3c3c
Summary: Trivial. Those nits prevent cause compilation errors in some configurations.
Reviewed By: fkgozali
Differential Revision: D7467794
fbshipit-source-id: cbda285748374fd941a0b1ca6718d702ca2d6d82
Summary: Test for equality will be used in ShadowNode Tree Diffing algorithm.
Reviewed By: fkgozali
Differential Revision: D7467802
fbshipit-source-id: 5383add9fc7d7e4a772ca16e70a54f7e0c36823a
Summary:
Trying this again with a fresh pullrequest as the old one kept having issued due to rebasing.
Fixes#16635
the issue is a little serious if you use a scrollview which contains textinput, you will never get a chance to input something since keyboard will always be dismissed because of on-drag event if your scroll-view use the property: keyboardDismissMode ='on-drag'
verify the issue #16635 and tested this fix worked
[ANDROID] [BUGFIX] [ScrollView] - Check that isTouching is also set when dismissing keyboard with on-drag android.
Closes https://github.com/facebook/react-native/pull/18785
Differential Revision: D7569815
Pulled By: hramos
fbshipit-source-id: 2a07369297ce9ce5a7714e513ccb480ee7011a4d
Summary:
Changed StyleSheet.create to be the identity function. We no longer hide it behind an opaque number. Better for types and perf since we don't use it.
I don't really know if we have/need any safer way of rolling this out than just landing it.
It can break if the object passed to StyleSheet.create is mutated afterwards but that isn't a practice anywhere I've seen.
Reviewed By: sophiebits
Differential Revision: D7530023
fbshipit-source-id: bc1afa879c5a5d9cd95cb13bc8ff3347b3622851
Summary:
Android apps play a touch sound on press, as long as you have "Touch sounds" enabled in the settings. As and Android user, when building my app using React Native, one of the first things I noticed was that there were not any touch sounds. This is missing from React Native and there have been multiple PRs to have this implemented, but no success.
This PR iterates over [#6825](https://github.com/facebook/react-native/pull/6825) and [#11136](https://github.com/facebook/react-native/pull/11136)
This PR keeps it simple by only implementing the enhancement for Android, as iOS apps typically do not use touch sounds, and follows the users' system settings for whether or not the sound is played.
I have manually tested this on multiple devices and emulators with zero problems
[ANDROID] [ENHANCEMENT] [UIManagerModule.java]- Adds Android click sound to touchables
[ANDROID] [ENHANCEMENT] [Touchable] - Adds Android click sound to touchables
Closes https://github.com/facebook/react-native/pull/17183
Differential Revision: D7560327
Pulled By: hramos
fbshipit-source-id: ce1094c437541bc677c7d64b0dba343dd9574422
Summary:
To date if you create a new `react-native@0.55.0` project and try to build/run it for iOS via CLI, e.g. by running:
```
$ react-native init test
$ cd test
$ react-native run-ios --no-packager
```
the build would succeed, but installing will fail afterwards:
```
** BUILD SUCCEEDED **
Installing Build/Products/Debug-iphonesimulator/test.app
An error was encountered processing the command (domain=NSPOSIXErrorDomain, code=2):
Failed to install the requested application
An application bundle was not found at the provided path.
Provide a valid path to the desired application bundle.
Print: Entry, ":CFBundleIdentifier", Does Not Exist
Command failed: /usr/libexec/PlistBuddy -c Print:CFBundleIdentifier Build/Products/Debug-iphonesimulator/test.app/Info.plist
Print: Entry, ":CFBundleIdentifier", Does Not Exist
```
This fail happens because `/usr/libexec/PlistBuddy` can't find `Info.plist` file at the provided path.
This is a regression introduced by changes from PR #17963 (accepted in 5447ca6707). If you execute test plan from that PR, it would fail.
As per why:
By default, `run-ios` process's working directory is `$PROJECT_DIR/ios`.
According to [this line in `runIOS.js`](3cd2b43426/local-cli/runIOS/runIOS.js (L184)), `xcodebuild` places all artifacts in `build` directory.
And the default Xcode paths for products is `Build/Products` (at least of Xcode 9.2 which I use, and Xcode 9.3 which I tested this with also).
So, the required `Info.plist` file is actually being created at `$PROJECT_DIR/ios/build/Build/Products/Debug-iphonesimulator/test.app/Info.plist` (with double `build`, the first from `derivedDataPath` key, the second from default products path). Relatively to `run-ios` process's working directory, the path of the file is `build/Build/Products/Debug-iphonesimulator/test.app/Info.plist`.
PR #17963 changed correct path to incorrect, thus introducing this regression.
If changes from that PR are reverted, CLI doesn't fail on install step.
I catch this error on both existing project and a freshly created test project. I can build/run an app from Xcode just fine, but running from CLI still would fail. The other workaround is to change path of products artifacts in Xcode, which is user settings and therefore can't be commited to a project's repo with VCS.
Run:
```
$ react-native init test
$ cd test
$ react-native run-ios --no-packager
```
Ensure that it doesn't fail on install step and produce output similar to this:
```
Installing build/Build/Products/Debug-iphonesimulator/test.app
Launching org.reactjs.native.example.test
```
[CLI][BUGFIX][local-cli/runIOS/runIOS.js] - Fix failing of `run-ios` command on install step
Closes https://github.com/facebook/react-native/pull/18700
Differential Revision: D7555096
Pulled By: hramos
fbshipit-source-id: d877b867e89256f4356f22781d78308affbb9d9c
Summary:
All public header files can be included from Obj-C and Swift, except RCTSurfaceSizeMeasureMode.h which contains C++ code.
Change is trivial and can be validated by review.
None.
[IOS][BUGFIX][{RCTSurfaceSizeMeasureMode.h}] - fix use of C++ syntax in an header file that could be included from Obj-C and Swift
Closes https://github.com/facebook/react-native/pull/18730
Differential Revision: D7550290
Pulled By: shergin
fbshipit-source-id: 3835e2c57697a067ff94afdaeaca06bce132ef66
Summary:
This reverts commit b9be28915c.
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.
<!--
Required: Write your motivation here.
If this PR fixes an issue, type "Fixes #issueNumber" to automatically close the issue when the PR is merged.
-->
Fix#18696
<!--
Required: 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!
-->
Run Jest tests.
Run WebSocket example from RNTester on Android.
<!--
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.
-->
[CATEGORY] [TYPE] [LOCATION] - Message
<!--
**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
-->
[ANDROID][BUGFIX][WebSocketModule] - revert change that regresses WebSocketModule
Closes https://github.com/facebook/react-native/pull/18733
Differential Revision: D7548850
Pulled By: hramos
fbshipit-source-id: b8c79810c1cd6e5a30ec4118bd5ff8ad719f04b9
Summary:
* cliPath is not config right
* root config can be better config instead of a relative path which can easily go wrong if location changed
* DeveloperSupport should only be in debug mode.
* make https://github.com/facebook/react-native/pull/18732 change on local.
* config signingConfig
* execute `./gradlew :RNTester:android:app:assembleRelease`, and run app on device to check everything is fine.
none
[GENERAL][ENHANCEMENT][RNTester]
Closes https://github.com/facebook/react-native/pull/18746
Differential Revision: D7548846
Pulled By: hramos
fbshipit-source-id: 8943f84a6c99456477dff2deeaacc96f093b2e09
Summary:
The reference needed to be updated after the file was moved in this commit:
06085d3836
Otherwise, results in the packager failing with the following error:
> Unable to resolve module TouchHistoryMath from /node_modules/react-native/Libraries/Interaction/PanResponder.js: Module TouchHistoryMath does not exist in the Haste module map
Closes https://github.com/facebook/react-native/pull/18732
Differential Revision: D7547181
Pulled By: sebmarkbage
fbshipit-source-id: 78028c2f46faa2ce130a1a0c25fcaca47d2516a8
Summary: There can be a race when loading JS from rootview for the first time vs touching rootview before JS is ready. This may cause redbox on the JS side.
Reviewed By: mdvacca
Differential Revision: D7531334
fbshipit-source-id: 36ffa1e5ff205f60b95e0a1d1016301ea76936aa
Summary:
This pull request implements Image.defaultSource property on Android, using Fresco (http://frescolib.org/docs/placeholder-failure-retry.html), which will show placeholder image (local asset) while loading remote image. Implementation code is almost same with loadingIndicatorSource, but without rotation.
This requires release or production to bundle local images in an APK file.
This provides feature parity with iOS.
Set Image.defaultSource on Android, and will show it while loading Image.source.
```JSX
<Image
defaultSource={require('<path to image>')}
source={{uri: '<url to remote image>'}}
style={{ height: 300, width: 300 }}
/>
```
[ANDROID] [FEATURE] [IMAGE] - Image.defaultSource will show local image as placeholder while loading remote Image.source.
Closes https://github.com/facebook/react-native/pull/18588
Differential Revision: D7540489
Pulled By: himabindugadupudi
fbshipit-source-id: 908ceb659b3416e517bba64c76a31879d965ec09
Summary:
Right now, `run-ios` will "boot" Simulator in the headless mode in the background, as long as the Simulator.app is not running. It is exactly what "detox" does - it executes your test suite in the background.
It seems to me that the author of this change was testing it with `Simulator.app` open.
In order to fix this behavior, we have to make sure it runs before we attempt booting.
This passed through the release process since we don't use `run-ios` there (it recommends turning on XCode and testing manually which is what I have done recently too).
Differential Revision: D7535693
Pulled By: hramos
fbshipit-source-id: 881db7740ace805ecefb98bfdb660e32aafd4664
Summary:
PR #17284 (accepted in 2ad34075f1) introduced a couple of regressions.
~1. There's the code:~
```
.then((appName) => resolve(selectedSimulator.udid, appName));
/* ... */
.then((udid, appName) => {
```
~~This makes `appName` to be always `undefined` as per `resolve` accepts only 1 argument. This regression causes issues if an app name differs from a scheme name.~
~This PR fixes this by wrapping both values in an array.~
This was fixed in 589eae1432.
2. The code
```
child_process.execFileSync('xcrun', ['simctl', 'boot', selectedSimulator.udid]);
```
makes a simulator *boot*, but the simulator *doesn't launch*. That's a regression, which forces developers to launch simulators by other means (by running a number of elaborate console commands, by running Xcode, or by running a simulator manually).
This PR reverts that part of changes.
Create a blank project with a name that differs from scheme name. Try to `react-native run-ios` in it. See that a simulator is launched and installing succeeds. Without this changes simulator wouldn't launch, and installing step would fail because of app name mismatch.
[CLI][BUGFIX][local-cli/runIOS/runIOS.js] - Fix running on multiple simulators feature regressions
Closes https://github.com/facebook/react-native/pull/18711
Differential Revision: D7535150
Pulled By: hramos
fbshipit-source-id: 5c714231e9977c0c829b6f8c793497cd31cd46b5
Summary: Recent commit that added YGConfig.h broke this project because the files were not added to it.
Reviewed By: shergin
Differential Revision: D7530369
fbshipit-source-id: 77129288905d25b94ad7aad4be43e0052a784163
Summary:
This hasn't been used by React core for a while. It's unclear why it was in the first place.
We can move it back next to the Panresponder.
https://github.com/facebook/react/pull/12557
Reviewed By: sophiebits
Differential Revision: D7529949
fbshipit-source-id: ef9892cfa8d2d6768da216b81befabe02795a245