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

[Drawer] On Android, ratio can be NaN or Infinity, causing exception #3483

Closed
ngocdaothanh opened this issue Feb 16, 2021 · 2 comments
Closed
Labels

Comments

@ngocdaothanh
Copy link

ngocdaothanh commented Feb 16, 2021

native-base: 2.15.2

Drawer source code:
https://github.com/GeekyAnts/NativeBase/blob/de81ef2fb8bd056f85e7bbc78d957f3d5ab43337/src/basic/Drawer/index.js

  tweenHandler: ratio => ({
    mainOverlay: { opacity: ratio / 2 }
  })

On Android (iOS is OK), ratio can be NaN or Infinity, causing exception:

[Invariant Violation: [3,"RCTView",{"opacity":"<<NaN>>"}] is not usable as a native method argument] 

[Invariant Violation: [3,"RCTView",{"opacity":"<<Infinity>>"}] is not usable as a native method argument] 

Fix:

  tweenHandler: (ratio: number) => {
    const ratioNumber = isFinite(ratio) ? ratio : 0
    return {mainOverlay: {opacity: ratioNumber / 2}}
  }

The example of Drawer should be updated to use React Hook useState and open property of react-native-drawer:
https://docs.nativebase.io/Components.html#Drawer


https://github.com/root-two/react-native-drawer hasn't been updated for a long time. And its README says:

For production applications we generally recommend using either React Native Side Menu or React Navigation as applicable

So probably native-base should switch to those libraries?

@gtaylor44
Copy link

I'm seeing something similar with Drawer component.

image

@stale
Copy link

stale bot commented Feb 2, 2022

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Feb 2, 2022
@stale stale bot closed this as completed Apr 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants