Skip to content

Commit d89b3a7

Browse files
authored
Merge pull request #5 from thinkocapo/will-performance
Transactions Updates
2 parents 9435b55 + 3818bb1 commit d89b3a7

File tree

12 files changed

+23472
-7193
lines changed

12 files changed

+23472
-7193
lines changed

README.md

Lines changed: 94 additions & 98 deletions
Original file line numberDiff line numberDiff line change
@@ -1,156 +1,152 @@
1-
## Who am I
2-
31
This is demo repo is used by Solution Engineers when demo'ing Sentry's [React Native](https://docs.sentry.io/platforms/react-native) SDK's capabilties.
42

5-
## Versions Summary:
3+
## Versions
64

75
| dependency | version
86
| ------------- |:-------------:|
97
| react-native | 0.64.0 |
108
| gradle | 6.7 |
119
| react | 16.13.1 |
1210
| sentry/react-native | 2.4.0 |
11+
| npx | 7.8.0 |
12+
| cocoapods | +1.10.1 |
1313

14+
## Setup (Bootstrap)
1415

16+
[INSTALL.md](./Install.md) was written by the CreateReactNativeApp maintainers and outlines some things you'll need.
1517

16-
17-
18-
19-
20-
21-
This is demo repo is used by Solution Engineers when demo'ing Sentry's [React Native](https://docs.sentry.io/platforms/react-native) SDK's capabilties.
22-
23-
## Where do I begin
24-
25-
Please see [INSTALL.md](./Install.md) to get started with the setup.
26-
27-
## What next
28-
* If you are ready to demo:
18+
This step was already performed for adding the sdk to sentry_react_native, but it's good to know it was used as customers will use it:
2919
```
30-
$git clone <this repo>
31-
Edit App.js to add your Sentry's react-native's project's DSN key
3220
$npx @sentry/wizard -i reactNative -p ios android
3321
```
34-
### Above will :
35-
* Launch the [Sentry wizard](https://github.com/getsentry/sentry-wizard) allowing you to link with the correct Sentry react-native project.
36-
* Create `ios/sentry.properties` and `android/sentry.properties`.
37-
### Gotcha:
38-
At this point, you may get an error like:
39-
* `TypeError [ERR_INVALID_ARG_TYPE]: The "data" argument must be of type string or an instance of Buffer, TypedArray, or DataView. Received undefined
40-
41-
From my test runs I've noted that it is safe to look past this error. A minor issue is that it blocks creation of `ios/sentry.properties`. So simply make a copy of `android/sentry.properties` and put it in `ios/sentry.properties`
42-
22+
The above command launches the [Sentry wizard](https://github.com/getsentry/sentry-wizard) allowing you to [link](https://docs.sentry.io/platforms/react-native/#linking) with the correct Sentry react-native project.
23+
From our [documentation](https://docs.sentry.io/platforms/react-native/), the following changes happen which you should be aware of:
4324
```
44-
cp andoid/sentry.properties ios/sentry.properties
45-
cd ios
46-
pod install
25+
- add the sentry-android package for native crash reporting on Android
26+
- add the sentry-cocoa package for native crash reporting on iOS
27+
- enable the Sentry Gradle build step for Android
28+
- patch MainApplication.java for Android
29+
- configure Sentry for the supplied DSN in your index.js/App.js files
30+
- store build credentials in ios/sentry.properties and android/sentry.properties.
4731
```
48-
### Before Launching the Demo apps:
49-
50-
Be sure to export your auth token: `export SENTRY_AUTH_TOKEN=<token>`
5132

52-
### Versioning
33+
## Setup
5334

54-
Don't foget to bump your release version depending on platform:
35+
1. git clone [email protected]:sentry-demos/sentry_react_native.git
36+
2. Add your DSN and BACKEND_URL for back-end to src/config.ts
37+
3. `export SENTRY_AUTH_TOKEN=<token>`
38+
4. Setup a Android Virtual Device via AVD Manager.
39+
5. If you don't have cocopods or get an error about cocopods out of date, run `gem install cocopods`
40+
6. `cd ios && pod install`
41+
7. `npm install`
5542

56-
iOS: `Info.plist` `CFBundleShortVersionString`
57-
android: `app.build.gradle` `versionName`
43+
Don't forget to bump your release version depending on platform
44+
iOS: `Info.plist` `CFBundleShortVersionString`
45+
android: `app.build.gradle` `versionName`
5846

59-
Make sure to have Internet access enabled on your Android emulator. If you can't access the browser you may need to launch your emulator with the below commands:
47+
## Run
6048

49+
1. Android (optional) start the emulator by AVD Manager or:
6150
```
51+
// emulator executable is at /Users/<user>/Library/Android/sdk/emulator
6252
emulator -list-avds
63-
64-
emulator @{YourEmulator} -dns-server 8.8.8.8
53+
emulator @<YourEmulator> -dns-server 8.8.8.8
54+
emulator @Pixel_3_API_30_x86_64 -dns-server 8.8.8.8
6555
```
6656

67-
If you are experiencing issues with running the following launch command:
68-
69-
If the app launches and suddenly crashes you may need to reinstall your node package with this command:
70-
57+
2. Run Ios or Android app
58+
* _iOS version_:
7159
```
72-
rm -rf node_modules
60+
# opens the Metro debugger, has hot reload
61+
npx react-native run-ios --configuration Debug
7362
74-
npm install
63+
## builds a Release (takes longer)
64+
npx react-native run-ios --configuration Release
65+
npx react-native run-ios --simulator="iPhone 11"
7566
```
76-
77-
If all else fails and you seem to be getting a weird error related to IllegalAccessErrors or anything else you may need to rebuild your Android and iOS folders using the following (just make sure to grab the sentry.properties files, build.gradle files, and pod files from Github afterwards):
78-
67+
* _Android version_:
7968
```
80-
sudo rm -rf android/ ios/
81-
82-
yarn add react-native-eject
83-
84-
npx react-native eject
69+
npx react-native run-android --variant Release
8570
```
71+
^ this command builds APK for the arch and installs to the emulator.
72+
^ click 'OK' if you get a pop-up, and it should open Metro
8673

87-
### To Launch the Demo apps:
8874

89-
* _iOS version_: `npx react-native run-ios --configuration Release`
90-
* _Android version_: `npx react-native run-android --variant Release`
9175

92-
### When Launching Android
93-
You may run into issues if you haven't added sdk and sdk platform-tools to path:
94-
`export ANDROID_SDK_ROOT=/Users/dustinbailey/Library/Android/sdk`
95-
`export PATH=/Users/dustinbailey/Library/Android/sdk/platform-tools:$PATH`
76+
## Expected Behavior
9677

9778
Toolstore | Checkout
9879
:-------------------------:|:-------------------------:
9980
![list of tools](./img/toolstore.png) | ![checkout cart](./img/cart.png)|
10081

82+
## Upgrade path
83+
1. npm install
84+
2. SDK Manager -> install 'emulator' or anything missing
85+
3. Review previous PR so you know what to expect
10186

102-
## Why so many files
87+
## Troubleshooting
10388

104-
Actually, its so not that many :-) . The size of this repo is approx. 1.3MB while the size of the [original react-native](https://github.com/sentry-demos/react-native) is approx 350MB.
105-
106-
Please see [Steps](#what-were-the-steps-again) or go through the [first ten commits](https://github.com/sentry-demos/sentry_react_native/commits/master) (and their git log) messages in chronological order, to see the exact commands that were run and what files that were autogenerated.
89+
#### Repo
90+
This repo borrowed from [original react-native repo ]( https://github.com/sentry-demos/react-native/commit/269f58d63426065a4de67a3f22d2e774787cd996)
91+
The following may have been borrowed: `package.json`, `package-lock.json`, `ios/Podfile`, `ios/Podfile.lock`, see [pull/2](https://github.com/sentry-demos/sentry_react_native/pull/2)
10792

10893
Please know that react-native generates it own [.gitignore file](https://stackoverflow.com/questions/49099131/recommended-gitignore-for-react-native/49099219
10994
), which is of course part of this repo, so only those [autogenerated files](https://stackoverflow.com/questions/48448426/why-dont-we-gitignore-ios-and-android-in-react-native ) that are required for a baseline setup and the original demo code (files) are part of this repo.
11095

111-
So now we are at point, where one can simply clone, make a few edits and like DSN, project name, auth token and be up and running.
112-
113-
## Where's the "original" code
114-
115-
Adam worked on App.js which I took as-is from him. I also got from him the 2 image files in the assets dir (which are also present in [original react-native repo ]( https://github.com/sentry-demos/react-native)
116-
117-
## What else
118-
119-
It appears to me that we wanted to start fresh to create this demo. And while this was a good learning excercise as we expand our demo offering, I would like to "learn/see" how far off was the [original react-native repo ]( https://github.com/sentry-demos/react-native/commit/269f58d63426065a4de67a3f22d2e774787cd996)
120-
121-
Since the assets are taken from there, and that it has its own App.js, it makes me wonder that a part/whole of it should already be working. I will investigate that as time permits.
122-
123-
### Update
124-
125-
So I took the major files from this working demo viz. `package.json`, `package-lock.json`, `ios/Podfile`, `ios/Podfile.lock`, because it is such files that make the deliverable self-contained, amongst other changes like DSN. When I put them on top of [original react-native repo ]( https://github.com/sentry-demos/react-native/commit/269f58d63426065a4de67a3f22d2e774787cd996) , I am get comile errors for both ios and android versions.
126-
127-
At this time, I propose, we use this very repo (sentry_react_native) as the new working demo for RN stuff and forget about making them work on TOP of [original react-native repo](https://github.com/sentry-demos/react-native) . That to me is now a hacker's or pure development exercise.
128-
129-
## What were the steps again
96+
Please see [Steps](#what-were-the-steps-again) or go through the [first ten commits](https://github.com/sentry-demos/sentry_react_native/commits/master) (and their git log) messages in chronological order, to see the exact commands that were run and what files that were autogenerated.
13097

98+
#### What were the steps again
13199
This is just the background steps to answer "How did we get here ?" . Below is not needed/related to the demoing this app.
132100
```
133-
npx react-native init sentry_react_native (where sentry_react_native is the project name) This generates the boiler plate code for the RN app
101+
// generates boilerplate code
102+
npx react-native init sentry_react_native
134103
cd sentry_react_native
135-
git init (Turn folder into a git repo)
136104
cd ios
137-
Edit Podfile to remove/comment out flipper install as suggested in the comments of the file itself
105+
// Edit Podfile to remove/comment out flipper install as suggested in the comments of the file itself
106+
pod install
107+
// add Sentry SDKs
108+
npm install --save @sentry/react-native
109+
npx @sentry/wizard -i reactNative -p ios android (and select you Sentry react native project )
110+
cd ios
138111
pod install
139-
```
140-
141-
Throw in your changes
142-
```
143-
cd ..
144-
Make any code changes you need to such as App.js
145112
```
146113

147-
Throw in Sentry SDKs
114+
#### adding Sentry for first time
115+
When running npx @sentry/wizard -i reactNative -p ios android
116+
At this point, you may get an error like:
117+
`TypeError [ERR_INVALID_ARG_TYPE]: The "data" argument must be of type string or an instance of Buffer, TypedArray, or DataView. Received undefined`
118+
It should be safe to look past this error. A minor issue is that it blocks creation of `ios/sentry.properties`. So simply make a copy of `android/sentry.properties` and put it in `ios/sentry.properties`:
148119
```
149-
npm install --save @sentry/react-native
150-
npx @sentry/wizard -i reactNative -p ios android (and select you Sentry react native project )
120+
cp andoid/sentry.properties ios/sentry.properties
151121
cd ios
152122
pod install
153-
cd ..
154123
```
155-
Ran git commit along the way and finally pushed to this repo.
156124

125+
If all else fails and you seem to be getting a weird error related to IllegalAccessErrors or anything else you may need to rebuild your Android and iOS folders using the following (just make sure to grab the sentry.properties files, build.gradle files, and pod files from Github afterwards):
126+
127+
```
128+
sudo rm -rf android/ ios/
129+
yarn add react-native-eject
130+
npx react-native eject
131+
```
132+
133+
#### Emulators
134+
When running emulator...
135+
If the app launches and suddenly crashes you may need to reinstall your node package with this command:
136+
137+
```
138+
rm -rf node_modules
139+
npm install
140+
```
141+
142+
Emulator needs Internet access enabled on your Android emulator. Use AVD Manager or:
143+
144+
#### Running
145+
You may run into issues if you haven't added sdk and sdk platform-tools to path:
146+
`export ANDROID_SDK_ROOT=/Users/<user>/Library/Android/sdk`
147+
`export PATH=/Users/<user>/Library/Android/sdk/platform-tools:$PATH`
148+
149+
"error: Can't find the 'node' binary to build the React Native bundle." should be okay
150+
151+
If tools don't load, then swipe-away (kill) the app, then relaunch from app menu in the emulator. If still fails, then go to AVD Manager and 'wipe' the device and run the emulator again.
152+
Could also be a problem with the backend container/app you're requesting the tools from (check that URL/Postman, check TDA job)

ios/Podfile.lock

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -406,10 +406,10 @@ EXTERNAL SOURCES:
406406
SPEC CHECKSUMS:
407407
boost-for-react-native: 39c7adb57c4e60d6c5479dd8623128eb5b3f0f2c
408408
BVLinearGradient: e3aad03778a456d77928f594a649e96995f1c872
409-
DoubleConversion: cde416483dac037923206447da6e1454df403714
409+
DoubleConversion: cf9b38bf0b2d048436d9a82ad2abe1404f11e7de
410410
FBLazyVector: 49cbe4b43e445b06bf29199b6ad2057649e4c8f5
411-
FBReactNativeSpec: 41c5b05d2437481e7feafaa7773f1d9285a4b325
412-
glog: 40a13f7840415b9a77023fbcae0f1e6f43192af3
411+
FBReactNativeSpec: f21132940a8f408886313ded89588b774fbec4b7
412+
glog: 73c2498ac6884b13ede40eda8228cb1eee9d9d62
413413
RCT-Folly: ec7a233ccc97cc556cf7237f0db1ff65b986f27c
414414
RCTRequired: 2f8cb5b7533219bf4218a045f92768129cf7050a
415415
RCTTypeSafety: 512728b73549e72ad7330b92f3d42936f2a4de5b
@@ -421,7 +421,7 @@ SPEC CHECKSUMS:
421421
React-jsi: 74341196d9547cbcbcfa4b3bbbf03af56431d5a1
422422
React-jsiexecutor: 06a9c77b56902ae7ffcdd7a4905f664adc5d237b
423423
React-jsinspector: 0ae35a37b20d5e031eb020a69cc5afdbd6406301
424-
react-native-safe-area-context: e471852c5ed67eea4b10c5d9d43c1cebae3b231d
424+
react-native-safe-area-context: f0906bf8bc9835ac9a9d3f97e8bde2a997d8da79
425425
React-perflogger: 9c547d8f06b9bf00cb447f2b75e8d7f19b7e02af
426426
React-RCTActionSheet: 3080b6e12e0e1a5b313c8c0050699b5c794a1b11
427427
React-RCTAnimation: 3f96f21a497ae7dabf4d2f150ee43f906aaf516f
@@ -434,7 +434,7 @@ SPEC CHECKSUMS:
434434
React-RCTVibration: 0fd6b21751a33cb72fce1a4a33ab9678416d307a
435435
React-runtimeexecutor: cad74a1eaa53ee6e7a3620231939d8fe2c6afcf0
436436
ReactCommon: cfe2b7fd20e0dbd2d1185cd7d8f99633fbc5ff05
437-
RNCMaskedView: f5c7d14d6847b7b44853f7acb6284c1da30a3459
437+
RNCMaskedView: 5a8ec07677aa885546a0d98da336457e2bea557f
438438
RNGestureHandler: a479ebd5ed4221a810967000735517df0d2db211
439439
RNReanimated: 514a11da3a2bcc6c3dfd9de32b38e2b9bf101926
440440
RNScreens: f7ad633b2e0190b77b6a7aab7f914fad6f198d8d

0 commit comments

Comments
 (0)