raphamorim / react-ape

🦍• React Renderer to build UI interfaces using canvas/WebGL (TV and Hardware-Accelerated GPU development based)
https://raphamorim.io/react-ape/
MIT License
1.57k stars 48 forks source link

Introducting WebAssembly rendering and ReactApeTree #124

Closed raphamorim closed 2 years ago

raphamorim commented 2 years ago

Summary

This PR introduces two new features to the React Ape render:

Below the explanation/overview for each of the features

ReactApeTree Overview

Since React Ape render using canvas, it can't properly read parent styles correctly. The idea behind this PR is to reduce issues regarding hierarchy, those problems makes the App looks super weird unless you rule/specify intentionally in every View which style it should carry (it's how Ape works nowaday ~unfortanelly~).

This PR introduces a tree that contains the layout and style property for each node, so can easily propagate it between children

Related #67

Known issues:

Demo

return (
  <View style={{width: 80, height: 80, backgroundColor: 'grey', color: 'orange'}}>
    <View>
      <View style={{width: 80, height: 80, backgroundColor: 'powderblue'}}>
        <View
          style={{
            width: 30,
            height: 30
          }}>
          <Text>should be in orange</Text>
        </View>
      </View>
    </View>
  </View>
);

Before

Skärmavbild 2022-06-22 kl  06 46 07

After

Usage of _reactApeTree when process.env.NODE_ENV !== 'production'

Screen Shot 2022-07-11 at 19 52 03