Skip to content

Trying to get it to work with Reanimated #62

Description

@jlmurphysa

Hi there.

I'm trying to get the underlay opacity to increase in proportion to percentOpen.
Am getting this error and am struggling to figure out why:
image

Am using it with react-native-draggable-flatlist like this:

  const DeleteUnderlay = () => {
    const { percentOpen } = useSwipeableItemParams<PlayerSet>()
    const animatedStyle = useAnimatedStyle(
      () => ({
        opacity: percentOpen.value,
      }),
      [percentOpen],
    )

    useEffect(() => {
      console.log('swipeableItemParams.percentOpen :>> ', percentOpen.value)
    }, [percentOpen.value])

    return (
      <XStack style={[styles.underlayLeft, animatedStyle]}>
        <TouchableOpacity
          onPress={() => {
            console.log('onPress called')
          }}
        />
      </XStack>
    )
  }
  const renderItem = useCallback(
  ({ item, drag }: RenderItemParams<PlayerSet>) => (
    <SwipeableItem
      activationThreshold={DELETE_ACTIVATION_THRESHOLD}
      item={item}
      key={item.id}
      renderUnderlayLeft={() => <DeleteUnderlay />}
      snapPointsLeft={DELETE_SNAP_POINTS}
      swipeDamping={DELETE_SWIPE_DAMPING}
    >
      {/* <ShadowDecorator> */}
      <SetCardItem
        artists={item.artists}
        artwork={item.artwork}
        assetId={item.id}
        closePopup={() => {}}
        drag={drag}
        duration={item.duration}
        isPopupOpen={false}
        key={item.id}
        listeningDuration={item.listeningDuration}
        openPopup={() => {}}
        ratingCount={item.ratingCount}
        ratingType={item.ratingType}
        setTitle={item.title}
      />
      {/* </ShadowDecorator> */}
    </SwipeableItem>
  ),
  [],
)

Help/insight would be much appreciated 🙏

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions