66import com .facebook .react .bridge .ReactApplicationContext ;
77import com .facebook .react .bridge .ReactContextBaseJavaModule ;
88import com .facebook .react .bridge .ReactMethod ;
9+ import com .facebook .react .bridge .ReadableMap ;
910
1011import java .util .Collections ;
1112import java .util .HashMap ;
@@ -24,14 +25,35 @@ public String getName() {
2425 }
2526
2627 @ ReactMethod
27- public void close (final int animationType , final int duration , int delay ) {
28+ public void close (ReadableMap options ) {
29+
30+ int animationType = RCTSplashScreen .UIAnimationNone ;
31+ int duration = 0 ;
32+ int delay = 0 ;
33+
34+ if (options != null ) {
35+ if (options .hasKey ("animationType" )) {
36+ animationType = options .getInt ("animationType" );
37+ }
38+ if (options .hasKey ("duration" )) {
39+ duration = options .getInt ("duration" );
40+ }
41+ if (options .hasKey ("delay" )) {
42+ delay = options .getInt ("delay" );
43+ }
44+ }
45+
2846 if (animationType == RCTSplashScreen .UIAnimationNone ) {
2947 delay = 0 ;
3048 }
49+
50+ final int final_animationType = animationType ;
51+ final int final_duration = duration ;
52+
3153 final Handler handler = new Handler ();
3254 handler .postDelayed (new Runnable () {
3355 public void run () {
34- RCTSplashScreen .removeSplashScreen (getCurrentActivity (), animationType , duration );
56+ RCTSplashScreen .removeSplashScreen (getCurrentActivity (), final_animationType , final_duration );
3557 }
3658 }, delay );
3759 }
0 commit comments