|
1 | | -# Setting up the environment |
2 | | -Install Node & Watchman using Homebrew |
| 1 | +# Bugfender React Native Development |
| 2 | + |
| 3 | +## Setting up the environment |
| 4 | + |
| 5 | +Please follow the guide located in [React Native Environment Setup](https://reactnative.dev/docs/environment-setup) "React Native CLI Quickstart" tab. The following is an overview of the needed tooling. |
| 6 | + |
| 7 | +Basic tooling: |
| 8 | + |
| 9 | +- NodeJS and [Yarn](https://yarnpkg.com) |
| 10 | +- [Watchman](https://github.com/facebook/watchman) |
3 | 11 |
|
4 | 12 | For Android, install: |
5 | | - - Java Development Kit |
6 | | - - Android Studio with Android SDK |
| 13 | + |
| 14 | +- Java Development Kit |
| 15 | +- Android Studio with Android SDK |
7 | 16 |
|
8 | 17 | For iOS, install: |
9 | | - - XCode with command line tools |
10 | | - - Cocoapods |
11 | 18 |
|
12 | | -Please follow the guide on https://reactnative.dev/docs/environment-setup |
| 19 | +- XCode with Command Line Tools |
| 20 | +- [Cocoapods](https://cocoapods.org) |
| 21 | + |
| 22 | +**Once all the tooling is ready**: |
| 23 | + |
| 24 | +- On the `example` folder: |
| 25 | + - `bundle install`: install required Ruby gems |
| 26 | +- On the root folder: |
| 27 | + - `yarn`: this will install dependencies for the library & `/example` |
| 28 | +- Add Bugfender app key in `example` project: |
| 29 | + - `cd example/src` |
| 30 | + - `cp bugfenderKey.json.example bugfenderKey.json` |
| 31 | + - Edit `bugfenderKey.json` & add the key |
| 32 | + |
| 33 | +## Running the example |
| 34 | + |
| 35 | +On a terminal window: |
| 36 | + |
| 37 | +- `cd example`: enter the `example` folder |
| 38 | +- `yarn start`: start React Native "server" |
| 39 | +- Open a new terminal to run the specific example |
| 40 | + |
| 41 | +For Android: |
| 42 | + |
| 43 | +- Open Android Studio and run an emulator |
| 44 | +- `cd example`: enter the `example` folder |
| 45 | +- `yarn android`: run in Android |
| 46 | + |
| 47 | +For iOS: |
13 | 48 |
|
14 | | -# Running the example |
15 | | -On Android: |
16 | | - - Open Android Studio and run an emulator |
17 | | - - Execute the following command under the example folder: `yarn android` |
| 49 | +- `cd example`: enter the `example` folder |
| 50 | +- `yarn ios`: run in iOS |
18 | 51 |
|
19 | | -On iOS: |
20 | | -- Execute the following command under the example folder: `yarn ios` |
| 52 | +For Web: |
21 | 53 |
|
22 | | -On Web: |
23 | 54 | - Please use [this private project](https://bitbucket.org/bugfender/rn-bugfender-development) and execute `yarn web` |
24 | 55 |
|
25 | | -## Update React Native version |
| 56 | +## Upgrade React Native version |
| 57 | + |
26 | 58 | Try with the official react native upgrade command: |
| 59 | + |
27 | 60 | ```bash |
28 | 61 | npx react-native upgrade |
29 | 62 | ``` |
30 | 63 |
|
31 | 64 | If it does not work you can create a new updated library from scratch: |
32 | | -1. Using [create-react-native-library tool] (https://reactnative.dev/docs/native-modules-setup) |
33 | 65 |
|
| 66 | +1. Using [create-react-native-library tool](https://reactnative.dev/docs/native-modules-setup) |
34 | 67 | 2. Be sure to select a Native library using Java & Objective-C |
35 | | - |
36 | 68 | 3. Add the following lines to the `package.json` of the newly created library (be sure to use the latest version): |
37 | | -```json |
38 | | -"dependencies": { |
39 | | - "@bugfender/common": "1.0.0-alpha.5", |
40 | | - "@bugfender/sdk": "^2.1.0" |
41 | | -} |
42 | | -``` |
| 69 | + |
| 70 | + ```json |
| 71 | + "dependencies": { |
| 72 | + "@bugfender/common": "1.0.0-alpha.5", |
| 73 | + "@bugfender/sdk": "^2.1.0" |
| 74 | + } |
| 75 | + ``` |
43 | 76 |
|
44 | 77 | 4. Add "dom" into the "lib" object on `tsconfig.json`: |
45 | | -```json |
46 | | -"lib": [ |
47 | | - "esnext", |
48 | | - "dom" |
49 | | -], |
50 | | -``` |
| 78 | + |
| 79 | + ```json |
| 80 | + "lib": [ |
| 81 | + "esnext", |
| 82 | + "dom" |
| 83 | + ], |
| 84 | + ``` |
51 | 85 |
|
52 | 86 | 5. On **android/src/build.gradle** add the following to the dependencies: |
53 | | -```gradle |
54 | | -implementation 'com.bugfender.sdk:android:3.+' |
55 | | -``` |
56 | 87 |
|
57 | | -6. Copy `RnBugfenderModule.java` and `RnBufgenerPackage.java` to **android/src/main/java/com.bugfender.react** |
| 88 | + ```gradle |
| 89 | + implementation 'com.bugfender.sdk:android:3.+' |
| 90 | + ``` |
58 | 91 |
|
| 92 | +6. Copy `RnBugfenderModule.java` and `RnBufgenerPackage.java` to **android/src/main/java/com.bugfender.react**. |
59 | 93 | 7. Add the Bugfender dependency to the podspec on the **root** folder |
60 | | -```ruby |
61 | | -s.dependency 'BugfenderSDK', '~> 1.10.5' |
62 | | -``` |
| 94 | + |
| 95 | + ```ruby |
| 96 | + s.dependency 'BugfenderSDK', '~> 1.10.5' |
| 97 | + ``` |
63 | 98 |
|
64 | 99 | 8. Copy `RnBugefnder.h` && `RnBugefnder.mm` to **ios/** |
| 100 | +9. Copy `App.tsx` & add `bugfenderKey.json` into **example/src/**, see `bugfenderKey.json` format below: |
65 | 101 |
|
66 | | -9. Copy `App.tsx` & add `bugfenderKey.json` into **example/src/**, see `bugfenderKey.json` format below: |
67 | | -```json |
68 | | -{ |
69 | | - "bugfenderKey": "<your Bugfdender key>" |
70 | | -} |
71 | | -``` |
| 102 | + ```json |
| 103 | + { |
| 104 | + "bugfenderKey": "<your Bugfdender key>" |
| 105 | + } |
| 106 | + ``` |
72 | 107 |
|
73 | 108 | 10. Run `pod install` under **example/ios/** |
74 | | - |
75 | 109 | 11. You should be ready to run the example using `yarn android` & `yarn ios` |
0 commit comments