wix / react-native-ui-lib

UI Components Library for React Native
https://wix.github.io/react-native-ui-lib/
MIT License
6.44k stars 706 forks source link

Button onPress function doesn't get called #2582

Closed omarichatman closed 1 year ago

omarichatman commented 1 year ago

Description

When using the Button, when I click the button the function I am passing doesn't get called.

Related to

Steps to reproduce

Steps to reproduce the behavior:

  1. Render a Button component with an onPress property.
  2. Click on the button
  3. See the function you are passing is not getting called

Expected behavior

Function being passed to the onPress is called

Actual behavior

Function being passed to the onPress is not called

More Info

Code snippet

import React from 'react';
import { Button } from 'react-native-ui-lib';

export default function Welcome({ navigation }: AuthStackScreenProps<'Welcome'>) {

const handleRegisterPress = () => {
   console.log('Register Button Pressed'); // Not called
};

return (
                        <Button 
                            style={styles.button}
                            onPress={() => handleRegisterPress()}
                            color={styles.button.color}
                            backgroundColor={styles.button.backgroundColor}
                            size={styles.button.size}
                            label='Register'
                            fullWidth
                            enableShadow
                        />
    );
};

Screenshots/Video

Environment

Expo on mobile Android device

Affected platforms

omarichatman commented 1 year ago

Not able to repro anymore...

trofima commented 1 year ago

Closing due to the issue does not reproduce.

damianbeles commented 1 year ago

I reproduced it. Put the button inside a React-Native Modal.