Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Swipeable misalignment after resizing on web #3341

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

latekvo
Copy link
Contributor

@latekvo latekvo commented Jan 16, 2025

Description

This PR allows Swipeable to be dynamically resized.

Fixes #3333

Test plan

  • open any swipeable example on web
  • resize window
  • see how the ReanimatedSwipeable still works, while the legacy Swipeable is misaligned

@latekvo latekvo changed the title Simplify Swipeable logic. Fix Swipeable misalignment after resizing on web Jan 16, 2025
Copy link
Contributor

@blazejkustra blazejkustra left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works well on web 👍

@latekvo latekvo marked this pull request as ready for review January 16, 2025 14:01
@latekvo latekvo requested a review from m-bert January 16, 2025 14:03
@latekvo
Copy link
Contributor Author

latekvo commented Jan 16, 2025

This PR breaks the following repro: Fixed.

Collapsed repro
import React from 'react';
import { View, Text } from 'react-native';
import Swipeable from 'react-native-gesture-handler/ReanimatedSwipeable';

export default function Example() {
  return (
    <Swipeable
      leftThreshold={50}
      rightThreshold={50}
      renderLeftActions={() => {
        return (
          <View style={{ height: 80, width: 80, backgroundColor: 'yellow' }}>
            <Text>Left</Text>
          </View>
        );
      }}
      renderRightActions={() => {
        return (
          <View style={{ height: 80, width: 80, backgroundColor: 'magenta' }}>
            <Text>Right</Text>
          </View>
        );
      }}>
      <View
        style={{
          height: 80,
          backgroundColor: 'blue',
        }}
      />
    </Swipeable>
  );
}

@latekvo latekvo marked this pull request as draft January 16, 2025 15:25
@latekvo latekvo marked this pull request as ready for review January 17, 2025 13:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ReanimatedSwipeable doesn't display right actions properly on window resize
2 participants