Skip to content

Implement Reanimated connector #22

@chrfalch

Description

@chrfalch

We should add integration with react-native-reanimated shared values.

The integration should add listeners to shared values so that when a value changes the SkiaView / Canvas is repainted.

The integration should not add a hard dependency on Reanimated. If Reanimated is installed, the hook should work - if not it should emit a warning.

The integration should be implemented as a hook called useSharedValueEffect and the signature will be like this:

/**
 * Connects a shared value from reanimated to a SkiaView or Canvas
 * so whenever the shared value changes the SkiaView will redraw.
 * @param ref Reference to the SkiaView or Canvas
 * @param value Shared value to add change listeners for
 * @param values Additional (optional) shared values to add change listeners for
 */
export type useSharedValueEffectType = <T = number>(
  ref: RefObject<SkiaView>,
  value: SharedValueTypeWrapper<T>,
  ...values: SharedValueTypeWrapper<T>[]
) => void;

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions