chore: Remove js props updating via cpp
Summary
This PR removes the entire CPP logic of JS props handling and keeps this logic only on the JS side. In the new approach, instead of marking props as JS props for all components with the same native component name, we can easily decide, which props are JS props, separately for each component instance, which is more flexible and safer behavior than before.
The new approach allows these 2 possible ways to declare js props:
- Via the static
getJSPropNamesmethod declared on the component class or function component declaration
static getJSPropNames() {
return ['x', 'y'] as const;
}
or
function FunctionComponent() { ... }
FunctionComponent.getJSPropNames = () => ['x', 'y']
- By passing prop names array using the
optionsparameter on thecreateAnimatedComponentfunction:
const AnimatedG = Animated.createAnimatedComponent(G, {
jsPropNames: ['x', 'y'],
});
If the component has getJSPropNames static method already declared and jsPropNames were provided in options at the same time, jsPropNames take precedence over the getJSPropNames method declaration and are used instead of props returned by getJSPropNames.
Example recordings
This recording just shows that our current JSPropsExample works fine (even the dot flickering when the example screen is left no longer occurs)
Before (main) |
After (this branch) |
|---|---|