Skip to content

Commit c5fe5d1

Browse files
committed
docs: update 49dad9a
0 parents  commit c5fe5d1

443 files changed

Lines changed: 5855 additions & 0 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.nojekyll

Whitespace-only changes.
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
## The problem
2+
3+
You're likely running into the same problem from https://github.com/stripe/stripe-react-native/issues/355 where a Chrome custom tab (web browser) is launched from your app's Stripe flow, like to perform 3DSecure confirmation, and if the app is backgrounded, that web browser gets killed.
4+
5+
## The solution
6+
7+
If your Android `launchMode` is set to `singleTask` (check your `AndroidManifest.xml`), that's why this is occurring. Unfortunately, this is not addressable by the Stripe React Native library.
8+
9+
Luckily, [@stianjensen shared a fix in the above Github issue](https://github.com/stripe/stripe-react-native/issues/355#issuecomment-1701323254). It is summarized here:
10+
11+
1. Modify your `MainApplication`:
12+
13+
```diff
14+
public class MainApplication extends Application {
15+
+ private ArrayList<Class> runningActivities = new ArrayList<>();
16+
17+
+ public void addActivityToStack (Class cls) {
18+
+ if (!runningActivities.contains(cls)) runningActivities.add(cls);
19+
+ }
20+
21+
+ public void removeActivityFromStack (Class cls) {
22+
+ if (runningActivities.contains(cls)) runningActivities.remove(cls);
23+
+ }
24+
25+
+ public boolean isActivityInBackStack (Class cls) {
26+
+ return runningActivities.contains(cls);
27+
+ }
28+
}
29+
```
30+
31+
2. create `LaunchActivity`
32+
33+
```diff
34+
+ public class LaunchActivity extends Activity {
35+
+ @Override
36+
+ protected void onCreate(Bundle savedInstanceState) {
37+
+ super.onCreate(savedInstanceState);
38+
+ BaseApplication application = (BaseApplication) getApplication();
39+
+ // check that MainActivity is not started yet
40+
+ if (!application.isActivityInBackStack(MainActivity.class)) {
41+
+ Intent intent = new Intent(this, MainActivity.class);
42+
+ startActivity(intent);
43+
+ }
44+
+ finish();
45+
+ }
46+
+ }
47+
```
48+
49+
3. Modify `AndroidManifest.xml` and move `android.intent.action.MAIN` and `android.intent.category.LAUNCHER` from your `.MainActivity` to `.LaunchActivity`
50+
51+
```diff
52+
+ <activity android:name=".LaunchActivity">
53+
+ <intent-filter>
54+
+ <action android:name="android.intent.action.MAIN" />
55+
+ <category android:name="android.intent.category.LAUNCHER" />
56+
+ </intent-filter>
57+
+ </activity>
58+
59+
...
60+
- <intent-filter>
61+
- <action android:name="android.intent.action.MAIN"/>
62+
- <category android:name="android.intent.category.LAUNCHER"/>
63+
- </intent-filter>
64+
...
65+
```
66+
67+
4. Modify `MainActivity` to look _something_ like the following (you likely already have an `onCreate` method that you need to modify):
68+
69+
```
70+
@Override
71+
protected void onCreate(Bundle savedInstanceState) {
72+
super.onCreate(null);
73+
((BaseApplication) getApplication()).addActivityToStack(this.getClass());
74+
}
75+
76+
@Override
77+
protected void onDestroy() {
78+
super.onDestroy();
79+
((BaseApplication) getApplication()).removeActivityFromStack(this.getClass());
80+
}
81+
```

api-reference/.nojekyll

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
TypeDoc added this file to prevent GitHub Pages from using Jekyll. You can turn off this behavior by setting the `githubPages` option to false.

api-reference/assets/hierarchy.js

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

api-reference/assets/highlight.css

Lines changed: 127 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,127 @@
1+
:root {
2+
--light-hl-0: #000000;
3+
--dark-hl-0: #D4D4D4;
4+
--light-hl-1: #001080;
5+
--dark-hl-1: #9CDCFE;
6+
--light-hl-2: #A31515;
7+
--dark-hl-2: #CE9178;
8+
--light-hl-3: #000000;
9+
--dark-hl-3: #C8C8C8;
10+
--light-hl-4: #008000;
11+
--dark-hl-4: #6A9955;
12+
--light-hl-5: #795E26;
13+
--dark-hl-5: #DCDCAA;
14+
--light-hl-6: #0000FF;
15+
--dark-hl-6: #569CD6;
16+
--light-hl-7: #098658;
17+
--dark-hl-7: #B5CEA8;
18+
--light-hl-8: #800000;
19+
--dark-hl-8: #808080;
20+
--light-hl-9: #267F99;
21+
--dark-hl-9: #4EC9B0;
22+
--light-hl-10: #E50000;
23+
--dark-hl-10: #9CDCFE;
24+
--light-hl-11: #000000FF;
25+
--dark-hl-11: #D4D4D4;
26+
--light-hl-12: #0070C1;
27+
--dark-hl-12: #4FC1FF;
28+
--light-hl-13: #AF00DB;
29+
--dark-hl-13: #C586C0;
30+
--light-hl-14: #CD3131;
31+
--dark-hl-14: #F44747;
32+
--light-code-background: #FFFFFF;
33+
--dark-code-background: #1E1E1E;
34+
}
35+
36+
@media (prefers-color-scheme: light) { :root {
37+
--hl-0: var(--light-hl-0);
38+
--hl-1: var(--light-hl-1);
39+
--hl-2: var(--light-hl-2);
40+
--hl-3: var(--light-hl-3);
41+
--hl-4: var(--light-hl-4);
42+
--hl-5: var(--light-hl-5);
43+
--hl-6: var(--light-hl-6);
44+
--hl-7: var(--light-hl-7);
45+
--hl-8: var(--light-hl-8);
46+
--hl-9: var(--light-hl-9);
47+
--hl-10: var(--light-hl-10);
48+
--hl-11: var(--light-hl-11);
49+
--hl-12: var(--light-hl-12);
50+
--hl-13: var(--light-hl-13);
51+
--hl-14: var(--light-hl-14);
52+
--code-background: var(--light-code-background);
53+
} }
54+
55+
@media (prefers-color-scheme: dark) { :root {
56+
--hl-0: var(--dark-hl-0);
57+
--hl-1: var(--dark-hl-1);
58+
--hl-2: var(--dark-hl-2);
59+
--hl-3: var(--dark-hl-3);
60+
--hl-4: var(--dark-hl-4);
61+
--hl-5: var(--dark-hl-5);
62+
--hl-6: var(--dark-hl-6);
63+
--hl-7: var(--dark-hl-7);
64+
--hl-8: var(--dark-hl-8);
65+
--hl-9: var(--dark-hl-9);
66+
--hl-10: var(--dark-hl-10);
67+
--hl-11: var(--dark-hl-11);
68+
--hl-12: var(--dark-hl-12);
69+
--hl-13: var(--dark-hl-13);
70+
--hl-14: var(--dark-hl-14);
71+
--code-background: var(--dark-code-background);
72+
} }
73+
74+
:root[data-theme='light'] {
75+
--hl-0: var(--light-hl-0);
76+
--hl-1: var(--light-hl-1);
77+
--hl-2: var(--light-hl-2);
78+
--hl-3: var(--light-hl-3);
79+
--hl-4: var(--light-hl-4);
80+
--hl-5: var(--light-hl-5);
81+
--hl-6: var(--light-hl-6);
82+
--hl-7: var(--light-hl-7);
83+
--hl-8: var(--light-hl-8);
84+
--hl-9: var(--light-hl-9);
85+
--hl-10: var(--light-hl-10);
86+
--hl-11: var(--light-hl-11);
87+
--hl-12: var(--light-hl-12);
88+
--hl-13: var(--light-hl-13);
89+
--hl-14: var(--light-hl-14);
90+
--code-background: var(--light-code-background);
91+
}
92+
93+
:root[data-theme='dark'] {
94+
--hl-0: var(--dark-hl-0);
95+
--hl-1: var(--dark-hl-1);
96+
--hl-2: var(--dark-hl-2);
97+
--hl-3: var(--dark-hl-3);
98+
--hl-4: var(--dark-hl-4);
99+
--hl-5: var(--dark-hl-5);
100+
--hl-6: var(--dark-hl-6);
101+
--hl-7: var(--dark-hl-7);
102+
--hl-8: var(--dark-hl-8);
103+
--hl-9: var(--dark-hl-9);
104+
--hl-10: var(--dark-hl-10);
105+
--hl-11: var(--dark-hl-11);
106+
--hl-12: var(--dark-hl-12);
107+
--hl-13: var(--dark-hl-13);
108+
--hl-14: var(--dark-hl-14);
109+
--code-background: var(--dark-code-background);
110+
}
111+
112+
.hl-0 { color: var(--hl-0); }
113+
.hl-1 { color: var(--hl-1); }
114+
.hl-2 { color: var(--hl-2); }
115+
.hl-3 { color: var(--hl-3); }
116+
.hl-4 { color: var(--hl-4); }
117+
.hl-5 { color: var(--hl-5); }
118+
.hl-6 { color: var(--hl-6); }
119+
.hl-7 { color: var(--hl-7); }
120+
.hl-8 { color: var(--hl-8); }
121+
.hl-9 { color: var(--hl-9); }
122+
.hl-10 { color: var(--hl-10); }
123+
.hl-11 { color: var(--hl-11); }
124+
.hl-12 { color: var(--hl-12); }
125+
.hl-13 { color: var(--hl-13); }
126+
.hl-14 { color: var(--hl-14); }
127+
pre, code { background: var(--code-background); }

0 commit comments

Comments
 (0)