Skip to content

Commit 1d099ca

Browse files
committed
Update expo example
1 parent fe923b6 commit 1d099ca

File tree

84 files changed

+14017
-20946
lines changed

Some content is hidden

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

84 files changed

+14017
-20946
lines changed

demo/rn-bare-example/App.tsx

Lines changed: 10 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,8 @@ export default function App() {
4343
await web3auth.login({
4444
loginProvider: LOGIN_PROVIDER.EMAIL_PASSWORDLESS,
4545
redirectUrl: resolvedRedirectUrl,
46-
mfaLevel: 'default',
47-
curve: 'secp256k1',
4846
extraLoginOptions: {
4947
login_hint: email,
50-
connection: 'email',
5148
},
5249
});
5350
setConsole(`Logged in ${web3auth.privKey}`);
@@ -88,33 +85,21 @@ export default function App() {
8885
uiConsole('MFA enabled');
8986
};
9087

91-
const launchWallerSerices = async () => {
88+
const launchWalletSerices = async () => {
9289
if (!web3auth) {
9390
setConsole('Web3auth not initialized');
9491
return;
9592
}
9693

9794
setConsole('Launch Wallet Services');
98-
await web3auth.launchWalletServices(
99-
{
100-
loginProvider: LOGIN_PROVIDER.EMAIL_PASSWORDLESS,
101-
redirectUrl: resolvedRedirectUrl,
102-
mfaLevel: 'default',
103-
curve: 'secp256k1',
104-
extraLoginOptions: {
105-
login_hint: email,
106-
connection: 'email',
107-
},
108-
},
109-
{
110-
chainNamespace: ChainNamespace.EIP155,
111-
decimals: 18,
112-
chainId: '0x1',
113-
rpcTarget:
114-
'https://mainnet.infura.io/v3/daeee53504be4cd3a997d4f2718d33e0',
115-
ticker: 'ETH',
116-
},
117-
);
95+
await web3auth.launchWalletServices({
96+
chainNamespace: ChainNamespace.EIP155,
97+
decimals: 18,
98+
chainId: '0x1',
99+
rpcTarget:
100+
'https://mainnet.infura.io/v3/daeee53504be4cd3a997d4f2718d33e0',
101+
ticker: 'ETH',
102+
});
118103
};
119104

120105
useEffect(() => {
@@ -191,7 +176,7 @@ export default function App() {
191176
<Button title="Enable MFA" onPress={() => enableMFA()} />
192177
<Button
193178
title="launch Wallet Services"
194-
onPress={() => launchWallerSerices()}
179+
onPress={() => launchWalletSerices()}
195180
/>
196181
<Button title="Get Chain ID" onPress={() => getChainId()} />
197182
<Button title="Get Accounts" onPress={() => getAccounts()} />

demo/rn-bare-example/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { AppRegistry } from "react-native";
2-
import "./globals";
32
import "react-native-get-random-values";
3+
import "./globals";
44
import App from "./App";
55
import { name as appName } from "./app.json";
66
AppRegistry.registerComponent(appName, () => App);

demo/rn-expo-example/.gitignore

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,8 @@ web-build/
1313
# macOS
1414
.DS_Store
1515

16-
# Temporary files created by Metro to check the health of the file watcher
17-
.metro-health-check*
16+
# @generated expo-cli sync-2b81b286409207a5da26e14c78851eb30d8ccbdb
17+
# The following patterns were generated by expo-cli
18+
19+
expo-env.d.ts
20+
# @end expo-cli

demo/rn-expo-example/README.md

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
# Welcome to your Expo app 👋
2+
3+
This is an [Expo](https://expo.dev) project created with [`create-expo-app`](https://www.npmjs.com/package/create-expo-app).
4+
5+
## Get started
6+
7+
1. Install dependencies
8+
9+
```bash
10+
npm install
11+
```
12+
13+
2. Start the app
14+
15+
```bash
16+
npx expo start
17+
```
18+
19+
In the output, you'll find options to open the app in a
20+
21+
- [development build](https://docs.expo.dev/develop/development-builds/introduction/)
22+
- [Android emulator](https://docs.expo.dev/workflow/android-studio-emulator/)
23+
- [iOS simulator](https://docs.expo.dev/workflow/ios-simulator/)
24+
- [Expo Go](https://expo.dev/go), a limited sandbox for trying out app development with Expo
25+
26+
You can start developing by editing the files inside the **app** directory. This project uses [file-based routing](https://docs.expo.dev/router/introduction).
27+
28+
## Get a fresh project
29+
30+
When you're ready, run:
31+
32+
```bash
33+
npm run reset-project
34+
```
35+
36+
This command will move the starter code to the **app-example** directory and create a blank **app** directory where you can start developing.
37+
38+
## Learn more
39+
40+
To learn more about developing your project with Expo, look at the following resources:
41+
42+
- [Expo documentation](https://docs.expo.dev/): Learn fundamentals, or go into advanced topics with our [guides](https://docs.expo.dev/guides).
43+
- [Learn Expo tutorial](https://docs.expo.dev/tutorial/introduction/): Follow a step-by-step tutorial where you'll create a project that runs on Android, iOS, and the web.
44+
45+
## Join the community
46+
47+
Join our community of developers creating universal apps.
48+
49+
- [Expo on GitHub](https://github.com/expo/expo): View our open source platform and contribute.
50+
- [Discord community](https://chat.expo.dev): Chat with Expo users and ask questions.

demo/rn-expo-example/android/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ build/
1010
local.properties
1111
*.iml
1212
*.hprof
13+
.cxx/
1314

1415
# Bundle artifacts
1516
*.jsbundle
Lines changed: 19 additions & 84 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,8 @@
11
apply plugin: "com.android.application"
2+
apply plugin: "org.jetbrains.kotlin.android"
23
apply plugin: "com.facebook.react"
34

4-
import com.android.build.OutputFile
5-
65
def projectRoot = rootDir.getAbsoluteFile().getParentFile().getAbsolutePath()
7-
def expoDebuggableVariants = ['debug']
8-
// Override `debuggableVariants` for expo-updates debugging
9-
if (System.getenv('EX_UPDATES_NATIVE_DEBUG') == "1") {
10-
react {
11-
expoDebuggableVariants = []
12-
}
13-
}
14-
156

167
/**
178
* This is the configuration block to customize your React Native Android app.
@@ -21,17 +12,20 @@ react {
2112
entryFile = file(["node", "-e", "require('expo/scripts/resolveAppEntry')", projectRoot, "android", "absolute"].execute(null, rootDir).text.trim())
2213
reactNativeDir = new File(["node", "--print", "require.resolve('react-native/package.json')"].execute(null, rootDir).text.trim()).getParentFile().getAbsoluteFile()
2314
hermesCommand = new File(["node", "--print", "require.resolve('react-native/package.json')"].execute(null, rootDir).text.trim()).getParentFile().getAbsolutePath() + "/sdks/hermesc/%OS-BIN%/hermesc"
24-
debuggableVariants = expoDebuggableVariants
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+
// Use Expo CLI to bundle the app, this ensures the Metro config
18+
// works correctly with Expo projects.
19+
cliFile = new File(["node", "--print", "require.resolve('@expo/cli', { paths: [require.resolve('expo/package.json')] })"].execute(null, rootDir).text.trim())
20+
bundleCommand = "export:embed"
2521

2622
/* Folders */
2723
// The root of your project, i.e. where "package.json" lives. Default is '..'
2824
// root = file("../")
2925
// The folder where the react-native NPM package is. Default is ../node_modules/react-native
3026
// reactNativeDir = file("../node_modules/react-native")
31-
// The folder where the react-native Codegen package is. Default is ../node_modules/react-native-codegen
32-
// codegenDir = file("../node_modules/react-native-codegen")
33-
// The cli.js file which is the React Native CLI entrypoint. Default is ../node_modules/react-native/cli.js
34-
// cliFile = file("../node_modules/react-native/cli.js")
27+
// The folder where the react-native Codegen package is. Default is ../node_modules/@react-native/codegen
28+
// codegenDir = file("../node_modules/@react-native/codegen")
3529

3630
/* Variants */
3731
// The list of variants to that are debuggable. For those we're going to
@@ -42,9 +36,7 @@ react {
4236
/* Bundling */
4337
// A list containing the node command and its flags. Default is just 'node'.
4438
// nodeExecutableAndArgs = ["node"]
45-
//
46-
// The command to run when bundling. By default is 'bundle'
47-
// bundleCommand = "ram-bundle"
39+
4840
//
4941
// The path to the CLI configuration file. Default is empty.
5042
// bundleConfig = file(../rn-cli.config.js)
@@ -67,19 +59,6 @@ react {
6759
// hermesFlags = ["-O", "-output-source-map"]
6860
}
6961

70-
// Override `hermesEnabled` by `expo.jsEngine`
71-
ext {
72-
hermesEnabled = (findProperty('expo.jsEngine') ?: "hermes") == "hermes"
73-
}
74-
75-
/**
76-
* Set this to true to create four separate APKs instead of one,
77-
* one for each native architecture. This is useful if you don't
78-
* use App Bundles (https://developer.android.com/guide/app-bundle/)
79-
* and want to have separate APKs to upload to the Play Store.
80-
*/
81-
def enableSeparateBuildPerCPUArchitecture = false
82-
8362
/**
8463
* Set this to true to Run Proguard on Release builds to minify the Java bytecode.
8564
*/
@@ -98,20 +77,11 @@ def enableProguardInReleaseBuilds = (findProperty('android.enableProguardInRelea
9877
*/
9978
def jscFlavor = 'org.webkit:android-jsc:+'
10079

101-
/**
102-
* Private function to get the list of Native Architectures you want to build.
103-
* This reads the value from reactNativeArchitectures in your gradle.properties
104-
* file and works together with the --active-arch-only flag of react-native run-android.
105-
*/
106-
def reactNativeArchitectures() {
107-
def value = project.getProperties().get("reactNativeArchitectures")
108-
return value ? value.split(",") : ["armeabi-v7a", "x86", "x86_64", "arm64-v8a"]
109-
}
110-
11180
android {
11281
ndkVersion rootProject.ext.ndkVersion
11382

114-
compileSdkVersion rootProject.ext.compileSdkVersion
83+
buildToolsVersion rootProject.ext.buildToolsVersion
84+
compileSdk rootProject.ext.compileSdkVersion
11585

11686
namespace 'com.anonymous.rnexpoexample'
11787
defaultConfig {
@@ -121,15 +91,6 @@ android {
12191
versionCode 1
12292
versionName "1.0.0"
12393
}
124-
125-
splits {
126-
abi {
127-
reset()
128-
enable enableSeparateBuildPerCPUArchitecture
129-
universalApk false // If true, also generate a universal APK
130-
include (*reactNativeArchitectures())
131-
}
132-
}
13394
signingConfigs {
13495
debug {
13596
storeFile file('debug.keystore')
@@ -151,20 +112,9 @@ android {
151112
proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
152113
}
153114
}
154-
155-
// applicationVariants are e.g. debug, release
156-
applicationVariants.all { variant ->
157-
variant.outputs.each { output ->
158-
// For each separate APK per architecture, set a unique version code as described here:
159-
// https://developer.android.com/studio/build/configure-apk-splits.html
160-
// Example: versionCode 1 will generate 1001 for armeabi-v7a, 1002 for x86, etc.
161-
def versionCodes = ["armeabi-v7a": 1, "x86": 2, "arm64-v8a": 3, "x86_64": 4]
162-
def abi = output.getFilter(OutputFile.ABI)
163-
if (abi != null) { // null for the universal-debug, universal-release variants
164-
output.versionCodeOverride =
165-
defaultConfig.versionCode * 1000 + versionCodes.get(abi)
166-
}
167-
115+
packagingOptions {
116+
jniLibs {
117+
useLegacyPackaging (findProperty('expo.useLegacyPackaging')?.toBoolean() ?: false)
168118
}
169119
}
170120
}
@@ -196,42 +146,27 @@ dependencies {
196146
def isGifEnabled = (findProperty('expo.gif.enabled') ?: "") == "true";
197147
def isWebpEnabled = (findProperty('expo.webp.enabled') ?: "") == "true";
198148
def isWebpAnimatedEnabled = (findProperty('expo.webp.animated') ?: "") == "true";
199-
def frescoVersion = rootProject.ext.frescoVersion
200-
201-
// If your app supports Android versions before Ice Cream Sandwich (API level 14)
202-
if (isGifEnabled || isWebpEnabled) {
203-
implementation("com.facebook.fresco:fresco:${frescoVersion}")
204-
implementation("com.facebook.fresco:imagepipeline-okhttp3:${frescoVersion}")
205-
}
206149

207150
if (isGifEnabled) {
208151
// For animated gif support
209-
implementation("com.facebook.fresco:animated-gif:${frescoVersion}")
152+
implementation("com.facebook.fresco:animated-gif:${reactAndroidLibs.versions.fresco.get()}")
210153
}
211154

212155
if (isWebpEnabled) {
213156
// For webp support
214-
implementation("com.facebook.fresco:webpsupport:${frescoVersion}")
157+
implementation("com.facebook.fresco:webpsupport:${reactAndroidLibs.versions.fresco.get()}")
215158
if (isWebpAnimatedEnabled) {
216159
// Animated webp support
217-
implementation("com.facebook.fresco:animated-webp:${frescoVersion}")
160+
implementation("com.facebook.fresco:animated-webp:${reactAndroidLibs.versions.fresco.get()}")
218161
}
219162
}
220163

221-
implementation("androidx.swiperefreshlayout:swiperefreshlayout:1.0.0")
222-
223-
debugImplementation("com.facebook.flipper:flipper:${FLIPPER_VERSION}")
224-
debugImplementation("com.facebook.flipper:flipper-network-plugin:${FLIPPER_VERSION}") {
225-
exclude group:'com.squareup.okhttp3', module:'okhttp'
226-
}
227-
debugImplementation("com.facebook.flipper:flipper-fresco-plugin:${FLIPPER_VERSION}")
228-
229164
if (hermesEnabled.toBoolean()) {
230165
implementation("com.facebook.react:hermes-android")
231166
} else {
232167
implementation jscFlavor
233168
}
234169
}
235170

236-
apply from: new File(["node", "--print", "require.resolve('@react-native-community/cli-platform-android/package.json')"].execute(null, rootDir).text.trim(), "../native_modules.gradle");
171+
apply from: new File(["node", "--print", "require.resolve('@react-native-community/cli-platform-android/package.json', { paths: [require.resolve('react-native/package.json')] })"].execute(null, rootDir).text.trim(), "../native_modules.gradle");
237172
applyNativeModulesAppBuildGradle(project)

demo/rn-expo-example/android/app/src/debug/AndroidManifest.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@
33

44
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>
55

6-
<application android:usesCleartextTraffic="true" tools:targetApi="28" tools:ignore="GoogleAppIndexingWarning" />
6+
<application android:usesCleartextTraffic="true" tools:targetApi="28" tools:ignore="GoogleAppIndexingWarning" tools:replace="android:usesCleartextTraffic" />
77
</manifest>

0 commit comments

Comments
 (0)