Skip to content

Commit 780a7bb

Browse files
authored
[Monorepo] Add PAPER_ENABLED env variable (#3510)
## Description This PR adds `PAPER_ENABLED` environmental variable in order to easily switch to old architecture in `ExpoExample`. It also adds CIs that test paper build on both platforms. ## Test plan Verified in `App.tsx` with the following snippet: ```jsx const uiManager = global?.nativeFabricUIManager ? 'Fabric' : 'Paper'; console.log(`Using ${uiManager}`); ``` Check that CIs pass.
1 parent 16ed1f3 commit 780a7bb

7 files changed

Lines changed: 175 additions & 103 deletions

File tree

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: Test Android build (Paper)
2+
on:
3+
pull_request:
4+
paths:
5+
- '.github/workflows/android-build-paper.yml'
6+
- 'packages/react-native-gesture-handler/android/**'
7+
push:
8+
branches:
9+
- main
10+
workflow_dispatch:
11+
jobs:
12+
build:
13+
if: github.repository == 'software-mansion/react-native-gesture-handler'
14+
runs-on: ubuntu-latest
15+
env:
16+
WORKING_DIRECTORY: 'apps/ExpoExample'
17+
steps:
18+
- name: checkout
19+
uses: actions/checkout@v4
20+
- name: Use Java 17
21+
uses: actions/setup-java@v4
22+
with:
23+
distribution: 'oracle'
24+
java-version: '17'
25+
- name: Use Node.js 18
26+
uses: actions/setup-node@v4
27+
with:
28+
node-version: 18
29+
cache: 'yarn'
30+
- name: Install node dependencies
31+
working-directory: ${{ env.WORKING_DIRECTORY }}
32+
run: PAPER_ENABLED=1 yarn install --immutable
33+
- name: Build app
34+
working-directory: ${{ env.WORKING_DIRECTORY }}/android
35+
run: ./gradlew assembleDebug --console=plain -PreactNativeArchitectures=arm64-v8a

.github/workflows/check-archs-consistency.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,4 @@ jobs:
3030
- name: Install node dependencies
3131
run: yarn
3232
- name: Check Android Paper & Fabric generated interfaces consistency
33-
run: yarn architectures-consistency-check
33+
run: yarn workspace react-native-gesture-handler architectures-consistency-check
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: Test iOS build (paper)
2+
on:
3+
pull_request:
4+
paths:
5+
- '.github/workflows/ios-build-paper.yml'
6+
- 'packages/react-native-gesture-handler/RNGestureHandler.podspec'
7+
- 'packages/react-native-gesture-handler/apple/**'
8+
push:
9+
branches:
10+
- main
11+
workflow_dispatch:
12+
jobs:
13+
build:
14+
if: github.repository == 'software-mansion/react-native-gesture-handler'
15+
runs-on: macos-14
16+
env:
17+
WORKING_DIRECTORY: 'apps/ExpoExample'
18+
steps:
19+
- name: checkout
20+
uses: actions/checkout@v4
21+
- name: Use latest stable Xcode
22+
uses: maxim-lobanov/setup-xcode@v1
23+
with:
24+
xcode-version: '16.1'
25+
- name: Use Node.js 18
26+
uses: actions/setup-node@v4
27+
with:
28+
node-version: 18
29+
cache: 'yarn'
30+
- name: Install node dependencies
31+
working-directory: ${{ env.WORKING_DIRECTORY }}
32+
run: PAPER_ENABLED=1 yarn install --immutable
33+
- name: Build app
34+
working-directory: ${{ env.WORKING_DIRECTORY }}
35+
run: npx react-native run-ios

.github/workflows/static-root-checks.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,4 +35,4 @@ jobs:
3535
run: yarn lint-js
3636
- name: Check for circular dependencies
3737
working-directory: ${{ env.WORKING_DIRECTORY }}
38-
run: yarn circular-dependency-check
38+
run: yarn workspace react-native-gesture-handler circular-dependency-check

apps/ExpoExample/app.config.js

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
const shouldEnablePaper = process.env.PAPER_ENABLED === '1';
2+
3+
export default {
4+
expo: {
5+
name: 'ExpoExample',
6+
slug: 'ExpoExample',
7+
version: '1.0.0',
8+
orientation: 'portrait',
9+
icon: './assets/icon.png',
10+
userInterfaceStyle: 'light',
11+
newArchEnabled: !shouldEnablePaper,
12+
splash: {
13+
image: './assets/splash.png',
14+
resizeMode: 'cover',
15+
backgroundColor: '#F8F9FF',
16+
},
17+
ios: {
18+
supportsTablet: true,
19+
bundleIdentifier: 'com.example.ExpoExample',
20+
buildNumber: '1',
21+
},
22+
android: {
23+
versionCode: 1,
24+
adaptiveIcon: {
25+
foregroundImage: './assets/adaptive-icon.png',
26+
backgroundColor: '#F8F9FF',
27+
},
28+
edgeToEdgeEnabled: true,
29+
package: 'com.example.ExpoExample',
30+
},
31+
web: {
32+
favicon: './assets/favicon.png',
33+
},
34+
plugins: [
35+
[
36+
'expo-camera',
37+
{
38+
cameraPermission: 'Allow RNGH example to access your camera',
39+
},
40+
],
41+
[
42+
'expo-font',
43+
{
44+
fonts: [
45+
'./node_modules/@swmansion/icons/fonts/broken/swm-icons-broken.ttf',
46+
'./node_modules/@swmansion/icons/fonts/outline/swm-icons-outline.ttf',
47+
'./node_modules/@swmansion/icons/fonts/curved/swm-icons-curved.ttf',
48+
],
49+
},
50+
],
51+
],
52+
},
53+
};

apps/ExpoExample/app.json

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

0 commit comments

Comments
 (0)