From 9d84b851fb232ed9878ec6d303f81e9d8e23a8fe Mon Sep 17 00:00:00 2001 From: Ben Wilson Date: Wed, 27 Nov 2024 17:15:50 +0000 Subject: [PATCH 1/3] Support Expo 52 (#202) * chore: :arrow_up: upgrade dependencies using expo install --fix * chore: :bookmark: update latest supported expo sdk version * update react-native version in test app * update buildkite pipeline * update @react-native-community/netinfo * update expo-constants * test against iOS 16 and iOS 18 (switch to 15 in a future PR) * add android 15 to e2e tests * test: :white_check_mark: enable new arch in test fixture * simplify error boundary test * add id to View component for e2e tests * docs: :memo: update example app to expo 52 --- .buildkite/pipeline.yml | 41 +++++-- examples/expo-52/.gitignore | 38 ++++++ examples/expo-52/App.tsx | 33 ++++++ examples/{expo48 => expo-52}/README.md | 0 examples/expo-52/app.json | 17 +++ examples/{expo48 => expo-52}/babel.config.js | 0 examples/expo-52/components/Button.tsx | 34 ++++++ examples/expo-52/components/Controls.tsx | 32 +++++ examples/expo-52/components/ErrorView.tsx | 23 ++++ examples/expo-52/package.json | 20 ++++ examples/expo-52/tsconfig.json | 15 +++ examples/expo48/.gitignore | 17 --- examples/expo48/App.js | 48 -------- examples/expo48/app.json | 43 ------- examples/expo48/assets/adaptive-icon.png | Bin 17547 -> 0 bytes examples/expo48/assets/favicon.png | Bin 1466 -> 0 bytes examples/expo48/assets/favicon2-96.png | Bin 3284 -> 0 bytes examples/expo48/assets/icon.png | Bin 22380 -> 0 bytes examples/expo48/assets/splash.png | Bin 47346 -> 0 bytes examples/expo48/components/BadButtons.js | 62 ---------- examples/expo48/package.json | 28 ----- features/error_boundary.feature | 13 +- features/fixtures/test-app/app.json | 2 +- .../fixtures/test-app/app/error_boundary.js | 112 +++++------------- features/fixtures/test-app/package.json | 29 +++-- package.json | 11 +- packages/delivery-expo/package.json | 12 +- packages/expo-cli/lib/version-information.js | 2 +- packages/expo/package.json | 6 +- packages/plugin-expo-app/package.json | 8 +- .../package.json | 4 +- packages/plugin-expo-device/package.json | 12 +- 32 files changed, 318 insertions(+), 344 deletions(-) create mode 100644 examples/expo-52/.gitignore create mode 100644 examples/expo-52/App.tsx rename examples/{expo48 => expo-52}/README.md (100%) create mode 100644 examples/expo-52/app.json rename examples/{expo48 => expo-52}/babel.config.js (100%) create mode 100644 examples/expo-52/components/Button.tsx create mode 100644 examples/expo-52/components/Controls.tsx create mode 100644 examples/expo-52/components/ErrorView.tsx create mode 100644 examples/expo-52/package.json create mode 100644 examples/expo-52/tsconfig.json delete mode 100644 examples/expo48/.gitignore delete mode 100644 examples/expo48/App.js delete mode 100644 examples/expo48/app.json delete mode 100644 examples/expo48/assets/adaptive-icon.png delete mode 100644 examples/expo48/assets/favicon.png delete mode 100644 examples/expo48/assets/favicon2-96.png delete mode 100644 examples/expo48/assets/icon.png delete mode 100644 examples/expo48/assets/splash.png delete mode 100644 examples/expo48/components/BadButtons.js delete mode 100644 examples/expo48/package.json diff --git a/.buildkite/pipeline.yml b/.buildkite/pipeline.yml index 8c8a8c5e..f4496137 100644 --- a/.buildkite/pipeline.yml +++ b/.buildkite/pipeline.yml @@ -40,6 +40,33 @@ steps: - bundle install - features/scripts/build-ios.sh + - label: ':runner: expo Android 15' + depends_on: + - "build-expo-apk" + timeout_in_minutes: 50 + plugins: + artifacts#v1.5.0: + download: "build/output.apk" + docker-compose#v3.9.0: + pull: expo-maze-runner + run: expo-maze-runner + use-aliases: true + command: + - --app=build/output.apk + - --farm=bs + - --device=ANDROID_15 + - --a11y-locator + - --fail-fast + - --retry=2 + - --order=random + test-collector#v1.10.2: + files: "reports/TEST-*.xml" + format: "junit" + branch: "^v52$" + concurrency: 5 + concurrency_group: 'browserstack-app' + concurrency_method: eager + - label: ':runner: expo Android 12' depends_on: - "build-expo-apk" @@ -62,12 +89,12 @@ steps: test-collector#v1.10.2: files: "reports/TEST-*.xml" format: "junit" - branch: "^v51$" + branch: "^v52$" concurrency: 5 concurrency_group: 'browserstack-app' concurrency_method: eager - - label: ':runner: expo iOS 16' + - label: ':runner: expo iOS 18' depends_on: - "build-expo-ipa" timeout_in_minutes: 50 @@ -81,7 +108,7 @@ steps: command: - --app=build/output.ipa - --farm=bs - - --device=IOS_16 + - --device=IOS_18 - --a11y-locator - --fail-fast - --retry=2 @@ -89,12 +116,12 @@ steps: test-collector#v1.10.2: files: "reports/TEST-*.xml" format: "junit" - branch: "^v51$" + branch: "^v52$" concurrency: 5 concurrency_group: 'browserstack-app' concurrency_method: eager - - label: ':runner: expo iOS 14' + - label: ':runner: expo iOS 16' depends_on: - "build-expo-ipa" timeout_in_minutes: 50 @@ -108,7 +135,7 @@ steps: command: - --app=build/output.ipa - --farm=bs - - --device=IOS_14 + - --device=IOS_16 - --a11y-locator - --fail-fast - --retry=2 @@ -116,7 +143,7 @@ steps: test-collector#v1.10.2: files: "reports/TEST-*.xml" format: "junit" - branch: "^v51$" + branch: "^v52$" concurrency: 5 concurrency_group: 'browserstack-app' concurrency_method: eager diff --git a/examples/expo-52/.gitignore b/examples/expo-52/.gitignore new file mode 100644 index 00000000..c9d575d7 --- /dev/null +++ b/examples/expo-52/.gitignore @@ -0,0 +1,38 @@ +# Learn more https://docs.github.com/en/get-started/getting-started-with-git/ignoring-files + +# dependencies +node_modules/ + +# Expo +.expo/ +dist/ +web-build/ +expo-env.d.ts + +# Native +*.orig.* +*.jks +*.p8 +*.p12 +*.key +*.mobileprovision + +# Metro +.metro-health-check* + +# debug +npm-debug.* +yarn-debug.* +yarn-error.* + +# macOS +.DS_Store +*.pem + +# local env files +.env*.local + +# typescript +*.tsbuildinfo + +app-example diff --git a/examples/expo-52/App.tsx b/examples/expo-52/App.tsx new file mode 100644 index 00000000..e5bd2d88 --- /dev/null +++ b/examples/expo-52/App.tsx @@ -0,0 +1,33 @@ +import Bugsnag from "@bugsnag/expo"; +import React from "react"; +import { StyleSheet, Text, View } from "react-native"; +import Controls from "./components/Controls"; +import ErrorView from "./components/ErrorView"; + +Bugsnag.start(); + +// Create the error boundary... +const ErrorBoundary = Bugsnag.getPlugin('react').createErrorBoundary(React); + +const onError = (event: any) => { + // callback will only run for errors caught by boundary +} + +export default function Index() { + return ( + + + Expo example app + + + + ) +} + +const styles = StyleSheet.create({ + screenContainer: { + flex: 1, + justifyContent: "center", + alignItems: "center" + } +}); diff --git a/examples/expo48/README.md b/examples/expo-52/README.md similarity index 100% rename from examples/expo48/README.md rename to examples/expo-52/README.md diff --git a/examples/expo-52/app.json b/examples/expo-52/app.json new file mode 100644 index 00000000..879e17fe --- /dev/null +++ b/examples/expo-52/app.json @@ -0,0 +1,17 @@ +{ + "expo": { + "name": "expo-example-52", + "slug": "expo-example-52", + "version": "1.0.0", + "newArchEnabled": true, + "platforms": [ + "ios", + "android" + ], + "extra": { + "bugsnag": { + "apiKey": "API_KEY" + } + } + } +} diff --git a/examples/expo48/babel.config.js b/examples/expo-52/babel.config.js similarity index 100% rename from examples/expo48/babel.config.js rename to examples/expo-52/babel.config.js diff --git a/examples/expo-52/components/Button.tsx b/examples/expo-52/components/Button.tsx new file mode 100644 index 00000000..559a6b98 --- /dev/null +++ b/examples/expo-52/components/Button.tsx @@ -0,0 +1,34 @@ +import { StyleSheet, Text, TouchableOpacity, View } from 'react-native'; + +interface Props { + onPress: () => void + title: string +} + +const Button: React.FunctionComponent = ({ onPress, title }) => ( + + + {title} + + +); + +export default Button + +const styles = StyleSheet.create({ + button: { + backgroundColor: '#003366', + borderRadius: 4, + paddingVertical: 10, + paddingHorizontal: 25, + }, + text: { + fontSize: 16, + lineHeight: 21, + letterSpacing: 0.25, + color: 'white', + }, + buttonContainer: { + paddingVertical: 10, + } +}); diff --git a/examples/expo-52/components/Controls.tsx b/examples/expo-52/components/Controls.tsx new file mode 100644 index 00000000..db01f714 --- /dev/null +++ b/examples/expo-52/components/Controls.tsx @@ -0,0 +1,32 @@ +import Bugsnag from '@bugsnag/expo'; +import React from 'react'; +import { View } from 'react-native'; +import Button from './Button'; + +function unhandledError() { + throw new Error('Unhandled error!'); +} + +function handledError() { + Bugsnag.notify(new Error('Handled error!')); +} + +const Controls = () => { + const [yeah, setYeah] = React.useState(false); + + const triggerRenderError = () => { + setYeah(true) + } + + return ( + +