@coinbase/create-cdp-app 0.0.38 → 0.0.41

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (89) hide show
  1. package/dist/index.js +99 -38
  2. package/dist/index.js.map +1 -1
  3. package/package.json +1 -1
  4. package/template-nextjs/README.md +1 -1
  5. package/template-nextjs/src/app/api/onramp/buy-options/route.ts +0 -2
  6. package/template-nextjs/src/components/EOATransaction.tsx +7 -7
  7. package/template-nextjs/src/components/FundWallet.tsx +17 -3
  8. package/template-nextjs/src/components/SignedInScreen.tsx +2 -2
  9. package/template-nextjs/src/components/SignedInScreenWithOnramp.tsx +149 -41
  10. package/template-nextjs/src/components/SolanaTransaction.tsx +106 -96
  11. package/template-nextjs/src/lib/onramp-api.ts +6 -2
  12. package/template-react/src/EOATransaction.tsx +7 -7
  13. package/template-react/src/SignedInScreen.tsx +2 -3
  14. package/template-react/src/SolanaTransaction.tsx +105 -96
  15. package/template-react-native/App.tsx +28 -6
  16. package/template-react-native/SolanaTransaction.tsx +368 -0
  17. package/template-react-native/Transaction.tsx +101 -1
  18. package/template-react-native/_gitignore +4 -0
  19. package/template-react-native/components/WalletHeader.tsx +37 -13
  20. package/template-react-native/env.example +1 -0
  21. package/template-react-native/index.ts +7 -0
  22. package/template-react-native/metro.config.js +19 -0
  23. package/template-react-native/package.json +3 -0
  24. package/template-react-native/android/_gitignore +0 -16
  25. package/template-react-native/android/app/build.gradle +0 -177
  26. package/template-react-native/android/app/debug.keystore +0 -0
  27. package/template-react-native/android/app/proguard-rules.pro +0 -14
  28. package/template-react-native/android/app/src/debug/AndroidManifest.xml +0 -7
  29. package/template-react-native/android/app/src/main/AndroidManifest.xml +0 -25
  30. package/template-react-native/android/app/src/main/java/com/anonymous/reactnativeexpo/MainActivity.kt +0 -61
  31. package/template-react-native/android/app/src/main/java/com/anonymous/reactnativeexpo/MainApplication.kt +0 -57
  32. package/template-react-native/android/app/src/main/res/drawable/ic_launcher_background.xml +0 -6
  33. package/template-react-native/android/app/src/main/res/drawable/rn_edit_text_material.xml +0 -37
  34. package/template-react-native/android/app/src/main/res/drawable-hdpi/splashscreen_logo.png +0 -0
  35. package/template-react-native/android/app/src/main/res/drawable-mdpi/splashscreen_logo.png +0 -0
  36. package/template-react-native/android/app/src/main/res/drawable-xhdpi/splashscreen_logo.png +0 -0
  37. package/template-react-native/android/app/src/main/res/drawable-xxhdpi/splashscreen_logo.png +0 -0
  38. package/template-react-native/android/app/src/main/res/drawable-xxxhdpi/splashscreen_logo.png +0 -0
  39. package/template-react-native/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml +0 -5
  40. package/template-react-native/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml +0 -5
  41. package/template-react-native/android/app/src/main/res/mipmap-hdpi/ic_launcher.webp +0 -0
  42. package/template-react-native/android/app/src/main/res/mipmap-hdpi/ic_launcher_foreground.webp +0 -0
  43. package/template-react-native/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.webp +0 -0
  44. package/template-react-native/android/app/src/main/res/mipmap-mdpi/ic_launcher.webp +0 -0
  45. package/template-react-native/android/app/src/main/res/mipmap-mdpi/ic_launcher_foreground.webp +0 -0
  46. package/template-react-native/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.webp +0 -0
  47. package/template-react-native/android/app/src/main/res/mipmap-xhdpi/ic_launcher.webp +0 -0
  48. package/template-react-native/android/app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.webp +0 -0
  49. package/template-react-native/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp +0 -0
  50. package/template-react-native/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.webp +0 -0
  51. package/template-react-native/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.webp +0 -0
  52. package/template-react-native/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp +0 -0
  53. package/template-react-native/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp +0 -0
  54. package/template-react-native/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.webp +0 -0
  55. package/template-react-native/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp +0 -0
  56. package/template-react-native/android/app/src/main/res/values/colors.xml +0 -6
  57. package/template-react-native/android/app/src/main/res/values/strings.xml +0 -5
  58. package/template-react-native/android/app/src/main/res/values/styles.xml +0 -10
  59. package/template-react-native/android/app/src/main/res/values-night/colors.xml +0 -1
  60. package/template-react-native/android/build.gradle +0 -37
  61. package/template-react-native/android/gradle/wrapper/gradle-wrapper.jar +0 -0
  62. package/template-react-native/android/gradle/wrapper/gradle-wrapper.properties +0 -7
  63. package/template-react-native/android/gradle.properties +0 -59
  64. package/template-react-native/android/gradlew +0 -251
  65. package/template-react-native/android/gradlew.bat +0 -94
  66. package/template-react-native/android/settings.gradle +0 -39
  67. package/template-react-native/ios/.xcode.env +0 -11
  68. package/template-react-native/ios/Podfile +0 -64
  69. package/template-react-native/ios/Podfile.lock +0 -2131
  70. package/template-react-native/ios/Podfile.properties.json +0 -5
  71. package/template-react-native/ios/_gitignore +0 -30
  72. package/template-react-native/ios/reactnativeexpo/AppDelegate.swift +0 -70
  73. package/template-react-native/ios/reactnativeexpo/Images.xcassets/AppIcon.appiconset/App-Icon-1024x1024@1x.png +0 -0
  74. package/template-react-native/ios/reactnativeexpo/Images.xcassets/AppIcon.appiconset/Contents.json +0 -14
  75. package/template-react-native/ios/reactnativeexpo/Images.xcassets/Contents.json +0 -6
  76. package/template-react-native/ios/reactnativeexpo/Images.xcassets/SplashScreenBackground.colorset/Contents.json +0 -20
  77. package/template-react-native/ios/reactnativeexpo/Images.xcassets/SplashScreenLogo.imageset/Contents.json +0 -23
  78. package/template-react-native/ios/reactnativeexpo/Images.xcassets/SplashScreenLogo.imageset/image.png +0 -0
  79. package/template-react-native/ios/reactnativeexpo/Images.xcassets/SplashScreenLogo.imageset/image@2x.png +0 -0
  80. package/template-react-native/ios/reactnativeexpo/Images.xcassets/SplashScreenLogo.imageset/image@3x.png +0 -0
  81. package/template-react-native/ios/reactnativeexpo/Info.plist +0 -74
  82. package/template-react-native/ios/reactnativeexpo/PrivacyInfo.xcprivacy +0 -48
  83. package/template-react-native/ios/reactnativeexpo/SplashScreen.storyboard +0 -44
  84. package/template-react-native/ios/reactnativeexpo/Supporting/Expo.plist +0 -12
  85. package/template-react-native/ios/reactnativeexpo/reactnativeexpo-Bridging-Header.h +0 -3
  86. package/template-react-native/ios/reactnativeexpo/reactnativeexpo.entitlements +0 -5
  87. package/template-react-native/ios/reactnativeexpo.xcodeproj/project.pbxproj +0 -545
  88. package/template-react-native/ios/reactnativeexpo.xcodeproj/xcshareddata/xcschemes/reactnativeexpo.xcscheme +0 -88
  89. package/template-react-native/ios/reactnativeexpo.xcworkspace/contents.xcworkspacedata +0 -10
@@ -1 +1,101 @@
1
- export { default } from "./EOATransaction";
1
+ import React, { useState } from "react";
2
+ import { View, Text, TouchableOpacity, StyleSheet } from "react-native";
3
+ import { useEvmAddress, useSolanaAddress } from "@coinbase/cdp-hooks";
4
+ import { useTheme } from "./theme/ThemeContext";
5
+ import EOATransaction from "./EOATransaction";
6
+ import SolanaTransaction from "./SolanaTransaction";
7
+
8
+ interface Props {
9
+ onSuccess?: () => void;
10
+ }
11
+
12
+ function Transaction(props: Props) {
13
+ const { onSuccess } = props;
14
+ const { colors } = useTheme();
15
+ const { evmAddress } = useEvmAddress();
16
+ const { solanaAddress } = useSolanaAddress();
17
+ const [activeTab, setActiveTab] = useState<"evm" | "solana">("evm");
18
+
19
+ // Show tabs only if both EVM and Solana addresses are available
20
+ const showTabs = !!evmAddress && !!solanaAddress;
21
+
22
+ const createStyles = () =>
23
+ StyleSheet.create({
24
+ container: {
25
+ flex: 1,
26
+ width: "100%",
27
+ },
28
+ tabContainer: {
29
+ flexDirection: "row",
30
+ marginBottom: 16,
31
+ backgroundColor: colors.cardBackground,
32
+ borderRadius: 8,
33
+ padding: 4,
34
+ borderWidth: 1,
35
+ borderColor: colors.border,
36
+ },
37
+ tab: {
38
+ flex: 1,
39
+ paddingVertical: 12,
40
+ alignItems: "center",
41
+ borderRadius: 6,
42
+ },
43
+ activeTab: {
44
+ backgroundColor: colors.accent,
45
+ },
46
+ tabText: {
47
+ fontSize: 16,
48
+ fontWeight: "600",
49
+ color: colors.textSecondary,
50
+ },
51
+ activeTabText: {
52
+ color: "#ffffff",
53
+ },
54
+ });
55
+
56
+ const styles = createStyles();
57
+
58
+ // If only one address type is available, show that component directly
59
+ if (!showTabs) {
60
+ if (evmAddress) {
61
+ return <EOATransaction onSuccess={onSuccess} />;
62
+ }
63
+ if (solanaAddress) {
64
+ return <SolanaTransaction onSuccess={onSuccess} />;
65
+ }
66
+ return null; // Loading state handled by parent
67
+ }
68
+
69
+ return (
70
+ <View style={styles.container}>
71
+ {/* Tab selector */}
72
+ <View style={styles.tabContainer}>
73
+ <TouchableOpacity
74
+ style={[styles.tab, activeTab === "evm" && styles.activeTab]}
75
+ onPress={() => setActiveTab("evm")}
76
+ >
77
+ <Text style={[styles.tabText, activeTab === "evm" && styles.activeTabText]}>
78
+ Ethereum
79
+ </Text>
80
+ </TouchableOpacity>
81
+ <TouchableOpacity
82
+ style={[styles.tab, activeTab === "solana" && styles.activeTab]}
83
+ onPress={() => setActiveTab("solana")}
84
+ >
85
+ <Text style={[styles.tabText, activeTab === "solana" && styles.activeTabText]}>
86
+ Solana
87
+ </Text>
88
+ </TouchableOpacity>
89
+ </View>
90
+
91
+ {/* Content */}
92
+ {activeTab === "evm" ? (
93
+ <EOATransaction onSuccess={onSuccess} />
94
+ ) : (
95
+ <SolanaTransaction onSuccess={onSuccess} />
96
+ )}
97
+ </View>
98
+ );
99
+ }
100
+
101
+ export default Transaction;
@@ -35,3 +35,7 @@ yarn-error.*
35
35
 
36
36
  # typescript
37
37
  *.tsbuildinfo
38
+
39
+ # prebuild
40
+ ios/
41
+ android/
@@ -1,7 +1,7 @@
1
1
  import React from "react";
2
2
  import { View, Text, TouchableOpacity, StyleSheet, Alert } from "react-native";
3
3
  import * as Clipboard from "expo-clipboard";
4
- import { useEvmAddress, useCurrentUser } from "@coinbase/cdp-hooks";
4
+ import { useEvmAddress, useCurrentUser, useSolanaAddress } from "@coinbase/cdp-hooks";
5
5
  import { useTheme } from "../theme/ThemeContext";
6
6
  import { UserIcon } from "./UserIcon";
7
7
 
@@ -12,24 +12,26 @@ interface WalletHeaderProps {
12
12
  export const WalletHeader: React.FC<WalletHeaderProps> = ({ onSignOut }) => {
13
13
  const { colors } = useTheme();
14
14
  const { evmAddress } = useEvmAddress();
15
+ const { solanaAddress } = useSolanaAddress();
15
16
  const { currentUser } = useCurrentUser();
16
17
 
17
18
  // Use EVM address if available, otherwise fall back to smart account
18
- const walletAddress = evmAddress || currentUser?.evmSmartAccounts?.[0];
19
+ const evmWalletAddress = evmAddress || currentUser?.evmSmartAccounts?.[0];
20
+ const solanaWalletAddress = solanaAddress;
19
21
 
20
22
  const formatAddress = (address: string) => {
21
23
  if (!address) return "";
22
24
  return `${address.slice(0, 6)}...${address.slice(-4)}`;
23
25
  };
24
26
 
25
- const copyWalletAddress = async () => {
26
- if (!walletAddress) return;
27
+ const copyWalletAddress = async (address: string, type: "EVM" | "Solana") => {
28
+ if (!address) return;
27
29
 
28
30
  try {
29
- await Clipboard.setStringAsync(walletAddress);
30
- Alert.alert("Copied!", "Wallet address copied to clipboard.");
31
+ await Clipboard.setStringAsync(address);
32
+ Alert.alert("Copied!", `${type} address copied to clipboard.`);
31
33
  } catch (error) {
32
- Alert.alert("Error", "Failed to copy wallet address.");
34
+ Alert.alert("Error", `Failed to copy ${type} address.`);
33
35
  }
34
36
  };
35
37
 
@@ -63,9 +65,15 @@ export const WalletHeader: React.FC<WalletHeaderProps> = ({ onSignOut }) => {
63
65
  flex: 1,
64
66
  },
65
67
  address: {
66
- fontSize: 16,
68
+ fontSize: 14,
67
69
  fontWeight: "500",
68
70
  color: colors.text,
71
+ marginBottom: 2,
72
+ },
73
+ addressLabel: {
74
+ fontSize: 12,
75
+ color: colors.textSecondary,
76
+ marginBottom: 1,
69
77
  },
70
78
  signOutButton: {
71
79
  backgroundColor: colors.accent,
@@ -84,16 +92,32 @@ export const WalletHeader: React.FC<WalletHeaderProps> = ({ onSignOut }) => {
84
92
 
85
93
  return (
86
94
  <View style={styles.container}>
87
- <TouchableOpacity style={styles.leftContent} onPress={copyWalletAddress}>
95
+ <View style={styles.leftContent}>
88
96
  <View style={styles.avatar}>
89
97
  <UserIcon size={18} color={colors.cardBackground} />
90
98
  </View>
91
99
  <View style={styles.addressContainer}>
92
- <Text style={styles.address}>
93
- {walletAddress ? formatAddress(walletAddress) : "Loading..."}
94
- </Text>
100
+ {evmWalletAddress && (
101
+ <>
102
+ <Text style={styles.addressLabel}>EVM</Text>
103
+ <TouchableOpacity onPress={() => copyWalletAddress(evmWalletAddress, "EVM")}>
104
+ <Text style={styles.address}>{formatAddress(evmWalletAddress)}</Text>
105
+ </TouchableOpacity>
106
+ </>
107
+ )}
108
+ {solanaWalletAddress && (
109
+ <>
110
+ <Text style={styles.addressLabel}>Solana</Text>
111
+ <TouchableOpacity onPress={() => copyWalletAddress(solanaWalletAddress, "Solana")}>
112
+ <Text style={styles.address}>{formatAddress(solanaWalletAddress)}</Text>
113
+ </TouchableOpacity>
114
+ </>
115
+ )}
116
+ {!evmWalletAddress && !solanaWalletAddress && (
117
+ <Text style={styles.address}>Loading...</Text>
118
+ )}
95
119
  </View>
96
- </TouchableOpacity>
120
+ </View>
97
121
  <TouchableOpacity style={styles.signOutButton} onPress={onSignOut}>
98
122
  <Text style={styles.signOutButtonText}>Sign out</Text>
99
123
  </TouchableOpacity>
@@ -1,5 +1,6 @@
1
1
  # CDP Configuration for the main app
2
2
  EXPO_PUBLIC_CDP_PROJECT_ID=your-project-id-here
3
3
  EXPO_PUBLIC_CDP_CREATE_ETHEREUM_ACCOUNT_TYPE=smart
4
+ EXPO_PUBLIC_CDP_CREATE_SOLANA_ACCOUNT=false
4
5
  EXPO_PUBLIC_CDP_BASE_PATH=https://api.cdp.coinbase.com/platform
5
6
  EXPO_PUBLIC_USE_MOCK=false
@@ -2,12 +2,19 @@ import structuredClone from "@ungap/structured-clone";
2
2
  import { registerRootComponent } from "expo";
3
3
  import { install } from "react-native-quick-crypto";
4
4
  import "react-native-get-random-values";
5
+ import { Buffer } from "buffer";
5
6
 
6
7
  if (!("structuredClone" in globalThis)) {
7
8
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
8
9
  globalThis.structuredClone = structuredClone as any;
9
10
  }
10
11
 
12
+ // Setup Buffer global for Solana Web3.js compatibility
13
+ if (!("Buffer" in globalThis)) {
14
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
15
+ globalThis.Buffer = Buffer as any;
16
+ }
17
+
11
18
  install();
12
19
 
13
20
  import App from "./App";
@@ -0,0 +1,19 @@
1
+ const { getDefaultConfig } = require("expo/metro-config");
2
+
3
+ const config = getDefaultConfig(__dirname);
4
+
5
+ config.resolver.resolveRequest = (context, moduleName, platform) => {
6
+ if (moduleName.includes("zustand")) {
7
+ const result = require.resolve(moduleName);
8
+ return context.resolveRequest(context, result, platform);
9
+ }
10
+
11
+ if (moduleName.includes("rpc-websockets")) {
12
+ const result = require.resolve(moduleName);
13
+ return context.resolveRequest(context, result, platform);
14
+ }
15
+
16
+ return context.resolveRequest(context, moduleName, platform);
17
+ };
18
+
19
+ module.exports = config;
@@ -13,7 +13,9 @@
13
13
  "dependencies": {
14
14
  "@coinbase/cdp-hooks": "latest",
15
15
  "@react-native-async-storage/async-storage": "^2.2.0",
16
+ "@solana/web3.js": "^1.98.4",
16
17
  "@ungap/structured-clone": "^1.3.0",
18
+ "buffer": "^6.0.3",
17
19
  "expo": "~53.0.22",
18
20
  "expo-asset": "~11.1.7",
19
21
  "expo-clipboard": "~7.1.5",
@@ -24,6 +26,7 @@
24
26
  "react-native": "0.79.6",
25
27
  "react-native-get-random-values": "^1.11.0",
26
28
  "react-native-quick-crypto": "^0.7.17",
29
+ "readable-stream": "^4.6.0",
27
30
  "viem": "^2.21.45"
28
31
  },
29
32
  "devDependencies": {
@@ -1,16 +0,0 @@
1
- # OSX
2
- #
3
- .DS_Store
4
-
5
- # Android/IntelliJ
6
- #
7
- build/
8
- .idea
9
- .gradle
10
- local.properties
11
- *.iml
12
- *.hprof
13
- .cxx/
14
-
15
- # Bundle artifacts
16
- *.jsbundle
@@ -1,177 +0,0 @@
1
- apply plugin: "com.android.application"
2
- apply plugin: "org.jetbrains.kotlin.android"
3
- apply plugin: "com.facebook.react"
4
-
5
- def projectRoot = rootDir.getAbsoluteFile().getParentFile().getAbsolutePath()
6
-
7
- /**
8
- * This is the configuration block to customize your React Native Android app.
9
- * By default you don't need to apply any configuration, just uncomment the lines you need.
10
- */
11
- react {
12
- entryFile = file(["node", "-e", "require('expo/scripts/resolveAppEntry')", projectRoot, "android", "absolute"].execute(null, rootDir).text.trim())
13
- reactNativeDir = new File(["node", "--print", "require.resolve('react-native/package.json')"].execute(null, rootDir).text.trim()).getParentFile().getAbsoluteFile()
14
- hermesCommand = new File(["node", "--print", "require.resolve('react-native/package.json')"].execute(null, rootDir).text.trim()).getParentFile().getAbsolutePath() + "/sdks/hermesc/%OS-BIN%/hermesc"
15
- codegenDir = new File(["node", "--print", "require.resolve('@react-native/codegen/package.json', { paths: [require.resolve('react-native/package.json')] })"].execute(null, rootDir).text.trim()).getParentFile().getAbsoluteFile()
16
-
17
- enableBundleCompression = (findProperty('android.enableBundleCompression') ?: false).toBoolean()
18
- // Use Expo CLI to bundle the app, this ensures the Metro config
19
- // works correctly with Expo projects.
20
- cliFile = new File(["node", "--print", "require.resolve('@expo/cli', { paths: [require.resolve('expo/package.json')] })"].execute(null, rootDir).text.trim())
21
- bundleCommand = "export:embed"
22
-
23
- /* Folders */
24
- // The root of your project, i.e. where "package.json" lives. Default is '../..'
25
- // root = file("../../")
26
- // The folder where the react-native NPM package is. Default is ../../node_modules/react-native
27
- // reactNativeDir = file("../../node_modules/react-native")
28
- // The folder where the react-native Codegen package is. Default is ../../node_modules/@react-native/codegen
29
- // codegenDir = file("../../node_modules/@react-native/codegen")
30
-
31
- /* Variants */
32
- // The list of variants to that are debuggable. For those we're going to
33
- // skip the bundling of the JS bundle and the assets. By default is just 'debug'.
34
- // If you add flavors like lite, prod, etc. you'll have to list your debuggableVariants.
35
- // debuggableVariants = ["liteDebug", "prodDebug"]
36
-
37
- /* Bundling */
38
- // A list containing the node command and its flags. Default is just 'node'.
39
- // nodeExecutableAndArgs = ["node"]
40
-
41
- //
42
- // The path to the CLI configuration file. Default is empty.
43
- // bundleConfig = file(../rn-cli.config.js)
44
- //
45
- // The name of the generated asset file containing your JS bundle
46
- // bundleAssetName = "MyApplication.android.bundle"
47
- //
48
- // The entry file for bundle generation. Default is 'index.android.js' or 'index.js'
49
- // entryFile = file("../js/MyApplication.android.js")
50
- //
51
- // A list of extra flags to pass to the 'bundle' commands.
52
- // See https://github.com/react-native-community/cli/blob/main/docs/commands.md#bundle
53
- // extraPackagerArgs = []
54
-
55
- /* Hermes Commands */
56
- // The hermes compiler command to run. By default it is 'hermesc'
57
- // hermesCommand = "$rootDir/my-custom-hermesc/bin/hermesc"
58
- //
59
- // The list of flags to pass to the Hermes compiler. By default is "-O", "-output-source-map"
60
- // hermesFlags = ["-O", "-output-source-map"]
61
-
62
- /* Autolinking */
63
- autolinkLibrariesWithApp()
64
- }
65
-
66
- /**
67
- * Set this to true to Run Proguard on Release builds to minify the Java bytecode.
68
- */
69
- def enableProguardInReleaseBuilds = (findProperty('android.enableProguardInReleaseBuilds') ?: false).toBoolean()
70
-
71
- /**
72
- * The preferred build flavor of JavaScriptCore (JSC)
73
- *
74
- * For example, to use the international variant, you can use:
75
- * `def jscFlavor = 'org.webkit:android-jsc-intl:+'`
76
- *
77
- * The international variant includes ICU i18n library and necessary data
78
- * allowing to use e.g. `Date.toLocaleString` and `String.localeCompare` that
79
- * give correct results when using with locales other than en-US. Note that
80
- * this variant is about 6MiB larger per architecture than default.
81
- */
82
- def jscFlavor = 'io.github.react-native-community:jsc-android:2026004.+'
83
-
84
- android {
85
- ndkVersion rootProject.ext.ndkVersion
86
-
87
- buildToolsVersion rootProject.ext.buildToolsVersion
88
- compileSdk rootProject.ext.compileSdkVersion
89
-
90
- namespace 'com.anonymous.reactnativeexpo'
91
- defaultConfig {
92
- applicationId 'com.anonymous.reactnativeexpo'
93
- minSdkVersion rootProject.ext.minSdkVersion
94
- targetSdkVersion rootProject.ext.targetSdkVersion
95
- versionCode 1
96
- versionName "1.0.0"
97
- }
98
- signingConfigs {
99
- debug {
100
- storeFile file('debug.keystore')
101
- storePassword 'android'
102
- keyAlias 'androiddebugkey'
103
- keyPassword 'android'
104
- }
105
- }
106
- buildTypes {
107
- debug {
108
- signingConfig signingConfigs.debug
109
- }
110
- release {
111
- // Caution! In production, you need to generate your own keystore file.
112
- // see https://reactnative.dev/docs/signed-apk-android.
113
- signingConfig signingConfigs.debug
114
- shrinkResources (findProperty('android.enableShrinkResourcesInReleaseBuilds')?.toBoolean() ?: false)
115
- minifyEnabled enableProguardInReleaseBuilds
116
- proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
117
- crunchPngs (findProperty('android.enablePngCrunchInReleaseBuilds')?.toBoolean() ?: true)
118
- }
119
- }
120
- packagingOptions {
121
- jniLibs {
122
- useLegacyPackaging (findProperty('expo.useLegacyPackaging')?.toBoolean() ?: false)
123
- }
124
- }
125
- androidResources {
126
- ignoreAssetsPattern '!.svn:!.git:!.ds_store:!*.scc:!CVS:!thumbs.db:!picasa.ini:!*~'
127
- }
128
- }
129
-
130
- // Apply static values from `gradle.properties` to the `android.packagingOptions`
131
- // Accepts values in comma delimited lists, example:
132
- // android.packagingOptions.pickFirsts=/LICENSE,**/picasa.ini
133
- ["pickFirsts", "excludes", "merges", "doNotStrip"].each { prop ->
134
- // Split option: 'foo,bar' -> ['foo', 'bar']
135
- def options = (findProperty("android.packagingOptions.$prop") ?: "").split(",");
136
- // Trim all elements in place.
137
- for (i in 0..<options.size()) options[i] = options[i].trim();
138
- // `[] - ""` is essentially `[""].filter(Boolean)` removing all empty strings.
139
- options -= ""
140
-
141
- if (options.length > 0) {
142
- println "android.packagingOptions.$prop += $options ($options.length)"
143
- // Ex: android.packagingOptions.pickFirsts += '**/SCCS/**'
144
- options.each {
145
- android.packagingOptions[prop] += it
146
- }
147
- }
148
- }
149
-
150
- dependencies {
151
- // The version of react-native is set by the React Native Gradle Plugin
152
- implementation("com.facebook.react:react-android")
153
-
154
- def isGifEnabled = (findProperty('expo.gif.enabled') ?: "") == "true";
155
- def isWebpEnabled = (findProperty('expo.webp.enabled') ?: "") == "true";
156
- def isWebpAnimatedEnabled = (findProperty('expo.webp.animated') ?: "") == "true";
157
-
158
- if (isGifEnabled) {
159
- // For animated gif support
160
- implementation("com.facebook.fresco:animated-gif:${expoLibs.versions.fresco.get()}")
161
- }
162
-
163
- if (isWebpEnabled) {
164
- // For webp support
165
- implementation("com.facebook.fresco:webpsupport:${expoLibs.versions.fresco.get()}")
166
- if (isWebpAnimatedEnabled) {
167
- // Animated webp support
168
- implementation("com.facebook.fresco:animated-webp:${expoLibs.versions.fresco.get()}")
169
- }
170
- }
171
-
172
- if (hermesEnabled.toBoolean()) {
173
- implementation("com.facebook.react:hermes-android")
174
- } else {
175
- implementation jscFlavor
176
- }
177
- }
@@ -1,14 +0,0 @@
1
- # Add project specific ProGuard rules here.
2
- # By default, the flags in this file are appended to flags specified
3
- # in /usr/local/Cellar/android-sdk/24.3.3/tools/proguard/proguard-android.txt
4
- # You can edit the include path and order by changing the proguardFiles
5
- # directive in build.gradle.
6
- #
7
- # For more details, see
8
- # http://developer.android.com/guide/developing/tools/proguard.html
9
-
10
- # react-native-reanimated
11
- -keep class com.swmansion.reanimated.** { *; }
12
- -keep class com.facebook.react.turbomodule.** { *; }
13
-
14
- # Add any project specific keep options here:
@@ -1,7 +0,0 @@
1
- <manifest xmlns:android="http://schemas.android.com/apk/res/android"
2
- xmlns:tools="http://schemas.android.com/tools">
3
-
4
- <uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>
5
-
6
- <application android:usesCleartextTraffic="true" tools:targetApi="28" tools:ignore="GoogleAppIndexingWarning" tools:replace="android:usesCleartextTraffic" />
7
- </manifest>
@@ -1,25 +0,0 @@
1
- <manifest xmlns:android="http://schemas.android.com/apk/res/android">
2
- <uses-permission android:name="android.permission.INTERNET"/>
3
- <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
4
- <uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>
5
- <uses-permission android:name="android.permission.VIBRATE"/>
6
- <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
7
- <queries>
8
- <intent>
9
- <action android:name="android.intent.action.VIEW"/>
10
- <category android:name="android.intent.category.BROWSABLE"/>
11
- <data android:scheme="https"/>
12
- </intent>
13
- </queries>
14
- <application android:name=".MainApplication" android:label="@string/app_name" android:icon="@mipmap/ic_launcher" android:roundIcon="@mipmap/ic_launcher_round" android:allowBackup="true" android:theme="@style/AppTheme" android:supportsRtl="true">
15
- <meta-data android:name="expo.modules.updates.ENABLED" android:value="false"/>
16
- <meta-data android:name="expo.modules.updates.EXPO_UPDATES_CHECK_ON_LAUNCH" android:value="ALWAYS"/>
17
- <meta-data android:name="expo.modules.updates.EXPO_UPDATES_LAUNCH_WAIT_MS" android:value="0"/>
18
- <activity android:name=".MainActivity" android:configChanges="keyboard|keyboardHidden|orientation|screenSize|screenLayout|uiMode" android:launchMode="singleTask" android:windowSoftInputMode="adjustResize" android:theme="@style/Theme.App.SplashScreen" android:exported="true" android:screenOrientation="portrait">
19
- <intent-filter>
20
- <action android:name="android.intent.action.MAIN"/>
21
- <category android:name="android.intent.category.LAUNCHER"/>
22
- </intent-filter>
23
- </activity>
24
- </application>
25
- </manifest>
@@ -1,61 +0,0 @@
1
- package com.anonymous.reactnativeexpo
2
-
3
- import android.os.Build
4
- import android.os.Bundle
5
-
6
- import com.facebook.react.ReactActivity
7
- import com.facebook.react.ReactActivityDelegate
8
- import com.facebook.react.defaults.DefaultNewArchitectureEntryPoint.fabricEnabled
9
- import com.facebook.react.defaults.DefaultReactActivityDelegate
10
-
11
- import expo.modules.ReactActivityDelegateWrapper
12
-
13
- class MainActivity : ReactActivity() {
14
- override fun onCreate(savedInstanceState: Bundle?) {
15
- // Set the theme to AppTheme BEFORE onCreate to support
16
- // coloring the background, status bar, and navigation bar.
17
- // This is required for expo-splash-screen.
18
- setTheme(R.style.AppTheme);
19
- super.onCreate(null)
20
- }
21
-
22
- /**
23
- * Returns the name of the main component registered from JavaScript. This is used to schedule
24
- * rendering of the component.
25
- */
26
- override fun getMainComponentName(): String = "main"
27
-
28
- /**
29
- * Returns the instance of the [ReactActivityDelegate]. We use [DefaultReactActivityDelegate]
30
- * which allows you to enable New Architecture with a single boolean flags [fabricEnabled]
31
- */
32
- override fun createReactActivityDelegate(): ReactActivityDelegate {
33
- return ReactActivityDelegateWrapper(
34
- this,
35
- BuildConfig.IS_NEW_ARCHITECTURE_ENABLED,
36
- object : DefaultReactActivityDelegate(
37
- this,
38
- mainComponentName,
39
- fabricEnabled
40
- ){})
41
- }
42
-
43
- /**
44
- * Align the back button behavior with Android S
45
- * where moving root activities to background instead of finishing activities.
46
- * @see <a href="https://developer.android.com/reference/android/app/Activity#onBackPressed()">onBackPressed</a>
47
- */
48
- override fun invokeDefaultOnBackPressed() {
49
- if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.R) {
50
- if (!moveTaskToBack(false)) {
51
- // For non-root activities, use the default implementation to finish them.
52
- super.invokeDefaultOnBackPressed()
53
- }
54
- return
55
- }
56
-
57
- // Use the default back button implementation on Android S
58
- // because it's doing more than [Activity.moveTaskToBack] in fact.
59
- super.invokeDefaultOnBackPressed()
60
- }
61
- }
@@ -1,57 +0,0 @@
1
- package com.anonymous.reactnativeexpo
2
-
3
- import android.app.Application
4
- import android.content.res.Configuration
5
-
6
- import com.facebook.react.PackageList
7
- import com.facebook.react.ReactApplication
8
- import com.facebook.react.ReactNativeHost
9
- import com.facebook.react.ReactPackage
10
- import com.facebook.react.ReactHost
11
- import com.facebook.react.defaults.DefaultNewArchitectureEntryPoint.load
12
- import com.facebook.react.defaults.DefaultReactNativeHost
13
- import com.facebook.react.soloader.OpenSourceMergedSoMapping
14
- import com.facebook.soloader.SoLoader
15
-
16
- import expo.modules.ApplicationLifecycleDispatcher
17
- import expo.modules.ReactNativeHostWrapper
18
-
19
- class MainApplication : Application(), ReactApplication {
20
-
21
- override val reactNativeHost: ReactNativeHost = ReactNativeHostWrapper(
22
- this,
23
- object : DefaultReactNativeHost(this) {
24
- override fun getPackages(): List<ReactPackage> {
25
- val packages = PackageList(this).packages
26
- // Packages that cannot be autolinked yet can be added manually here, for example:
27
- // packages.add(MyReactNativePackage())
28
- return packages
29
- }
30
-
31
- override fun getJSMainModuleName(): String = ".expo/.virtual-metro-entry"
32
-
33
- override fun getUseDeveloperSupport(): Boolean = BuildConfig.DEBUG
34
-
35
- override val isNewArchEnabled: Boolean = BuildConfig.IS_NEW_ARCHITECTURE_ENABLED
36
- override val isHermesEnabled: Boolean = BuildConfig.IS_HERMES_ENABLED
37
- }
38
- )
39
-
40
- override val reactHost: ReactHost
41
- get() = ReactNativeHostWrapper.createReactHost(applicationContext, reactNativeHost)
42
-
43
- override fun onCreate() {
44
- super.onCreate()
45
- SoLoader.init(this, OpenSourceMergedSoMapping)
46
- if (BuildConfig.IS_NEW_ARCHITECTURE_ENABLED) {
47
- // If you opted-in for the New Architecture, we load the native entry point for this app.
48
- load()
49
- }
50
- ApplicationLifecycleDispatcher.onApplicationCreate(this)
51
- }
52
-
53
- override fun onConfigurationChanged(newConfig: Configuration) {
54
- super.onConfigurationChanged(newConfig)
55
- ApplicationLifecycleDispatcher.onConfigurationChanged(this, newConfig)
56
- }
57
- }
@@ -1,6 +0,0 @@
1
- <layer-list xmlns:android="http://schemas.android.com/apk/res/android">
2
- <item android:drawable="@color/splashscreen_background"/>
3
- <item>
4
- <bitmap android:gravity="center" android:src="@drawable/splashscreen_logo"/>
5
- </item>
6
- </layer-list>