Skip to content

Commit be0aab4

Browse files
authored
Add fade animation (#11)
1 parent 5edd71e commit be0aab4

File tree

14 files changed

+2469
-2441
lines changed

14 files changed

+2469
-2441
lines changed

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ const App = () => {
6363
import { openBrowser } from "@swan-io/react-native-browser";
6464

6565
openBrowser("https://swan.io", {
66+
animationType: "", // "fade" | "slide" (default to "slide")
6667
dismissButtonStyle: "close", // "cancel" | "close" | "done" (default to "close")
6768
barTintColor: "#FFF", // in-app browser UI background color
6869
controlTintColor: "#000", // in-app browser buttons color

android/src/main/java/io/swan/rnbrowser/RNSwanBrowserModuleImpl.java

+13-4
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,19 @@ protected static void open(final Activity activity,
3636
intentBuilder.setShowTitle(false);
3737
intentBuilder.setInstantAppsEnabled(false);
3838

39-
intentBuilder.setStartAnimations(activity,
40-
com.facebook.react.R.anim.catalyst_slide_up, io.swan.rnbrowser.R.anim.inert);
41-
intentBuilder.setExitAnimations(activity,
42-
io.swan.rnbrowser.R.anim.inert, com.facebook.react.R.anim.catalyst_slide_down);
39+
String animationType = options.getString("animationType");
40+
41+
if (animationType != null && animationType.equals("fade")) {
42+
intentBuilder.setStartAnimations(activity,
43+
com.facebook.react.R.anim.catalyst_fade_in, io.swan.rnbrowser.R.anim.inert);
44+
intentBuilder.setExitAnimations(activity,
45+
io.swan.rnbrowser.R.anim.inert, com.facebook.react.R.anim.catalyst_fade_out);
46+
} else {
47+
intentBuilder.setStartAnimations(activity,
48+
com.facebook.react.R.anim.catalyst_slide_up, io.swan.rnbrowser.R.anim.inert);
49+
intentBuilder.setExitAnimations(activity,
50+
io.swan.rnbrowser.R.anim.inert, com.facebook.react.R.anim.catalyst_slide_down);
51+
}
4352

4453
@ColorInt int blackColor = activity.getResources().getColor(android.R.color.black);
4554
CustomTabColorSchemeParams.Builder paramsBuilder = new CustomTabColorSchemeParams.Builder();

example/Gemfile.lock

+12-12
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,13 @@ GEM
55
base64
66
nkf
77
rexml
8-
activesupport (6.1.7.7)
8+
activesupport (7.0.8.4)
99
concurrent-ruby (~> 1.0, >= 1.0.2)
1010
i18n (>= 1.6, < 2)
1111
minitest (>= 5.1)
1212
tzinfo (~> 2.0)
13-
zeitwerk (~> 2.3)
14-
addressable (2.8.6)
15-
public_suffix (>= 2.0.2, < 6.0)
13+
addressable (2.8.7)
14+
public_suffix (>= 2.0.2, < 7.0)
1615
algoliasearch (1.27.5)
1716
httpclient (~> 2.8, >= 2.8.3)
1817
json (>= 1.5.1)
@@ -57,27 +56,29 @@ GEM
5756
netrc (~> 0.11)
5857
cocoapods-try (1.2.0)
5958
colored2 (3.1.2)
60-
concurrent-ruby (1.2.3)
59+
concurrent-ruby (1.3.3)
6160
escape (0.0.4)
6261
ethon (0.16.0)
6362
ffi (>= 1.15.0)
64-
ffi (1.16.3)
63+
ffi (1.17.0)
6564
fourflusher (2.3.1)
6665
fuzzy_match (2.0.4)
6766
gh_inspector (1.1.3)
6867
httpclient (2.8.3)
69-
i18n (1.14.4)
68+
i18n (1.14.5)
7069
concurrent-ruby (~> 1.0)
7170
json (2.7.2)
72-
minitest (5.22.3)
71+
minitest (5.24.1)
7372
molinillo (0.8.0)
7473
nanaimo (0.3.0)
7574
nap (1.1.0)
7675
netrc (0.11.0)
7776
nkf (0.2.0)
7877
public_suffix (4.0.7)
79-
rexml (3.2.6)
78+
rexml (3.2.9)
79+
strscan
8080
ruby-macho (2.5.1)
81+
strscan (3.1.0)
8182
typhoeus (1.4.1)
8283
ethon (>= 0.9.0)
8384
tzinfo (2.0.6)
@@ -89,7 +90,6 @@ GEM
8990
colored2 (~> 3.1)
9091
nanaimo (~> 0.3.0)
9192
rexml (~> 3.2.4)
92-
zeitwerk (2.6.13)
9393

9494
PLATFORMS
9595
ruby
@@ -99,7 +99,7 @@ DEPENDENCIES
9999
cocoapods (>= 1.13, < 1.15)
100100

101101
RUBY VERSION
102-
ruby 2.6.10p210
102+
ruby 3.3.4p94
103103

104104
BUNDLED WITH
105-
1.17.2
105+
2.5.14

0 commit comments

Comments
 (0)