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

feature: Implement custom fade out duration #405

Merged
merged 6 commits into from
Dec 3, 2022
Merged

feature: Implement custom fade out duration #405

merged 6 commits into from
Dec 3, 2022

Conversation

TheNerdGuyLulu
Copy link
Contributor

Summary

This feature implements a custom duration for the splash screen fade out.
The parameter is optional, with the default being 220ms, as it was already before, making it backwards compatible without any changes for the current consumers.

Test Plan

What's required for testing (prerequisites)?

Android emulator & iOS simulator is enough.

What are the steps to test it (after prerequisites)?

import {
  View,
} from "react-native";
import * as BootSplash from "react-native-bootsplash";


export const App = () => {

  React.useEffect(() => {
     BootSplash.hide({fade:true, duration: 2500}); // Edit duration
  }, []);

  return (
    <View />)
};

Compatibility

OS Implemented
iOS
Android

Checklist

  • I have tested this on a device and a simulator
  • I added the documentation in README.md
  • I added a sample use of the API in the example project (example/App.tsx)

The current example project isn't "visually" compatible with this feature, as the logo is hidden from JS.

@zoontek
Copy link
Owner

zoontek commented Nov 25, 2022

@TheNerdGuyLulu There's a small issue here (not in the PR, but in the feature).
I noticed that on Android, when the duration is short (ex: try 100ms), it just doesn't fade at all.

The feature might exists, but it needs to be clamp at 220 (native side equivalents of Math.max(220, userDurationValue) on both iOS and Android

package.json Outdated Show resolved Hide resolved
src/index.ts Outdated Show resolved Hide resolved
@TheNerdGuyLulu
Copy link
Contributor Author

@zoontek Thanks for such quick code review.
I'm going to take care about this comments ASAP.

@TheNerdGuyLulu
Copy link
Contributor Author

The feature might exists, but it needs to be clamp at 220 (native side equivalents of Math.max(220, userDurationValue) on both iOS and Android

@zoontek Wouldn't be enough to use Math.max(220, userDurationValue) and send it from JS, instead of native function?
I'm happy to go with native way, just asking since a value is required to be given to the function (right now the 220 is default value from JS side) - we can do the math from JS.

@zoontek
Copy link
Owner

zoontek commented Nov 25, 2022

@TheNerdGuyLulu Yeah, close enough to do it on the JS side

@TheNerdGuyLulu
Copy link
Contributor Author

@zoontek CR comments addressed 🤞🏻

@TheNerdGuyLulu
Copy link
Contributor Author

@zoontek
Could you please take a look when you have the time? 🙏

@zoontek
Copy link
Owner

zoontek commented Dec 3, 2022

LGTM, thanks

@zoontek zoontek merged commit 1817ae9 into zoontek:master Dec 3, 2022
@TheNerdGuyLulu TheNerdGuyLulu deleted the feature/implement-custom-fade-out-duration branch December 3, 2022 16:30
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

Successfully merging this pull request may close these issues.

2 participants