Skip to content

Conversation

@m-bert
Copy link
Contributor

@m-bert m-bert commented Aug 6, 2024

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
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 (
    <View style={styles.container}>
      <GestureDetector gesture={g}>
        <View style={styles.box} />
      </GestureDetector>
    </View>
  );
}

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

@m-bert m-bert requested a review from j-piasecki August 6, 2024 10:32
@m-bert m-bert requested a review from j-piasecki August 7, 2024 08:34
@m-bert m-bert merged commit c3ae5ac into main Aug 7, 2024
@m-bert m-bert deleted the @mbert/fix-scale-crash branch August 7, 2024 09:21
@EvertEt
Copy link

EvertEt commented Aug 27, 2024

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
Copy link
Member

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

@EvertEt
Copy link

EvertEt commented Aug 27, 2024

Thank you! 🤞

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.

5 participants