From 865c286f4d205fe74d8c6524e6570f30b9cc1f67 Mon Sep 17 00:00:00 2001 From: Vojtech Novak Date: Mon, 28 Jul 2025 15:19:21 +0200 Subject: [PATCH 1/5] chore: add eas build workflow 2 --- .eas/workflows/build-eas.yml | 58 ++++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 .eas/workflows/build-eas.yml diff --git a/.eas/workflows/build-eas.yml b/.eas/workflows/build-eas.yml new file mode 100644 index 0000000..6370ce4 --- /dev/null +++ b/.eas/workflows/build-eas.yml @@ -0,0 +1,58 @@ +name: build + +on: + push: + branches: ['*'] + +jobs: + create-expo-app: + steps: + - uses: eas/checkout # to access the test-screen.tsx file later. This also changes cwd + - name: create a fresh app + run: | + cd .. + echo 'pwd:' + pwd + yarn create expo-app theme-expo-example --no-install --yes --template expo-template-default@sdk-53 + touch theme-expo-example/yarn.lock # make yarn treat theme-expo-example as a completely separate project + - name: Insert our test screen into the app + run: | + cd .. + echo 'pwd:' + pwd + cp example/src/test-screen.tsx "theme-expo-example/app/(tabs)/index.tsx" + cat "theme-expo-example/app/(tabs)/index.tsx" + + - name: Merge app.json with the tested package's app.json + run: | + pwd + cd ../theme-expo-example + jq '.expo.plugins += ["@vonovak/react-native-theme-control"]' app.json > app.json.tmp && mv app.json.tmp app.json + jq -s '.[0] * .[1]' app.json ../example/test-app.json > app.json.tmp && mv app.json.tmp app.json + cat app.json + + - name: Install app dependencies and the tested package + run: | + cd ../theme-expo-example + yarn add @vonovak/react-native-theme-control + yarn remove expo-system-ui + + - name: Run expo prebuild + run: | + cd ../theme-expo-example + EXPO_DEBUG=1 npx expo prebuild + + - name: Bundle JS code to verify it builds + run: | + cd ../theme-expo-example + pwd + npx expo export + + build_android: + needs: [create-expo-app] + defaults: + run: + working_directory: ./theme-expo-example + steps: + - name: Build Android + run: eas build --platform android --profile production From 77e7afa2c7a256c5c74957770026606091e11265 Mon Sep 17 00:00:00 2001 From: Vojtech Novak Date: Mon, 28 Jul 2025 17:26:51 +0200 Subject: [PATCH 2/5] chore: different workflow approach --- .eas/workflows/build-eas.yml | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/.eas/workflows/build-eas.yml b/.eas/workflows/build-eas.yml index 6370ce4..789ef4d 100644 --- a/.eas/workflows/build-eas.yml +++ b/.eas/workflows/build-eas.yml @@ -42,11 +42,13 @@ jobs: cd ../theme-expo-example EXPO_DEBUG=1 npx expo prebuild - - name: Bundle JS code to verify it builds - run: | - cd ../theme-expo-example - pwd - npx expo export +# fails: https://expo.dev/accounts/expo-ci/projects/theme-expo-example/workflows/0198513c-5cfe-7cf9-aaf4-f793c646cc58 +# also fails locally but with a different error +# - name: Bundle JS code to verify it builds +# run: | +# cd ../theme-expo-example +# pwd +# npx expo export build_android: needs: [create-expo-app] From 7b542e12c218d274737427e91cd2065551a04d0d Mon Sep 17 00:00:00 2001 From: Vojtech Novak Date: Tue, 12 Aug 2025 17:45:02 +0200 Subject: [PATCH 3/5] fix: add default metro config --- .eas/workflows/build-eas.yml | 30 +++++++++++++++++------------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/.eas/workflows/build-eas.yml b/.eas/workflows/build-eas.yml index 789ef4d..4eb51c0 100644 --- a/.eas/workflows/build-eas.yml +++ b/.eas/workflows/build-eas.yml @@ -15,6 +15,7 @@ jobs: pwd yarn create expo-app theme-expo-example --no-install --yes --template expo-template-default@sdk-53 touch theme-expo-example/yarn.lock # make yarn treat theme-expo-example as a completely separate project + - name: Insert our test screen into the app run: | cd .. @@ -37,24 +38,27 @@ jobs: yarn add @vonovak/react-native-theme-control yarn remove expo-system-ui + - name: Create default metro config to avoid bundling issues (may not be needed for all projects) + run: | + cd ../theme-expo-example + npx expo customize metro.config.js + - name: Run expo prebuild run: | cd ../theme-expo-example EXPO_DEBUG=1 npx expo prebuild -# fails: https://expo.dev/accounts/expo-ci/projects/theme-expo-example/workflows/0198513c-5cfe-7cf9-aaf4-f793c646cc58 -# also fails locally but with a different error -# - name: Bundle JS code to verify it builds -# run: | -# cd ../theme-expo-example -# pwd -# npx expo export + - name: Bundle JS code to verify it builds + run: | + cd ../theme-expo-example + pwd + npx expo export - build_android: - needs: [create-expo-app] +# this is wrong + build_app_android: defaults: run: - working_directory: ./theme-expo-example - steps: - - name: Build Android - run: eas build --platform android --profile production + working_directory: ../theme-expo-example + type: build + params: + platform: android From 9b2be1fa0713c1066857ac99207b9b85c11abf35 Mon Sep 17 00:00:00 2001 From: Vojtech Novak Date: Wed, 13 Aug 2025 08:52:36 +0200 Subject: [PATCH 4/5] chore: copy eas json --- .eas/workflows/build-eas.yml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/.eas/workflows/build-eas.yml b/.eas/workflows/build-eas.yml index 4eb51c0..d7a70e7 100644 --- a/.eas/workflows/build-eas.yml +++ b/.eas/workflows/build-eas.yml @@ -32,6 +32,11 @@ jobs: jq -s '.[0] * .[1]' app.json ../example/test-app.json > app.json.tmp && mv app.json.tmp app.json cat app.json + - name: Put eas.json into the test app to allow building with EAS + run: | + cp test-eas.json ../theme-expo-example/eas.json + cat ../theme-expo-example/eas.json + - name: Install app dependencies and the tested package run: | cd ../theme-expo-example @@ -54,8 +59,9 @@ jobs: pwd npx expo export -# this is wrong + # this is wrong build_app_android: + needs: [create-expo-app] defaults: run: working_directory: ../theme-expo-example From 9413b25062ce8260c6a740799f13c2ffc5063aba Mon Sep 17 00:00:00 2001 From: Vojtech Novak Date: Wed, 13 Aug 2025 08:55:35 +0200 Subject: [PATCH 5/5] chore: add necessary files --- example/app.json | 9 ++- example/src/test-screen.tsx | 107 ++++++++++++++++++++++++++++++++++++ example/test-app.json | 10 ++++ example/test-eas.json | 21 +++++++ 4 files changed, 146 insertions(+), 1 deletion(-) create mode 100644 example/src/test-screen.tsx create mode 100644 example/test-app.json create mode 100644 example/test-eas.json diff --git a/example/app.json b/example/app.json index 761b0b1..6023fe3 100644 --- a/example/app.json +++ b/example/app.json @@ -17,6 +17,13 @@ }, "android": { "package": "com.vonovak.themeexpoexample" - } + }, + "//comment": "this is here so eas workflow:run can be executed locally", + "extra": { + "eas": { + "projectId": "348a68a7-b896-4172-ae18-64e4afc32413" + } + }, + "owner": "expo-ci" } } diff --git a/example/src/test-screen.tsx b/example/src/test-screen.tsx new file mode 100644 index 0000000..1e853f3 --- /dev/null +++ b/example/src/test-screen.tsx @@ -0,0 +1,107 @@ +import * as React from 'react'; + +import { + StyleSheet, + Text, + Button, + useColorScheme, + View, + Switch, + ColorValue, +} from 'react-native'; +import { + setThemePreference, + SystemBars, + useThemePreference, +} from '@vonovak/react-native-theme-control'; + +type Props = { + barsBackground: ColorValue; + textColor: ColorValue; + dividerColor?: ColorValue; + bgColor: ColorValue; +}; + +export default function Screen({ + barsBackground, + textColor, + bgColor, + dividerColor, +}: Props) { + const colorScheme = useColorScheme(); + const [persistTheme, togglePersistTheme] = React.useReducer( + (state: boolean) => !state, + true, + ); + const themePreference = useThemePreference(); + + const textColorStyle = { color: textColor }; + + return ( + + +