Pressable component missing focused argument
See original GitHub issueThe latest release has removed focused argument from the children rendering function children({pressed, focused})
This has resulted in breaking changes
New code
<View
{...restPropsWithDefaults}
{...eventHandlers}
ref={viewRef}
isTVSelectable={isTVSelectable !== false && accessible !== false}
style={typeof style === 'function' ? style({pressed}) : style}
collapsable={false}>
{typeof children === 'function' ? children({pressed}) : children}
{__DEV__ ? <PressabilityDebugView color="red" hitSlop={hitSlop} /> : null}
</View>
);
Old Code
<View
{...restProps}
{...eventHandlers}
{...android_rippleConfig?.viewProps}
accessible={accessible !== false}
focusable={focusable !== false}
isTVSelectable={isTVSelectable !== false && accessible !== false}
hitSlop={hitSlop}
ref={viewRef}
style={typeof style === 'function' ? style({pressed, focused}) : style}>
{typeof children === 'function' ? children({pressed, focused}) : children}
{__DEV__ ? <PressabilityDebugView color="red" hitSlop={hitSlop} /> : null}
</View>
);
React Native version:
Run react-native info
in your terminal and copy the results here.
System:
OS: macOS 11.5.1
CPU: (12) x64 Intel® Core™ i7-9750H CPU @ 2.60GHz
Memory: 18.43 MB / 16.00 GB
Shell: 3.2.57 - /bin/bash
Binaries:
Node: 12.13.1 - /var/folders/dm/zvvyvl9j6835rtc6f676rk3xplzggv/T/yarn–1628248979426-0.764699714281925/node
Yarn: 1.22.10 - /var/folders/dm/zvvyvl9j6835rtc6f676rk3xplzggv/T/yarn–1628248979426-0.764699714281925/yarn
npm: 7.6.0 - /usr/local/bin/npm
Watchman: 4.9.0 - /usr/local/bin/watchman
Managers:
CocoaPods: 1.10.2 - /usr/local/bin/pod
SDKs:
iOS SDK:
Platforms: iOS 14.5, DriverKit 20.4, macOS 11.3, tvOS 14.5, watchOS 7.4
Android SDK:
API Levels: 22, 23, 25, 26, 27, 28, 29
Build Tools: 19.1.0, 20.0.0, 25.0.0, 27.0.3, 28.0.3, 29.0.2, 29.0.3
System Images: android-22 | Android TV Intel x86 Atom, android-24 | Intel x86 Atom_64, android-24 | Google APIs Intel x86 Atom_64, android-28 | Android TV Intel x86 Atom, android-28 | Google APIs Intel x86 Atom_64, android-28 | Google Play Intel x86 Atom, android-29 | Intel x86 Atom_64, android-29 | Google APIs Intel x86 Atom, android-29 | Google Play Intel x86 Atom, android-Q | Android TV Intel x86 Atom
Android NDK: 19.2.5345600
IDEs:
Android Studio: 2020.3 AI-203.7717.56.2031.7583922
Xcode: 12.5.1/12E507 - /usr/bin/xcodebuild
Languages:
Java: 1.8.0_212 - /Library/Java/JavaVirtualMachines/jdk1.8.0_212.jdk/Contents/Home/bin/javac
npmPackages:
@react-native-community/cli: Not Found
react: ^17.0.2 => 17.0.2
react-native: Not Found
react-native-macos: Not Found
npmGlobalPackages:
react-native: Not Found
Issue Analytics
- State:
- Created 2 years ago
- Comments:5 (1 by maintainers)
Top GitHub Comments
@douglowder thanks for the quick fix.
Fix is in release 0.64.2-2. Closing.