Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support ReactNative New architecture #1973

Merged
merged 9 commits into from
Jul 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
40 changes: 40 additions & 0 deletions .buildkite/react-native-android-pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,20 @@ steps:
artifact_paths:
- build/rn0.69.apk

- label: ":android: Build RN 0.71 (New Arch) apk"
key: "rn-0-71-new-arch-apk"
depends_on:
- "android-builder-image"
timeout_in_minutes: 60
env:
REACT_NATIVE_VERSION: "rn0.71-new-arch"
RN_NEW_ARCH: "true"
plugins:
- docker-compose#v4.12.0:
run: react-native-android-builder
artifact_paths:
- build/rn0.71-new-arch.apk

- label: ":android: Build react-navigation 0.60 apk"
key: "react-navigation-0-60-apk"
depends_on:
Expand Down Expand Up @@ -276,6 +290,32 @@ steps:
concurrency_group: 'bitbar-app'
concurrency_method: eager

- label: ":android: RN 0.71 (New Arch) Android 12 end-to-end tests"
depends_on: "rn-0-71-new-arch-apk"
timeout_in_minutes: 60
plugins:
artifacts#v1.9.0:
download: "build/rn0.71-new-arch.apk"
upload: ./test/react-native/maze_output/**/*
docker-compose#v4.7.0:
pull: react-native-maze-runner
run: react-native-maze-runner
service-ports: true
command:
- --app=build/rn0.71-new-arch.apk
- --farm=bb
- --device=ANDROID_12
- --a11y-locator
- --fail-fast
- --no-tunnel
- --aws-public-ip
env:
SKIP_NAVIGATION_SCENARIOS: "true"
HERMES: "true"
concurrency: 25
concurrency_group: "bitbar-app"
concurrency_method: eager

- label: ":bitbar: :android: react-navigation 0.60 Android end-to-end tests"
depends_on: "react-navigation-0-60-apk"
timeout_in_minutes: 60
Expand Down
39 changes: 39 additions & 0 deletions .buildkite/react-native-ios-pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,20 @@ steps:
commands:
- npm run test:build-react-native-ios

- label: ":ios: Build RN 0.71 ipa"
key: "rn-0-71-ipa"
timeout_in_minutes: 60
agents:
queue: "opensource-arm-mac-cocoa-12"
env:
REACT_NATIVE_VERSION: "rn0.71-new-arch"
LANG: "en_US.UTF-8"
DEVELOPER_DIR: "/Applications/Xcode14.app"
RCT_NEW_ARCH_ENABLED: "1"
artifact_paths: build/rn0.71-new-arch.ipa
commands:
- npm run test:build-react-native-ios

# See: PLAT-5173
- label: ":ios: Build react-navigation 0.60 ipa"
skip: "See PLAT-5173"
Expand Down Expand Up @@ -263,6 +277,31 @@ steps:
concurrency_group: "browserstack-app"
concurrency_method: eager

- label: ":ios: RN 0.71 (New Arch) iOS 14 end-to-end tests"
depends_on: "rn-0-71-ipa"
timeout_in_minutes: 60
plugins:
artifacts#v1.5.0:
download: "build/rn0.71-new-arch.ipa"
upload: ./test/react-native/maze_output/**/*
docker-compose#v4.12.0:
pull: react-native-maze-runner
run: react-native-maze-runner
use-aliases: true
command:
- --app=build/rn0.71-new-arch.ipa
- --farm=bs
- --device=IOS_14
- --a11y-locator
- --appium-version=1.18.0
- --fail-fast
env:
SKIP_NAVIGATION_SCENARIOS: "true"
HERMES: "true"
concurrency: 5
concurrency_group: "browserstack-app"
concurrency_method: eager

# See: PLAT-5173
- label: ":browserstack: :ios: react-navigation 0.60 iOS 12 end-to-end tests"
skip: "See PLAT-5173"
Expand Down
1 change: 1 addition & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ services:
- BUILDKITE
- REGISTRY_URL
- REACT_NATIVE_VERSION
- RN_NEW_ARCH
- NOTIFIER_VERSION
- ARTEFACT_NAME
- JS_SOURCE_DIR
Expand Down
4 changes: 4 additions & 0 deletions examples/reactnative/rn071example/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
module.exports = {
root: true,
extends: '@react-native-community',
};
66 changes: 66 additions & 0 deletions examples/reactnative/rn071example/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
# OSX
#
.DS_Store

# Xcode
#
build/
*.pbxuser
!default.pbxuser
*.mode1v3
!default.mode1v3
*.mode2v3
!default.mode2v3
*.perspectivev3
!default.perspectivev3
xcuserdata
*.xccheckout
*.moved-aside
DerivedData
*.hmap
*.ipa
*.xcuserstate
ios/.xcode.env.local

# Android/IntelliJ
#
build/
.idea
.gradle
local.properties
*.iml
*.hprof
.cxx/
*.keystore
!debug.keystore

# node.js
#
node_modules/
npm-debug.log
yarn-error.log

# fastlane
#
# It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the
# screenshots whenever they are needed.
# For more information about the recommended setup visit:
# https://docs.fastlane.tools/best-practices/source-control/

**/fastlane/report.xml
**/fastlane/Preview.html
**/fastlane/screenshots
**/fastlane/test_output

# Bundle artifact
*.jsbundle

# Ruby / CocoaPods
/ios/Pods/
/vendor/bundle/

# Temporary files created by Metro to check the health of the file watcher
.metro-health-check*

# testing
/coverage
7 changes: 7 additions & 0 deletions examples/reactnative/rn071example/.prettierrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
module.exports = {
arrowParens: 'avoid',
bracketSameLine: true,
bracketSpacing: false,
singleQuote: true,
trailingComma: 'all',
};
1 change: 1 addition & 0 deletions examples/reactnative/rn071example/.watchmanconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
187 changes: 187 additions & 0 deletions examples/reactnative/rn071example/App.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,187 @@
/**
* Sample React Native App
* https://github.com/facebook/react-native
*
* @format
*/

import React from 'react'
import type {PropsWithChildren} from 'react'
import {
Button,
SafeAreaView,
ScrollView,
StatusBar,
StyleSheet,
Text,
useColorScheme,
Platform,
View,
} from 'react-native'

// Setup Bugsnag client to capture errors automatically
import Bugsnag from '@bugsnag/react-native'
Bugsnag.start()

const bogusObject = {} as any

function triggerException() {
bogusObject.bogusFunction()
}

function triggerHandledException() {
bogusObject.bogusHandledFunction()
}

async function triggerPromiseRejection() {
// try {
// await NativeModules.CrashyCrashy.generatePromiseRejection()
// } catch (e: any) {
// Bugsnag.notify(e)
// }
}

function triggerNativeException() {
// NativeModules.CrashyCrashy.generateCrash()
}

function triggerNativeHandledError() {
// NativeModules.CrashyCrashy.handledError()
}

type SectionProps = PropsWithChildren<{
title: string
}>

function App(): JSX.Element {
return (
<>
<StatusBar barStyle="dark-content" />
<SafeAreaView>
<ScrollView
contentInsetAdjustmentBehavior="automatic"
style={styles.scrollView}>
{global.HermesInternal == null ? null : (
<View style={styles.engine}>
<Text style={styles.footer}>Engine: Hermes ({global.__turboModuleProxy != null ? 'Turbo' : 'Native'} Modules)</Text>
</View>
)}
<View style={styles.container}>
<Text style= {{
paddingTop: 40,
margin: 20,
}}>Press the buttons below to test examples of Bugsnag functionality. Make sure you have changed the API key in Info.plist or AndroidManifest.xml.</Text>
<ScrollView>
<View style={styles.buttonContainer}>

<Button
title="Trigger JS Exception"
onPress={triggerException} />
<Text style={styles.info}>
Tap this button to send a JS crash to Bugsnag
</Text>

<Button
title="Trigger Native Exception"
onPress={triggerNativeException} />
<Text style={styles.info}>
Tap this button to send a native {Platform.OS} crash to Bugsnag
</Text>

<Button
title="Send Handled JS Exception"
onPress={() => {
try { // execute crashy code
triggerHandledException()
} catch (error: any) {
Bugsnag.notify(error)
}
}} />
<Text style={styles.info}>
Tap this button to send a handled error to Bugsnag
</Text>

<Button
title="Trigger Promise Rejection"
onPress={() => {
try { // execute crashy code
triggerPromiseRejection()
} catch (error: any) {
Bugsnag.notify(error)
}
}} />
<Text style={styles.info}>
Tap this button to send a native promise rejection to Bugsnag
</Text>

<Button
title="Send Handled Native Exception"
onPress={() => {
triggerNativeHandledError()
}} />
<Text style={styles.info}>
Tap this button to send a native handled error to Bugsnag
</Text>

<Button
title="Set user"
onPress={() => {
try { // execute crashy code
throw new Error("Error with user")
} catch (error) {
Bugsnag.setUser("user-5fab67", "john@example.com", "John Smith")
Bugsnag.notify(error)
}
}} />
<Text style={styles.info}>
Tap this button to send a handled error with user information to Bugsnag
</Text>

<Button
title="Leave breadcrumbs"
onPress={() => {
// log a breadcrumb, which will be attached to the error report
Bugsnag.leaveBreadcrumb('About to execute crashy code', {
type: 'user'
})

try { // execute crashy code
throw new Error("Error with breadcrumbs")
} catch (error) {
Bugsnag.notify(error)
}
}} />
<Text style={styles.info}>
Tap this button to send a handled error with manual breadcrumbs
</Text>

</View>
</ScrollView>
</View>
</ScrollView>
</SafeAreaView>
</>
)
}


const styles = StyleSheet.create({
container: {
flex: 1,
flexDirection: 'column',
justifyContent: 'center',
alignItems: 'center',
backgroundColor: '#eeeeee',
},
buttonContainer: {
margin: 20
},
info: {
textAlign: 'center',
color: '#666',
fontSize: 11,
marginBottom: 20
}
})

export default App
6 changes: 6 additions & 0 deletions examples/reactnative/rn071example/Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
source 'https://rubygems.org'

# You may use http://rbenv.org/ or https://rvm.io/ to install and use this version
ruby File.read(File.join(__dir__, '.ruby-version')).strip

gem 'cocoapods', '~> 1.11', '>= 1.11.3'