Граф коммитов

15 Коммитов

Автор SHA1 Сообщение Дата
Valentin Shergin 6f97733bb8 Fabric: Changing `ComponentName` type alias from `std::string` to `char *`
Summary:
ComponentName is used by many core component of React Native, such as ComponentDescriptor, ShadowNode, ShadowView and so on. In all those cases this value represents the actual name of the component which came from `concreteComponentName` template parameter of ConcreteShadowNode. In all of those cases, it's raw `char const *` type. So, we don't need to use owning representation of the string (std::string) in all those places.

The only exception from this is a part where we receive the name of the component from JS side. In this case, the source string comes from JS and has to be analyzed as a character sequence to find corresponding ComponentDescriptor.

In my experiments, 20% of the time during diffing is spent on copying (this) `std::string`.

Reviewed By: mdvacca

Differential Revision: D15844407

fbshipit-source-id: a2e71505e22d09107e001bdf661d4a826bcf2dea
2019-06-18 11:31:20 -07:00
Valentin Shergin 035e0403bb Fabric: `ShadowNodeFragment::rootTag` was renamed to `surfaceId`
Summary:
Trivial.
We are replacing rootTag with surfaceId according to the plan describing here: https://fb.workplace.com/groups/rn.fabric/permalink/1374002366064519/

Reviewed By: JoshuaGross, mdvacca

Differential Revision: D15039134

fbshipit-source-id: ec8c3044f9f3f23939488bc01c66e9b653e651dd
2019-04-29 21:21:10 -07:00
Valentin Shergin 832164169d Fabric: Unification of registration process of `ComponentView`s and `ComponentDescriptor`s
Summary:
Registries, providers, providers of registries, registres of providers. All that can be really confusing, but that represents best the constraints and desires that we have:
* We need to be able to register components on-the-fly (so we need a mechanism that will propagate changes);
* We don't want to register ComponentDescriptors separately from ComponentView classes;
* C++ not always gives us abstractions that we want (e.g. pointers to constructors).

After the change, we can remove the whole Buck target that has a bunch of handwritten boilerplate code.

There is a still room for polish and removing some concepts, types or classes but this diff is already huge.

Reviewed By: JoshuaGross

Differential Revision: D14983906

fbshipit-source-id: ce536ebea0c905059c7a4d644dc25233e2809761
2019-04-17 22:44:20 -07:00
Valentin Shergin 45ae1e4411 Fabric: `[]`-family of methods was removed from ComponentDescriptorRegistry
Summary:
Motivation:
 * We don't use them much, and we already have `at`-methods, which are better.
* We don't want to expose `ComponentDescriptor`s as shared pointers (because it's not clear, not so performant, and because we don't want to store them as shared pointer in the future);
* In idiomatic C++ `[]` operator has mutating semantic, that's not what we want to communicate via the interface of the class.

Reviewed By: sahrens

Differential Revision: D14963487

fbshipit-source-id: dbfddee2ba90d70c3bb8dcf1959d553571c47bab
2019-04-17 13:39:20 -07:00
Kevin Gozali 417adf526f Fabric iOS: allow using fallback component for unsupported ones
Summary:
This allows an unsupported component to be rendered as a "unimplemented view" for better visualization of which component is missing. It is off by default, but configurable in the component factory.

For now, the layout simply follows regular <View />, which means the width/height etc is based on the react component styling. The side effect is that components with 0 height/width won't show up at all.

Reviewed By: mdvacca

Differential Revision: D14869656

fbshipit-source-id: f31e012fb7dc1c64fcc431ea5aa45079a23a618e
2019-04-10 11:04:23 -07:00
Valentin Shergin 2409fbaeba Fabric: Using better::map in ComponentDescriptorRegistry
Summary: Trivial.

Reviewed By: mdvacca

Differential Revision: D14249487

fbshipit-source-id: 6dca86d9fcf5c70e08289fc92e5c5a3fa3558238
2019-03-03 13:50:35 -08:00
Valentin Shergin 94d49e544d Fabric: Codemod: All `<fabric/...` includes were renamed to `<react/...`
Summary: We are moving to more stable APIs removing all mentiones of the effort name from the codebase.

Reviewed By: mdvacca

Differential Revision: D12912894

fbshipit-source-id: 4a0c6b9e7454b8b14e62d419e9e9311dc0c56e7a
2018-11-10 14:22:15 -08:00
Valentin Shergin 6c5b8c603b Fabric: Introduced ComponentDescriptorRegistry::at() method family
Summary: This is more usable (because it allows to use `->` operator) and safe (const-style) methods replacing old `operator[]` methods.

Reviewed By: mdvacca

Differential Revision: D12876744

fbshipit-source-id: 8ea7398c9777f8be3e88db873ec00915d0761615
2018-11-06 11:03:50 -08:00
Spencer Ahrens aab01608ba Update and expand bytecode spec
Summary:
* Adds parent tag as param for createNode in place of explicit appendChild commands.
* Adds version info to bytecode
* Adds native conditional support:

Conditionals are represented in product code with the new `NativeConditional` React
component. It takes params necessary to construct a native function call, and takes
a render prop as a child that passes the value of the native call as an arg. In
prod, the component would actually call the native module and render with that value,
but in jest we render for *both* true and false and set them as children
of a new jest-only primitive/host component which we special-case and generate a
special command with `OP_CODE.conditional`, generate the appropriate bytecode commands
for each branch, and embed them as args in the conditional OP_CODE command. When
evaluating the bytecode, only one set of commands is executed, based on the native
module value (which is evaluated with another new opcode which computes the value
and stuffs it in a "register").

Obviously generating this bytecode is kind of a cludge compared to prepack, but
when I asked @[501709947:Dominic] about it, he said they had no bytecode spec right
now, so I'm running ahead with this prototype. The main thing I'm focused on is
the C++/RN bytecode interpretter - this jest stuff is just a way to generate bytecode
for it to consume which could be replaced or augmented with many other approaches,
such as prepack, server rendering, etc.

Also piggybacked a bunch of other cleanup.

Reviewed By: shergin

Differential Revision: D10277121

fbshipit-source-id: 15d3217a59ef481b574c742d17d8a7dc893cba90
2018-11-05 15:43:55 -08:00
Spencer Ahrens 83da74b556 Refactor uimanager stuff a bit
Summary: Simplies UIManager a bit and some other tweaks

Reviewed By: shergin

Differential Revision: D10211883

fbshipit-source-id: 93ab23dd2baab2fdc6d9c54e976b001a19efab7f
2018-10-10 20:01:04 -07:00
Valentin Shergin 8f51243957 Fabric: Enabling clang-format for the rest of Fabric
Summary: This is the second and the final part of adopting clang-format.

Reviewed By: mdvacca

Differential Revision: D10229624

fbshipit-source-id: d97670b716800ea2488b84bd0aacaf54d8bd2e31
2018-10-09 16:31:48 -07:00
Héctor Ramos 1151c096da Update copyright headers to yearless format
Summary: This change drops the year from the copyright headers and the LICENSE file.

Reviewed By: yungsters

Differential Revision: D9727774

fbshipit-source-id: df4fc1e4390733fe774b1a160dd41b4a3d83302a
2018-09-11 15:33:07 -07:00
Héctor Ramos da7873563b Migrate Android sources to MIT license header
Reviewed By: fkgozali

Differential Revision: D8065619

fbshipit-source-id: 719c303b40c96950bab8e5dde9a75f449b2956c6
2018-05-31 15:37:30 -07:00
Valentin Shergin 5463fc260b Fabric: ComponentDescriptorRegistry::operator[] marked as const
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
2018-04-10 12:59:51 -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