react-native-paper icon indicating copy to clipboard operation
react-native-paper copied to clipboard

fix: wrong types for onPress and onLongPress and bug in example app

Open RichardLindhout opened this issue 4 years ago • 4 comments

Summary

I'm working on a navigation library on top of react-router-dom and react-native-navigation. But the Link component I'm using won't work well with the onPress of react-native-paper in typescript since the event is not defined in typescript (but is provided to the function)

  const onPress = React.useCallback(
    (event: GestureResponderEvent) => {
      if (!event.defaultPrevented) {
        event.preventDefault();
        navigation.push(to, params);
      }
    },
    [navigation, to, params],
  );

Types of property 'onPress' are incompatible.         Type '(e: GestureResponderEvent) => any' is not assignable to type '() => void'. Schermafbeelding 2020-12-02 om 23 26 23

I decided to fix it everywhere so I can use links on some places or it just good to provide it to users so can they can provide preventDefault() or things like that.

Test plan

RichardLindhout avatar Dec 02 '20 22:12 RichardLindhout

Hey @RichardLindhout, thank you for your pull request 🤗. The documentation from this branch can be viewed here.

callstack-bot avatar Dec 02 '20 22:12 callstack-bot

Schermafbeelding 2020-12-02 om 23 43 16

This fixes a bug in the example app too since the android button is not switchable at all it is always 'checked' after first click since the argument is only an event and not the previous status.

RichardLindhout avatar Dec 02 '20 22:12 RichardLindhout

Hello 👋, this pull request has been open for more than 2 months with no activity on it. If you think this is still necessary with the latest version, please comment and ping a maintainer to get this reviewed, otherwise it will be closed automatically in 7 days.

github-actions[bot] avatar Feb 01 '21 00:02 github-actions[bot]

Hello 👋, this pull request has been open for more than 2 months with no activity on it. If you think this is still necessary with the latest version, please comment and ping a maintainer to get this reviewed, otherwise it will be closed automatically in 7 days.

github-actions[bot] avatar Apr 11 '21 00:04 github-actions[bot]

Closing due to your second PR https://github.com/callstack/react-native-paper/pull/3484 😓

ToggleButton's I will handle separately.

lukewalczak avatar Dec 12 '22 13:12 lukewalczak