Skip to content

Commit 2ff3ab3

Browse files
authored
fix: AndroidX, Autolink, Cocoapods (#613)
* fix: AndroidX, Autolink, Cocoapods * fix: Readd rnpm section in package.json to support older versions
1 parent fd1c5ed commit 2ff3ab3

File tree

8 files changed

+53
-37
lines changed

8 files changed

+53
-37
lines changed

RNSentry.podspec

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
require 'json'
2+
version = JSON.parse(File.read('package.json'))["version"]
3+
4+
Pod::Spec.new do |s|
5+
s.name = 'RNSentry'
6+
s.version = version
7+
s.license = 'MIT'
8+
s.summary = 'Official Sentry SDK for react-native'
9+
s.author = 'Sentry'
10+
s.homepage = "https://github.com/getsentry/sentry-react-native"
11+
s.source = { :git => 'https://github.com/getsentry/sentry-react-native.git', :tag => "#{s.version}"}
12+
13+
s.ios.deployment_target = "8.0"
14+
s.tvos.deployment_target = "9.0"
15+
16+
s.preserve_paths = '*.js'
17+
18+
s.dependency 'React'
19+
s.dependency 'Sentry', '~> 4.4.0'
20+
21+
s.source_files = 'ios/RNSentry.{h,m}'
22+
s.public_header_files = 'ios/RNSentry.h'
23+
end

SentryReactNative.podspec

Lines changed: 0 additions & 25 deletions
This file was deleted.

android/src/main/java/io/sentry/RNSentryModule.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
import android.content.Context;
44
import android.content.pm.PackageInfo;
55
import android.content.pm.PackageManager;
6-
import android.support.annotation.NonNull;
76

87
import com.facebook.react.bridge.Arguments;
98
import com.facebook.react.bridge.Promise;
@@ -249,7 +248,6 @@ public void sendEvent(ReadableMap event, Promise promise) {
249248
promise.resolve(true);
250249
}
251250

252-
@NonNull
253251
private UserBuilder getUserBuilder(ReadableMap user) {
254252
UserBuilder userBuilder = new UserBuilder();
255253
if (user.hasKey("email")) {

package.json

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,14 @@
3737
"@sentry/utils": "^5.4.2",
3838
"@sentry/wizard": "^1.0.0"
3939
},
40+
"devDependencies": {
41+
"@sentry/typescript": "5.*",
42+
"@types/react-native": "^0.57.57",
43+
"prettier": "^1.17.0",
44+
"replace-in-file": "^4.0.0",
45+
"rimraf": "^2.6.3",
46+
"typescript": "^3.4.5"
47+
},
4048
"rnpm": {
4149
"commands": {
4250
"postlink": "node node_modules/@sentry/wizard/dist/bin.js -i reactNative -p ios android",
@@ -50,13 +58,5 @@
5058
"libz"
5159
]
5260
}
53-
},
54-
"devDependencies": {
55-
"@sentry/typescript": "5.*",
56-
"@types/react-native": "^0.57.57",
57-
"prettier": "^1.17.0",
58-
"replace-in-file": "^4.0.0",
59-
"rimraf": "^2.6.3",
60-
"typescript": "^3.4.5"
6161
}
6262
}

react-native.config.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
module.exports = {
2+
dependency: {
3+
platforms: {
4+
ios: {
5+
sharedLibraries: ["libz"]
6+
},
7+
android: {
8+
packageInstance: "new RNSentryPackage()"
9+
}
10+
},
11+
hooks: {
12+
postlink:
13+
"node node_modules/@sentry/wizard/dist/bin.js -i reactNative -p ios android",
14+
postunlink:
15+
"node node_modules/@sentry/wizard/dist/bin.js -i reactNative -p ios android --uninstall"
16+
}
17+
}
18+
};

src/js/backend.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ export class ReactNativeBackend extends BaseBackend<BrowserOptions> {
9494
private _isNativeTransportAvailable(): boolean {
9595
return (
9696
this._options.enableNative &&
97+
RNSentry &&
9798
RNSentry.nativeClientAvailable &&
9899
RNSentry.nativeTransport
99100
);

src/js/sdk.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,8 @@ export function init(
3939
i => !IGNORED_DEFAULT_INTEGRATIONS.includes(i.name)
4040
),
4141
new Integrations.Breadcrumbs({
42-
fetch: false
42+
fetch: false,
43+
console: false // If this in enabled it causes problems to native calls on >= RN 0.60
4344
}),
4445
new RewriteFrames({
4546
iteratee: (frame: StackFrame) => {

0 commit comments

Comments
 (0)