Skip to content

Commit 942a8fa

Browse files
committed
Merge branch 'main' into @mbert/docs-components
2 parents 2e99678 + 89a984d commit 942a8fa

59 files changed

Lines changed: 761 additions & 221 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.eslintrc.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@
4545
"@typescript-eslint/ban-types": "warn",
4646
"@typescript-eslint/consistent-type-imports": "error",
4747
"@typescript-eslint/consistent-type-exports": "error",
48+
"@typescript-eslint/no-unsafe-enum-comparison": "off",
4849

4950
// common
5051
"@typescript-eslint/explicit-module-boundary-types": "off",

.github/workflows/android-build.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ on:
66
- .github/workflows/android-build.yml
77
- packages/react-native-gesture-handler/android/**
88
- apps/basic-example/android/**
9+
- apps/basic-example/package.json
10+
- rnrepo.config.json
11+
- yarn.lock
912
push:
1013
branches:
1114
- main
@@ -45,4 +48,4 @@ jobs:
4548

4649
- name: Build app
4750
working-directory: ${{ matrix.working-directory }}/android
48-
run: ./gradlew assembleDebug --console=plain -PreactNativeArchitectures=arm64-v8a
51+
run: ./gradlew :app:assembleDebug --console=plain -PreactNativeArchitectures=arm64-v8a

.github/workflows/ios-build.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ on:
77
- packages/react-native-gesture-handler/RNGestureHandler.podspec
88
- packages/react-native-gesture-handler/apple/**
99
- apps/basic-example/ios/**
10+
- apps/basic-example/package.json
11+
- rnrepo.config.json
12+
- yarn.lock
1013
push:
1114
branches:
1215
- main

apps/basic-example/android/app/build.gradle

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,21 @@ apply plugin: "com.android.application"
22
apply plugin: "org.jetbrains.kotlin.android"
33
apply plugin: "com.facebook.react"
44

5+
def isCIEnabled() {
6+
return ["1", "true"].contains(System.getenv("CI")?.toLowerCase())
7+
}
8+
9+
def isRNRepoEnabled() {
10+
// return false // Uncomment to disable RNRepo locally
11+
return System.getenv("DISABLE_RNREPO") == null
12+
}
13+
14+
// Use RNRepo in CI builds.
15+
// Set DISABLE_RNREPO to any value to disable RNRepo.
16+
if (isCIEnabled() && isRNRepoEnabled()) {
17+
apply plugin: "org.rnrepo.tools.prebuilds-plugin"
18+
}
19+
520
/**
621
* This is the configuration block to customize your React Native Android app.
722
* By default you don't need to apply any configuration, just uncomment the lines you need.

apps/basic-example/android/build.gradle

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,22 @@ buildscript {
1212
google()
1313
mavenCentral()
1414
}
15+
// RNRepo plugin classpath for CI builds (plugin applied in app/build.gradle).
16+
// To disable RNRepo support, set DISABLE_RNREPO environment variable to ANY value.
17+
def rnrepoClasspath = {
18+
def rnrepoDir = new File(
19+
providers.exec {
20+
workingDir(rootDir)
21+
commandLine("node", "--print", "require.resolve('@rnrepo/build-tools/package.json')")
22+
}.standardOutput.asText.get().trim()
23+
).getParentFile().absolutePath
24+
return fileTree(dir: "${rnrepoDir}/gradle-plugin/build/libs", include: ["prebuilds-plugin.jar"])
25+
}
1526
dependencies {
1627
classpath("com.android.tools.build:gradle")
1728
classpath("com.facebook.react:react-native-gradle-plugin")
1829
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin")
30+
classpath rnrepoClasspath()
1931
}
2032
allprojects {
2133
project.pluginManager.withPlugin("com.facebook.react") {

apps/basic-example/ios/Podfile

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,24 @@ require Pod::Executable.execute_command('node', ['-p',
55
{paths: ["../../../node_modules"]},
66
)', __dir__]).strip
77

8+
def is_ci_enabled?
9+
%w[1 true].include?(ENV['CI'].to_s.downcase)
10+
end
11+
12+
# ENV['DISABLE_RNREPO'] = "1" # Uncomment to disable RNRepo even in CI
13+
def is_rnrepo_enabled?
14+
ENV['DISABLE_RNREPO'].nil?
15+
end
16+
17+
# Use RNRepo in CI builds. Set DISABLE_RNREPO to any value to disable RNRepo.
18+
if is_ci_enabled? && is_rnrepo_enabled?
19+
require Pod::Executable.execute_command('node', ['-p',
20+
'require.resolve(
21+
"@rnrepo/build-tools/cocoapods-plugin/lib/plugin.rb",
22+
{paths: [process.argv[1]]},
23+
)', __dir__]).strip
24+
end
25+
826
require_relative '../../../scripts/clangd-add-xcode-step.rb'
927

1028
ENV['GH_EXAMPLE_APP_NAME'] = 'BasicExample'
@@ -28,6 +46,9 @@ target 'BasicExample' do
2846
)
2947

3048
post_install do |installer|
49+
if is_ci_enabled? && is_rnrepo_enabled?
50+
rnrepo_post_install(installer)
51+
end
3152
react_native_post_install(
3253
installer,
3354
config[:reactNativePath],

apps/basic-example/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
"@react-native/jest-preset": "0.85.0",
3636
"@react-native/metro-config": "0.85.0",
3737
"@react-native/typescript-config": "0.85.0",
38+
"@rnrepo/build-tools": "~0.1.3-beta.0",
3839
"@types/jest": "^29.5.13",
3940
"@types/react": "^19.2.0",
4041
"@types/react-test-renderer": "^19.1.0",

apps/common-app/App.tsx

Lines changed: 25 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
/* eslint-disable @eslint-react/no-nested-component-definitions */
2+
/* eslint-disable @eslint-react/no-nested-components */
13
import AsyncStorage from '@react-native-async-storage/async-storage';
24
import type { ParamListBase } from '@react-navigation/native';
35
import { NavigationContainer } from '@react-navigation/native';
@@ -11,8 +13,8 @@ import { useEffect, useState } from 'react';
1113
import { Dimensions, Platform, StyleSheet, Text, View } from 'react-native';
1214
import {
1315
GestureHandlerRootView,
14-
RectButton,
1516
Switch,
17+
Touchable,
1618
} from 'react-native-gesture-handler';
1719
import { useSafeAreaInsets } from 'react-native-safe-area-context';
1820

@@ -123,7 +125,7 @@ export default function App() {
123125
<MainScreenItem
124126
name={item.name}
125127
onPressItem={(name) => navigate(navigation, name)}
126-
enabled={!item.unsupportedPlatforms?.has(Platform.OS)}
128+
disabled={!!item.unsupportedPlatforms?.has(Platform.OS)}
127129
/>
128130
)}
129131
renderSectionHeader={({ section: { sectionTitle } }) => (
@@ -156,7 +158,9 @@ export default function App() {
156158
}
157159
return (
158160
<View style={styles.settings}>
159-
<RectButton
161+
<Touchable
162+
androidRipple={{}}
163+
activeUnderlayOpacity={Platform.OS !== 'android' ? 0.1 : 0}
160164
style={styles.settingsButton}
161165
onPress={() => {
162166
updateKeepSetting(!openLastExample);
@@ -175,8 +179,10 @@ export default function App() {
175179
}}
176180
/>
177181
</View>
178-
</RectButton>
179-
<RectButton
182+
</Touchable>
183+
<Touchable
184+
androidRipple={{}}
185+
activeUnderlayOpacity={Platform.OS !== 'android' ? 0.1 : 0}
180186
style={styles.settingsButton}
181187
onPress={() => {
182188
updateVersionSetting(!showLegacyVersion);
@@ -195,28 +201,34 @@ export default function App() {
195201
}}
196202
/>
197203
</View>
198-
</RectButton>
204+
</Touchable>
199205
</View>
200206
);
201207
}
202208

203209
interface MainScreenItemProps {
204210
name: string;
205211
onPressItem: (name: string) => void;
206-
enabled: boolean;
212+
disabled: boolean;
207213
}
208214

209-
function MainScreenItem({ name, onPressItem, enabled }: MainScreenItemProps) {
215+
function MainScreenItem({
216+
name,
217+
onPressItem,
218+
disabled,
219+
}: MainScreenItemProps) {
210220
return (
211-
<RectButton
212-
enabled={enabled}
213-
style={[styles.button, !enabled && styles.unavailableExample]}
221+
<Touchable
222+
disabled={disabled}
223+
style={[styles.button, disabled && styles.unavailableExample]}
224+
androidRipple={{}}
225+
activeUnderlayOpacity={Platform.OS !== 'android' ? 0.1 : 0}
214226
onPress={() => onPressItem(name)}>
215227
<Text style={styles.text}>{name}</Text>
216-
{Platform.OS !== 'macos' && enabled && (
228+
{Platform.OS !== 'macos' && !disabled && (
217229
<Icon name="chevron-small-right" size={24} color="#bbb" />
218230
)}
219-
</RectButton>
231+
</Touchable>
220232
);
221233
}
222234
}

apps/common-app/src/new_api/tests/nestedTouchables/index.tsx

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ export default function NestedTouchablesExample() {
1212
const [log, setLog] = useState<string[]>([]);
1313

1414
const pushLog = (message: string) => {
15+
console.log(message);
1516
setLog((prev) =>
1617
[...prev, `[${new Date().toLocaleTimeString()}] ${message}`].slice(-6)
1718
);
@@ -20,11 +21,13 @@ export default function NestedTouchablesExample() {
2021
const outerTap = useTapGesture({
2122
runOnJS: true,
2223
onActivate: () => pushLog('outer tap gesture'),
24+
testID: 'outer-tap',
2325
});
2426

2527
const innerTap = useTapGesture({
2628
runOnJS: true,
2729
onActivate: () => pushLog('inner tap gesture'),
30+
testID: 'inner-tap',
2831
});
2932

3033
return (
@@ -40,6 +43,11 @@ export default function NestedTouchablesExample() {
4043

4144
<Touchable
4245
style={[styles.layer, styles.outerTouchable]}
46+
testID="outer-touchable"
47+
activeUnderlayOpacity={0.3}
48+
onPressIn={() => pushLog('outer press in')}
49+
onPressOut={() => pushLog('outer press out')}
50+
onLongPress={() => pushLog('outer long press')}
4351
onPress={() => pushLog('outer Touchable')}>
4452
<Text style={styles.layerLabel}>Outer Touchable</Text>
4553

@@ -49,6 +57,11 @@ export default function NestedTouchablesExample() {
4957

5058
<Touchable
5159
style={[styles.layer, styles.innerTouchable]}
60+
testID="inner-touchable"
61+
activeUnderlayOpacity={0.3}
62+
onPressIn={() => pushLog('inner press in')}
63+
onPressOut={() => pushLog('inner press out')}
64+
onLongPress={() => pushLog('inner long press')}
5265
onPress={() => pushLog('inner Touchable')}>
5366
<Text style={styles.layerLabel}>Inner Touchable</Text>
5467
</Touchable>

apps/expo-example/app.config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ export default {
4646
],
4747
},
4848
],
49+
"@rnrepo/expo-config-plugin",
4950
],
5051
},
5152
};

0 commit comments

Comments
 (0)