software-mansion / react-native-gesture-handler

Declarative API exposing platform native touch and gesture system to React Native.
https://docs.swmansion.com/react-native-gesture-handler/
MIT License
6.13k stars 982 forks source link

[web] Fix `scale` #3031

Closed m-bert closed 3 months ago

m-bert commented 3 months ago

Description

This PR does 2 things:

  1. Adds check if style.scale is defined in order to avoid crash when trying to call split method
  2. Fixes incorrect scaleY if only one value was present in style.scale

[!NOTE] While I'm not sure why style.scale was undefined when it should be none, I suspect that this may be caused by NativeWind

Test plan

Using code below I've verified that scale is calculated correctly by manipulating element.style in inspector.

Test code ```tsx import React from 'react'; import { StyleSheet, Text, View } from 'react-native'; import { Gesture, GestureDetector } from 'react-native-gesture-handler'; export default function EmptyExample() { const g = Gesture.Pan(); return ( ); } const styles = StyleSheet.create({ container: { flex: 1, justifyContent: 'center', alignItems: 'center', backgroundColor: '#F5FCFF', }, box: { width: 100, height: 100, backgroundColor: 'plum', borderRadius: 10, }, }); ```
Style Logs
image image
EvertEt commented 2 months ago

Hey @m-bert ! We came across an uptick of this split crash on our side as well. Do you know if there is a release planned soon including this fix?

Many thanks in advance and for this fix!

j-piasecki commented 2 months ago

Hi @EvertEt! Most likely this or the next week.

EvertEt commented 2 months ago

Thank you! 🤞