Skip to content
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
548 changes: 548 additions & 0 deletions .yarn/patches/react-native-npm-0.76.9-1c25352097.patch

Large diffs are not rendered by default.

10 changes: 10 additions & 0 deletions android/settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -42,5 +42,15 @@ includeBuild('../node_modules/@react-native') {}
include ':react-native-gesture-handler'
project(':react-native-gesture-handler').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-gesture-handler/android')

// Build react-native from source instead of using prebuilded version
includeBuild('../node_modules/react-native') {
dependencySubstitution {
substitute(module("com.facebook.react:react-android")).using(project(":packages:react-native:ReactAndroid"))
substitute(module("com.facebook.react:react-native")).using(project(":packages:react-native:ReactAndroid"))
substitute(module("com.facebook.react:hermes-android")).using(project(":packages:react-native:ReactAndroid:hermes-engine"))
substitute(module("com.facebook.react:hermes-engine")).using(project(":packages:react-native:ReactAndroid:hermes-engine"))
}
}

apply from: new File(["node", "--print", "require.resolve('expo/package.json')"].execute(null, rootDir).text.trim(), "../scripts/autolinking.gradle")
useExpoModules()
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import {
DEFAULT_BUTTONBASE_LABEL_TEXTVARIANT,
} from './ButtonBase.constants';
import {
Pressable,
Gesture,
GestureDetector,
type GestureStateChangeEvent,
Expand All @@ -43,90 +44,14 @@ export const TouchableOpacity = ({
// Handle both 'disabled' and 'isDisabled' props for compatibility
const isDisabled = disabled || (props as { isDisabled?: boolean }).isDisabled;

// Track accessibility state - start with null to indicate "unknown"
const [isAccessibilityEnabled, setIsAccessibilityEnabled] = useState<
boolean | null
>(null);

useEffect(() => {
// Check initial accessibility state
AccessibilityInfo.isScreenReaderEnabled().then(setIsAccessibilityEnabled);

// Listen for accessibility changes
const subscription = AccessibilityInfo.addEventListener(
'screenReaderChanged',
setIsAccessibilityEnabled,
);

return () => subscription?.remove();
}, []);

// Gesture detection for ScrollView compatibility on Android
const tap = Gesture.Tap()
.runOnJS(true)
.shouldCancelWhenOutside(false)
.maxDeltaX(20) // Allow some movement while tapping
.maxDeltaY(20)
.requireExternalGestureToFail() // Wait for other gestures to fail before activating
.maxDuration(300) // Tight constraint: must complete within 300ms
.minPointers(1)
.onEnd(
(
gestureEvent: GestureStateChangeEvent<TapGestureHandlerEventPayload>,
) => {
// Only handle gesture when we KNOW accessibility is OFF
// When accessibility is ON or UNKNOWN, let TouchableOpacity handle the press
if (onPress && !isDisabled && isAccessibilityEnabled === false) {
// Create a proper GestureResponderEvent-like object from gesture event
const syntheticEvent = {
nativeEvent: {
locationX: gestureEvent.x || 0,
locationY: gestureEvent.y || 0,
pageX: gestureEvent.absoluteX || 0,
pageY: gestureEvent.absoluteY || 0,
timestamp: Date.now(),
},
persist: () => {
/* no-op for synthetic event */
},
preventDefault: () => {
/* no-op for synthetic event */
},
stopPropagation: () => {
/* no-op for synthetic event */
},
} as GestureResponderEvent;

onPress(syntheticEvent);
}
},
);

// In test environments, behave like standard TouchableOpacity
if (process.env.NODE_ENV === 'test') {
return (
<RNTouchableOpacity
disabled={isDisabled}
onPress={isDisabled ? undefined : onPress}
{...props}
>
{children}
</RNTouchableOpacity>
);
}

return (
<GestureDetector gesture={tap}>
<RNTouchableOpacity
disabled={isDisabled}
onPress={
isAccessibilityEnabled !== false && !isDisabled ? onPress : undefined
} // Use TouchableOpacity onPress when accessibility is ON or UNKNOWN (safer for accessibility users)
{...props}
>
{children}
</RNTouchableOpacity>
</GestureDetector>
<RNTouchableOpacity
disabled={isDisabled}
onPress={isDisabled ? undefined : onPress}
{...props}
>
{children}
</RNTouchableOpacity>
);
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,90 +37,14 @@ const TouchableOpacity = ({
}) => {
const isDisabled = disabled || (props as { isDisabled?: boolean }).isDisabled;

// Track accessibility state - start with null to indicate "unknown"
const [isAccessibilityEnabled, setIsAccessibilityEnabled] = useState<
boolean | null
>(null);

useEffect(() => {
// Check initial accessibility state
AccessibilityInfo.isScreenReaderEnabled().then(setIsAccessibilityEnabled);

// Listen for accessibility changes
const subscription = AccessibilityInfo.addEventListener(
'screenReaderChanged',
setIsAccessibilityEnabled,
);

return () => subscription?.remove();
}, []);

// Gesture detection for ScrollView compatibility on Android
const tap = Gesture.Tap()
.runOnJS(true)
.shouldCancelWhenOutside(false)
.maxDeltaX(20) // Allow some movement while tapping
.maxDeltaY(20)
.requireExternalGestureToFail() // Wait for other gestures to fail before activating
.maxDuration(300) // Tight constraint: must complete within 300ms
.minPointers(1)
.onEnd(
(
gestureEvent: GestureStateChangeEvent<TapGestureHandlerEventPayload>,
) => {
// Only handle gesture when we KNOW accessibility is OFF
// When accessibility is ON or UNKNOWN, let TouchableOpacity handle the press
if (onPress && !isDisabled && isAccessibilityEnabled === false) {
// Create a proper GestureResponderEvent-like object from gesture event
const syntheticEvent = {
nativeEvent: {
locationX: gestureEvent.x || 0,
locationY: gestureEvent.y || 0,
pageX: gestureEvent.absoluteX || 0,
pageY: gestureEvent.absoluteY || 0,
timestamp: Date.now(),
},
persist: () => {
/* no-op for synthetic event */
},
preventDefault: () => {
/* no-op for synthetic event */
},
stopPropagation: () => {
/* no-op for synthetic event */
},
} as GestureResponderEvent;

onPress(syntheticEvent);
}
},
);

// In test environments, behave like standard TouchableOpacity
if (process.env.NODE_ENV === 'test') {
return (
<RNTouchableOpacity
disabled={isDisabled}
onPress={isDisabled ? undefined : onPress}
{...props}
>
{children}
</RNTouchableOpacity>
);
}

return (
<GestureDetector gesture={tap}>
<RNTouchableOpacity
disabled={isDisabled}
onPress={
isAccessibilityEnabled !== false && !isDisabled ? onPress : undefined
} // Use TouchableOpacity onPress when accessibility is ON or UNKNOWN (safer for accessibility users)
{...props}
>
{children}
</RNTouchableOpacity>
</GestureDetector>
<RNTouchableOpacity
disabled={isDisabled}
onPress={isDisabled ? undefined : onPress}
{...props}
>
{children}
</RNTouchableOpacity>
);
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,90 +36,14 @@ const TouchableOpacity = ({
}) => {
const isDisabled = disabled || (props as { isDisabled?: boolean }).isDisabled;

// Track accessibility state - start with null to indicate "unknown"
const [isAccessibilityEnabled, setIsAccessibilityEnabled] = useState<
boolean | null
>(null);

useEffect(() => {
// Check initial accessibility state
AccessibilityInfo.isScreenReaderEnabled().then(setIsAccessibilityEnabled);

// Listen for accessibility changes
const subscription = AccessibilityInfo.addEventListener(
'screenReaderChanged',
setIsAccessibilityEnabled,
);

return () => subscription?.remove();
}, []);

// Gesture detection for ScrollView compatibility on Android
const tap = Gesture.Tap()
.runOnJS(true)
.shouldCancelWhenOutside(false)
.maxDeltaX(20) // Allow some movement while tapping
.maxDeltaY(20)
.requireExternalGestureToFail() // Wait for other gestures to fail before activating
.maxDuration(300) // Tight constraint: must complete within 300ms
.minPointers(1)
.onEnd(
(
gestureEvent: GestureStateChangeEvent<TapGestureHandlerEventPayload>,
) => {
// Only handle gesture when we KNOW accessibility is OFF
// When accessibility is ON or UNKNOWN, let TouchableOpacity handle the press
if (onPress && !isDisabled && isAccessibilityEnabled === false) {
// Create a proper GestureResponderEvent-like object from gesture event
const syntheticEvent = {
nativeEvent: {
locationX: gestureEvent.x || 0,
locationY: gestureEvent.y || 0,
pageX: gestureEvent.absoluteX || 0,
pageY: gestureEvent.absoluteY || 0,
timestamp: Date.now(),
},
persist: () => {
/* no-op for synthetic event */
},
preventDefault: () => {
/* no-op for synthetic event */
},
stopPropagation: () => {
/* no-op for synthetic event */
},
} as GestureResponderEvent;

onPress(syntheticEvent);
}
},
);

// In test environments, behave like standard TouchableOpacity
if (process.env.NODE_ENV === 'test') {
return (
<RNTouchableOpacity
disabled={isDisabled}
onPress={isDisabled ? undefined : onPress}
{...props}
>
{children}
</RNTouchableOpacity>
);
}

return (
<GestureDetector gesture={tap}>
<RNTouchableOpacity
disabled={isDisabled}
onPress={
isAccessibilityEnabled !== false && !isDisabled ? onPress : undefined
} // Use TouchableOpacity onPress when accessibility is ON or UNKNOWN (safer for accessibility users)
{...props}
>
{children}
</RNTouchableOpacity>
</GestureDetector>
<RNTouchableOpacity
disabled={isDisabled}
onPress={isDisabled ? undefined : onPress}
{...props}
>
{children}
</RNTouchableOpacity>
);
};

Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -185,8 +185,8 @@
"appwright@^0.1.45": "patch:appwright@npm%3A0.1.45#./.yarn/patches/appwright-npm-0.1.45-f282bc1c1b.patch",
"@scure/bip32": "1.7.0",
"@metamask/snaps-sdk": "^10.0.0",
"@metamask/bridge-status-controller@^47.2.0": "patch:@metamask/bridge-status-controller@npm%3A47.2.0#./.yarn/patches/@metamask-bridge-status-controller-npm-47.2.0-1c8660e896.patch",
"@metamask/bridge-status-controller@^50.0.0": "patch:@metamask/bridge-status-controller@npm%3A50.1.0#./.yarn/patches/@metamask-bridge-status-controller-npm-50.1.0-308ed9262e.patch"
"@metamask/bridge-status-controller@^50.0.0": "patch:@metamask/bridge-status-controller@npm%3A50.1.0#./.yarn/patches/@metamask-bridge-status-controller-npm-50.1.0-308ed9262e.patch",
"react-native@0.76.9": "patch:react-native@npm%3A0.76.9#./.yarn/patches/react-native-npm-0.76.9-1c25352097.patch"
},
"dependencies": {
"@config-plugins/detox": "^9.0.0",
Expand Down
54 changes: 54 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -39572,6 +39572,60 @@ __metadata:
languageName: node
linkType: hard

"react-native@patch:react-native@npm%3A0.76.9#./.yarn/patches/react-native-npm-0.76.9-1c25352097.patch::locator=metamask%40workspace%3A.":
version: 0.76.9
resolution: "react-native@patch:react-native@npm%3A0.76.9#./.yarn/patches/react-native-npm-0.76.9-1c25352097.patch::version=0.76.9&hash=6e8fb2&locator=metamask%40workspace%3A."
dependencies:
"@jest/create-cache-key-function": "npm:^29.6.3"
"@react-native/assets-registry": "npm:0.76.9"
"@react-native/codegen": "npm:0.76.9"
"@react-native/community-cli-plugin": "npm:0.76.9"
"@react-native/gradle-plugin": "npm:0.76.9"
"@react-native/js-polyfills": "npm:0.76.9"
"@react-native/normalize-colors": "npm:0.76.9"
"@react-native/virtualized-lists": "npm:0.76.9"
abort-controller: "npm:^3.0.0"
anser: "npm:^1.4.9"
ansi-regex: "npm:^5.0.0"
babel-jest: "npm:^29.7.0"
babel-plugin-syntax-hermes-parser: "npm:^0.23.1"
base64-js: "npm:^1.5.1"
chalk: "npm:^4.0.0"
commander: "npm:^12.0.0"
event-target-shim: "npm:^5.0.1"
flow-enums-runtime: "npm:^0.0.6"
glob: "npm:^7.1.1"
invariant: "npm:^2.2.4"
jest-environment-node: "npm:^29.6.3"
jsc-android: "npm:^250231.0.0"
memoize-one: "npm:^5.0.0"
metro-runtime: "npm:^0.81.0"
metro-source-map: "npm:^0.81.0"
mkdirp: "npm:^0.5.1"
nullthrows: "npm:^1.1.1"
pretty-format: "npm:^29.7.0"
promise: "npm:^8.3.0"
react-devtools-core: "npm:^5.3.1"
react-refresh: "npm:^0.14.0"
regenerator-runtime: "npm:^0.13.2"
scheduler: "npm:0.24.0-canary-efb381bbf-20230505"
semver: "npm:^7.1.3"
stacktrace-parser: "npm:^0.1.10"
whatwg-fetch: "npm:^3.0.0"
ws: "npm:^6.2.3"
yargs: "npm:^17.6.2"
peerDependencies:
"@types/react": ^18.2.6
react: ^18.2.0
peerDependenciesMeta:
"@types/react":
optional: true
bin:
react-native: cli.js
checksum: 10/fe1966a45523f114c7c381d6f769f3cae7a502fa2aac49bb6e46ad18bf65d19003713525b37ab6dde5af0152f6d4e89005030b6417ee8bdcdf71db75f45b39ab
languageName: node
linkType: hard

"react-number-format@npm:^5.3.1":
version: 5.3.4
resolution: "react-number-format@npm:5.3.4"
Expand Down
Loading