Giter Site home page Giter Site logo

dcangulo / react-native-outside-press Goto Github PK

View Code? Open in Web Editor NEW
114.0 2.0 3.0 1.77 MB

airbnb/react-outside-click-handler but for React Native.

Home Page: https://www.npmjs.com/package/react-native-outside-press

License: MIT License

JavaScript 29.10% TypeScript 70.90%
react-native expo react react-native-macos react-native-web react-native-windows reactjs

react-native-outside-press's Introduction

Hi ๐Ÿ‘‹, I'm David Angulo

Software Engineer

dcangulo-profile-views

Stats

dcangulo-streak

dcangulo-stats

Languages

dcangulo-languages

Trophies

dcangulo-trophies

react-native-outside-press's People

Contributors

dcangulo avatar dependabot[bot] avatar gulewei avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

react-native-outside-press's Issues

Fantastic library!

It's just to say to all contributors that you did an awesome job!!!

Thanks a lot for your work!

Renders white screen

For some reasons it doesn't work for me

I do have this in my app.js

const App = () => ( <Provider store={configureStore()}> <PaperProvider> <SafeAreaView style={styles.safeAreaContainer}> <EventProvider> <Screens /> </EventProvider> </SafeAreaView> </PaperProvider> </Provider> );

and in another component this:

<OutsidePressHandler onOutsidePress={() => { console.log('Pressed outside the box!'); }} > <View style={{ height: 200, width: 200, backgroundColor: 'black' }} /> </OutsidePressHandler>

And it shows me just a white screen, and no errors

Allow outside press event to bubble on web

The basic idea is this: clicking on i.e. a button, which would trigger the outside press handler of a different element, should still also execute its own click handler, without having to re-press it.

Based on some crude testing, it seems this already works on native platforms (though I haven't tested all of them), but not on the web.

Now, this might be an issue with my particular project, but sadly I can't share it's code. I hope someone else can confirm the issue, otherwise I'll see about getting a minimal example running.

Can we drop the node engine check

When I install this package, it complains incompatible node version.

error [email protected]: The engine "node" is incompatible with this module. Expected version ">= 16.0.0". Got "14.21.3"

I don't think this is necessary, cause we don't run these code on node. So can we drop the engine check?

`onOutsidePress` doesn't trigger if clicked on any event outside OutsidePressHandler

Thanks for the awesome library. I'm using it on react native web.

I'm facing the issue where clicking anything outside like Buttons or TouchableOpacity doesn't trigger onOutsidePress

Example:

<>
  <OutsidePressHandler
  disabled={false}
  onOutsidePress={() => {
    console.log("Clicked outside 200 x 200 view")
  }}>
    <View style={{  height: 200, width: 200}}></View>
  </OutsidePressHandler>
  <TouchableOpacity onPress={() => console.log("Clicked!")}>
    <Text>Click Me</Text>
  </TouchableOpacity>
</>

Clicking on Click Me doesn't trigger onOutsidePress

Triggers when scrolling

If I touch anywhere just to scroll my outer ScrollView around, the library will immediately fire, causing my expanded component to collapse, which is not what I intended.

Since IMHO that should be the default behavior, I just pushed PR #360 to fire the event on touchEnd instead of touchStart, thus allowing the OS to decide whether this is going to be a scroll or not.

Warning: Maximum update depth exceeded.

Hi! I found your library and seems to works well, but there is an issue in react-native-web (running with EXPO and webpack)
As soon as OutsidePressHandler is added it starts warning like below:

Warning: Maximum update depth exceeded. This can happen when a component calls setState inside useEffect, but useEffect either doesn't have a dependency array, or one of the dependencies changes on every render.

image
<>
... 
  <OutsidePressHandler onOutsidePress={closeAttachmentsMenu} disabled={!isAttachmentsMenuOpen}>
        <AttachmentsMenu isOpen={isAttachmentsMenuOpen} />
  </OutsidePressHandler>
  <ActionBar />
</>

functionality is ok, but I thing there something missing in the library.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.