mirror of
https://github.com/status-im/react-native.git
synced 2025-02-23 14:48:25 +00:00
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