Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Methods Missing from Type Definitions #59

Closed
SaltedBlowfish opened this issue Feb 18, 2021 · 7 comments
Closed

Methods Missing from Type Definitions #59

SaltedBlowfish opened this issue Feb 18, 2021 · 7 comments

Comments

@SaltedBlowfish
Copy link

addHasReachedTopListener and removeHasReachedTopListener are missing from the TypeScript definitions causing an error when importing from react-native-actions-sheet.

Reproduction:

  1. Start TypeScript React Native project
  2. Import the required functions:
import ActionSheet, {
  addHasReachedTopListener,
  removeHasReachedTopListener,
} from 'react-native-actions-sheet';

Output:

Module '"react-native-actions-sheet"' has no exported member 'addHasReachedTopListener'. Did you mean to use 'import addHasReachedTopListener from "react-native-actions-sheet"' instead?
Module '"react-native-actions-sheet"' has no exported member 'removeHasReachedTopListener'. Did you mean to use 'import removeHasReachedTopListener from "react-native-actions-sheet"' instead?
@ammarahm-ed
Copy link
Owner

I will add the defs! Thanks for reporting

@naderalfakesh
Copy link

Currently I am using until we get the defs in the new release:
Thanks in advanced

useEffect(() => {
    DeviceEventEmitter.addListener('hasReachedTop', callback);
    return () => {
      DeviceEventEmitter.removeListener('hasReachedTop', callback);
    };
  }, []);

@ammarahm-ed
Copy link
Owner

ammarahm-ed commented Apr 18, 2021

fixed in v0.4.4
There is also a new prop added that you can use:

<ActionSheet
onPositionChanged={(onReachedTop)=>{}}
/>

@efstathiosntonas
Copy link

@ammarahm-ed why onPositionChanged is a mandatory prop? I think it should be optional

@ammarahm-ed
Copy link
Owner

@ammarahm-ed why onPositionChanged is a mandatory prop? I think it should be optional

Yeah, I think I forgot to add "?" in type defs

@ammarahm-ed
Copy link
Owner

@ammarahm-ed why onPositionChanged is a mandatory prop? I think it should be optional

Published new version with the fix.

@efstathiosntonas
Copy link

Thanks for the quick fix!! Keep up the great work!

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

No branches or pull requests

4 participants