From f10755c9d8a027c7f163a8d3c503d44a68d489a7 Mon Sep 17 00:00:00 2001 From: Adi Mordo Date: Thu, 22 Aug 2024 10:40:32 +0300 Subject: [PATCH 01/14] fixed style override in grid list item image (#3222) * fixed style override in grid list item image * gridView screen fix --- demo/src/screens/componentScreens/GridViewScreen.tsx | 3 ++- src/components/gridListItem/index.tsx | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/demo/src/screens/componentScreens/GridViewScreen.tsx b/demo/src/screens/componentScreens/GridViewScreen.tsx index 152b6e8ecf..aea16a09b3 100644 --- a/demo/src/screens/componentScreens/GridViewScreen.tsx +++ b/demo/src/screens/componentScreens/GridViewScreen.tsx @@ -12,6 +12,7 @@ class GridViewScreen extends Component { _.map(contacts, contact => ({ imageProps: {source: {uri: contact.thumbnail}, borderRadius: 999, style: {backgroundColor: Colors.grey60}}, title: _.split(contact.name, ' ')[0], + titleLines: 1, onPress: () => Alert.alert('My name is ' + contact.name) })))(conversations), products: _.flow(products => _.take(products, 8), @@ -174,7 +175,7 @@ class GridViewScreen extends Component { Dynamic itemSize - (Using maxItemWidth) + (Using maxItemWidth) diff --git a/src/components/gridListItem/index.tsx b/src/components/gridListItem/index.tsx index 9f39b52425..8b5968a870 100644 --- a/src/components/gridListItem/index.tsx +++ b/src/components/gridListItem/index.tsx @@ -213,7 +213,7 @@ class GridListItem extends Component { accessible={renderCustomItem ? true : undefined} {...Modifiers.extractAccessibilityProps(this.props)} > - {imageProps && } + {imageProps && } {!_.isNil(renderCustomItem) && {renderCustomItem()}} {renderOverlay && {renderOverlay()}} From 58e958afa6266be97ea4b4bcca83adf50ecb62f1 Mon Sep 17 00:00:00 2001 From: Adi Mordo Date: Thu, 22 Aug 2024 10:42:04 +0300 Subject: [PATCH 02/14] button border width grow outside the container (#3221) * button border width grow outside the container * removed forEach for round button --- .../TextFieldScreen.spec.js.snap | 4 +- .../__snapshots__/index.spec.js.snap | 40 +++++++++---------- src/components/button/index.tsx | 21 +--------- 3 files changed, 23 insertions(+), 42 deletions(-) diff --git a/demo/src/screens/__tests__/__snapshots__/TextFieldScreen.spec.js.snap b/demo/src/screens/__tests__/__snapshots__/TextFieldScreen.spec.js.snap index b5e809facf..cd6d85d9b8 100644 --- a/demo/src/screens/__tests__/__snapshots__/TextFieldScreen.spec.js.snap +++ b/demo/src/screens/__tests__/__snapshots__/TextFieldScreen.spec.js.snap @@ -3521,8 +3521,8 @@ exports[`TextField Screen renders screen 1`] = ` "marginLeft": 20, "minWidth": 66, "opacity": 1, - "paddingHorizontal": 10, - "paddingVertical": 2, + "paddingHorizontal": 11, + "paddingVertical": 3, } } > diff --git a/src/components/button/__tests__/__snapshots__/index.spec.js.snap b/src/components/button/__tests__/__snapshots__/index.spec.js.snap index 359617374d..b0b2837880 100644 --- a/src/components/button/__tests__/__snapshots__/index.spec.js.snap +++ b/src/components/button/__tests__/__snapshots__/index.spec.js.snap @@ -482,8 +482,8 @@ exports[`Button backgroundColor should return undefined if this button is outlin "justifyContent": "center", "minWidth": 90, "opacity": 1, - "paddingHorizontal": 19, - "paddingVertical": 8.5, + "paddingHorizontal": 20, + "paddingVertical": 9.5, } } > @@ -1230,8 +1230,8 @@ exports[`Button container size should reduce padding by outlineWidth in case of "justifyContent": "center", "minWidth": 90, "opacity": 1, - "paddingHorizontal": 18, - "paddingVertical": 7.5, + "paddingHorizontal": 20, + "paddingVertical": 9.5, } } > @@ -1408,8 +1408,8 @@ exports[`Button container size should return style for large button 2`] = ` "justifyContent": "center", "minWidth": 90, "opacity": 1, - "paddingHorizontal": 19, - "paddingVertical": 8.5, + "paddingHorizontal": 20, + "paddingVertical": 9.5, } } > @@ -1591,8 +1591,8 @@ exports[`Button container size should return style for medium button 2`] = ` "justifyContent": "center", "minWidth": 77, "opacity": 1, - "paddingHorizontal": 15, - "paddingVertical": 5.5, + "paddingHorizontal": 16, + "paddingVertical": 6.5, } } > @@ -1867,8 +1867,8 @@ exports[`Button container size should return style for small button 2`] = ` "justifyContent": "center", "minWidth": 70, "opacity": 1, - "paddingHorizontal": 13, - "paddingVertical": 3.5, + "paddingHorizontal": 14, + "paddingVertical": 4.5, } } > @@ -2055,8 +2055,8 @@ exports[`Button container size should return style for xSmall button 2`] = ` "justifyContent": "center", "minWidth": 66, "opacity": 1, - "paddingHorizontal": 10, - "paddingVertical": 2, + "paddingHorizontal": 11, + "paddingVertical": 3, } } > @@ -4191,8 +4191,8 @@ exports[`Button outline should render button with an outline 1`] = ` "justifyContent": "center", "minWidth": 90, "opacity": 1, - "paddingHorizontal": 19, - "paddingVertical": 8.5, + "paddingHorizontal": 20, + "paddingVertical": 9.5, } } > @@ -4371,8 +4371,8 @@ exports[`Button outline should render button with outline and outlineColor 1`] = "justifyContent": "center", "minWidth": 90, "opacity": 1, - "paddingHorizontal": 19, - "paddingVertical": 8.5, + "paddingHorizontal": 20, + "paddingVertical": 9.5, } } > @@ -4461,8 +4461,8 @@ exports[`Button outline should return custom borderWidth according to outlineWid "justifyContent": "center", "minWidth": 90, "opacity": 1, - "paddingHorizontal": 17, - "paddingVertical": 6.5, + "paddingHorizontal": 20, + "paddingVertical": 9.5, } } > @@ -4551,8 +4551,8 @@ exports[`Button outline should return disabled color for outline if button is di "justifyContent": "center", "minWidth": 90, "opacity": 1, - "paddingHorizontal": 19, - "paddingVertical": 8.5, + "paddingHorizontal": 20, + "paddingVertical": 9.5, } } > diff --git a/src/components/button/index.tsx b/src/components/button/index.tsx index 0f4f774128..486ef756d2 100644 --- a/src/components/button/index.tsx +++ b/src/components/button/index.tsx @@ -149,16 +149,8 @@ class Button extends PureComponent { } getContainerSizeStyle() { - const { - outline, - avoidMinWidth, - avoidInnerPadding, - round, - size: propsSize, - outlineWidth: propsOutlineWidth - } = this.props; + const {avoidMinWidth, avoidInnerPadding, round, size: propsSize} = this.props; const size = propsSize || DEFAULT_SIZE; - const outlineWidth = propsOutlineWidth || 1; const CONTAINER_STYLE_BY_SIZE: Dictionary = {}; CONTAINER_STYLE_BY_SIZE[Button.sizes.xSmall] = round @@ -190,17 +182,6 @@ class Button extends PureComponent { minWidth: MIN_WIDTH.LARGE }; - if (outline) { - _.forEach(CONTAINER_STYLE_BY_SIZE, style => { - if (round) { - style.padding -= outlineWidth; // eslint-disable-line - } else { - style.paddingVertical -= outlineWidth; // eslint-disable-line - style.paddingHorizontal -= outlineWidth; // eslint-disable-line - } - }); - } - const containerSizeStyle = CONTAINER_STYLE_BY_SIZE[size]; if (this.isLink || (this.isIconButton && !round)) { From 4b6d8f311239a5cc5e68dc06f3a0593c1c0b64d7 Mon Sep 17 00:00:00 2001 From: Gaya Blau <86973357+gayablau@users.noreply.github.com> Date: Thu, 22 Aug 2024 15:08:12 +0300 Subject: [PATCH 03/14] Fix/tab page nested in scroll view (#3224) * fix tab page nested in scroll view * clean * expand to style prop * change prop name --- src/components/tabController/TabPage.tsx | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/src/components/tabController/TabPage.tsx b/src/components/tabController/TabPage.tsx index eddf6f4667..09d6fa014d 100644 --- a/src/components/tabController/TabPage.tsx +++ b/src/components/tabController/TabPage.tsx @@ -1,5 +1,5 @@ import React, {PropsWithChildren, useCallback, useContext, useState, useMemo} from 'react'; -import {StyleSheet} from 'react-native'; +import {type StyleProp, StyleSheet, type ViewStyle} from 'react-native'; import Reanimated, {useAnimatedStyle, useAnimatedReaction, runOnJS} from 'react-native-reanimated'; // import {Freeze} from 'react-freeze'; import TabBarContext from './TabBarContext'; @@ -25,6 +25,10 @@ export interface TabControllerPageProps { * Used as a testing identifier */ testID?: string; + /** + * add style properties to tab page + */ + style?: StyleProp; } /** @@ -36,6 +40,7 @@ export default function TabPage({ index, lazy, renderLoading, + style, lazyLoadTime = 100, ...props }: PropsWithChildren) { @@ -81,12 +86,17 @@ export default function TabPage({ }; }); - const style = useMemo(() => { - return [!asCarousel && styles.page, animatedPageStyle, {width: asCarousel ? containerWidth : undefined}]; - }, [asCarousel, animatedPageStyle, containerWidth]); + const _style = useMemo(() => { + return [ + !asCarousel && styles.page, + animatedPageStyle, + {width: asCarousel ? containerWidth : undefined}, + style + ]; + }, [asCarousel, animatedPageStyle, containerWidth, style]); return ( - + {!shouldLoad && renderLoading?.()} {shouldLoad && props.children} {/* {props.children} */} From e095f512721e7a187d2203a3af0628a0fae7eb79 Mon Sep 17 00:00:00 2001 From: Adi Mordo Date: Sun, 25 Aug 2024 17:00:57 +0300 Subject: [PATCH 04/14] button driver getIcon/LAbel styles (#3217) --- src/components/button/Button.driver.new.ts | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/components/button/Button.driver.new.ts b/src/components/button/Button.driver.new.ts index 3953d0fbdb..1160c84c1a 100644 --- a/src/components/button/Button.driver.new.ts +++ b/src/components/button/Button.driver.new.ts @@ -1,3 +1,4 @@ +import {StyleSheet} from 'react-native'; import {useComponentDriver, ComponentProps, usePressableDriver, TextDriver, ImageDriver} from '../../testkit'; export const ButtonDriver = (props: ComponentProps) => { @@ -17,9 +18,17 @@ export const ButtonDriver = (props: ComponentProps) => { return labelDriver; }; + const getLabelStyle = () => { + return labelDriver?.getStyle(); + }; + const getIcon = () => { return iconDriver; }; - return {getLabel, getIcon, ...driver}; + const getIconStyle = () => { + return StyleSheet.flatten(iconDriver?.getElement().props.style); + }; + + return {getLabel, getLabelStyle, getIconStyle, getIcon, ...driver}; }; From 439bfc5fb8a5b0288bb00aa1ac11e9e77babe0f9 Mon Sep 17 00:00:00 2001 From: Nitzan Yizhar Date: Mon, 26 Aug 2024 12:13:34 +0300 Subject: [PATCH 05/14] enabled partial sizes to the chip size (#3230) --- src/components/chip/index.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/chip/index.tsx b/src/components/chip/index.tsx index 7da3edd408..6e2f94cc38 100644 --- a/src/components/chip/index.tsx +++ b/src/components/chip/index.tsx @@ -17,7 +17,7 @@ export type ChipProps = ViewProps & /** * Chip's size. Number or a width and height object. */ - size?: number | {width: number; height: number}; + size?: number | Partial<{width: number; height: number}>; /** * On Chip press callback */ From 820745626cc20698882fe8406e8c45ad4251c4fa Mon Sep 17 00:00:00 2001 From: Nitzan Yizhar Date: Mon, 26 Aug 2024 15:33:58 +0300 Subject: [PATCH 06/14] Incubator.Dialog - Fixed content component being created on every render. (#3231) * fixed DialogContent component being created on every render and casuing mounts and unmounts * rename variable --- src/incubator/Dialog/index.tsx | 4 ++-- src/incubator/Dialog/useDialogContent.tsx | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/incubator/Dialog/index.tsx b/src/incubator/Dialog/index.tsx index eb4d32cf6c..f95137fe03 100644 --- a/src/incubator/Dialog/index.tsx +++ b/src/incubator/Dialog/index.tsx @@ -127,7 +127,7 @@ const Dialog = (props: DialogProps, ref: ForwardedRef) // eslint-disable-next-line react-hooks/exhaustive-deps }, []); - const {DialogContent, containerProps, containerStyle} = useDialogContent({ + const {renderDialogContent, containerProps, containerStyle} = useDialogContent({ showCloseButton, close, closeButtonProps, @@ -215,7 +215,7 @@ const Dialog = (props: DialogProps, ref: ForwardedRef) {/* @ts-expect-error should be fixed in version 3.5 (https://github.com/software-mansion/react-native-reanimated/pull/4881) */} - + {renderDialogContent()} ); diff --git a/src/incubator/Dialog/useDialogContent.tsx b/src/incubator/Dialog/useDialogContent.tsx index b7cf992ea8..a573e2426f 100644 --- a/src/incubator/Dialog/useDialogContent.tsx +++ b/src/incubator/Dialog/useDialogContent.tsx @@ -49,7 +49,7 @@ const useDialogContent = (props: InternalDialogCloseButtonProps) => { return showCloseButton ? [propsContainerStyle, styles.transparent] : propsContainerStyle; }, [showCloseButton, propsContainerStyle]); - const DialogContent = () => { + const renderDialogContent = () => { const DialogContent = ( <> {headerProps && } @@ -69,7 +69,7 @@ const useDialogContent = (props: InternalDialogCloseButtonProps) => { } }; - return {DialogContent, containerStyle, containerProps}; + return {renderDialogContent, containerStyle, containerProps}; }; export default useDialogContent; From 612c26c3a93115183604c9b135605741b0ecc45b Mon Sep 17 00:00:00 2001 From: Adi Mordo Date: Sun, 1 Sep 2024 12:01:40 +0300 Subject: [PATCH 07/14] update thumbStyle when tintColor changes (#3211) --- src/incubator/Slider/index.tsx | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/incubator/Slider/index.tsx b/src/incubator/Slider/index.tsx index 08594b018b..e221e4c954 100644 --- a/src/incubator/Slider/index.tsx +++ b/src/incubator/Slider/index.tsx @@ -270,11 +270,9 @@ const Slider = React.memo((props: Props) => { }, [value, setInitialPositions]); useEffect(() => { - if (!thumbStyle) { - _thumbStyle.value = StyleUtils.unpackStyle(defaultThumbStyle, {flatten: true}); - } + _thumbStyle.value = StyleUtils.unpackStyle(thumbStyle ? customThumbStyle : defaultThumbStyle, {flatten: true}); // eslint-disable-next-line react-hooks/exhaustive-deps - }, [defaultThumbStyle, thumbStyle]); + }, [defaultThumbStyle, customThumbStyle, thumbStyle]); const onValueChangeThrottled = useCallback(_.throttle(value => { if (!didValueUpdate.current) { // NOTE: don't invoke onValueChange when slider's value prop updated programmatically From 0aa3ee0b7e59a8ada7946fdd4c6078e1bf2874ec Mon Sep 17 00:00:00 2001 From: Inbal Tish <33805983+Inbal-Tish@users.noreply.github.com> Date: Sun, 1 Sep 2024 12:57:58 +0300 Subject: [PATCH 08/14] Reanimated and GestureHandler upgrade (#3203) * SectionsWheelPicker - wrap with GestureHandlerRootView * remove redundent * remove // @ts-expect-error should be fixed in version 3.5 (https://github.com/software-mansion/react-native-reanimated/pull/4881) * Modal - applying useGestureHandlerRootView on iOS as well * TouchableOpacity - migrate from deprecated onGestureEvent to onHandleStateChange * PanView - migrate from PanGestureHandler with deprecated onGestureEvent to GestureDetector component with gesture * Calendar header - ignore TS error * upgrade libraries * gesture upgrade to 2.16.0 * gestureHandler to 2.14.1 * Modal - update docs * WheelPicker - wrap with GestureHandlerRootView, instead of wrapping the screen * Wrapping SectionWheelPickerScreen instead of WheelPicker component * clean * Remove migration from useAnimatedGestureHandler * //@ts-expect-error - useAnimatedGestureHandler migration * fix TS error on ConnectionStatusBar NetInfo.fetch * Revert "fix TS error on ConnectionStatusBar NetInfo.fetch" This reverts commit 323a558252e44d5e8302becf5aaf4cc79e8a243e. * Revert "//@ts-expect-error - useAnimatedGestureHandler migration" This reverts commit 03a695ce9f23161482f1274e03387206a98ba8b8. * Revert "Remove migration from useAnimatedGestureHandler" This reverts commit 795780513d013a22e2eccb5af6230ab6400838ee. * Wrap screens with gestureHandlerRootHOC * Fix TabController's indicator * Fix PanView (and screen) * Remove missed comment * Change to map (also fixes initial indicator) --------- Co-authored-by: M-i-k-e-l --- demo/src/screens/componentScreens/index.js | 8 +- .../incubatorScreens/PanViewScreen.tsx | 5 +- package.json | 4 +- src/components/marquee/index.tsx | 2 - src/components/modal/api/modal.api.json | 3 +- src/components/modal/index.tsx | 7 +- .../sortableGridList/SortableItem.tsx | 2 - src/components/tabController/PageCarousel.tsx | 1 - src/components/tabController/TabBarItem.tsx | 1 - .../tabController/useScrollToItem.ts | 28 ++-- src/components/textField/ClearButton.tsx | 2 - src/incubator/Calendar/Header.tsx | 2 +- src/incubator/Calendar/TodayButton.tsx | 2 - src/incubator/Dialog/index.tsx | 2 - src/incubator/Slider/Thumb.tsx | 2 - src/incubator/Slider/index.tsx | 1 - src/incubator/TouchableOpacity.tsx | 61 +++---- src/incubator/panView/index.tsx | 14 +- src/incubator/panView/usePanGesture.ts | 27 ++- yarn.lock | 156 ++++++++++++++++-- 20 files changed, 223 insertions(+), 107 deletions(-) diff --git a/demo/src/screens/componentScreens/index.js b/demo/src/screens/componentScreens/index.js index 3c764feeba..2dfb53ecd1 100644 --- a/demo/src/screens/componentScreens/index.js +++ b/demo/src/screens/componentScreens/index.js @@ -15,7 +15,7 @@ export function registerScreens(registrar) { registrar('unicorn.components.CheckboxScreen', () => require('./CheckboxScreen').default); registrar('unicorn.components.ChipScreen', () => require('./ChipScreen').default); registrar('unicorn.components.ChipsInputScreen', () => require('./ChipsInputScreen').default); - registrar('unicorn.components.ColorPickerScreen', () => require('./ColorPickerScreen').default); + registrar('unicorn.components.ColorPickerScreen', () => gestureHandlerRootHOC(require('./ColorPickerScreen').default)); registrar('unicorn.components.ColorSwatchScreen', () => require('./ColorSwatchScreen').default); registrar('unicorn.components.ConnectionStatusBar', () => require('./ConnectionStatusBarScreen').default); registrar('unicorn.components.DateTimePickerScreen', () => require('./DateTimePickerScreen').default); @@ -28,7 +28,7 @@ export function registerScreens(registrar) { registrar('unicorn.components.IconScreen', () => require('./IconScreen').default); registrar('unicorn.components.ImageScreen', () => require('./ImageScreen').default); registrar('unicorn.components.GridListScreen', () => require('./GridListScreen').default); - registrar('unicorn.components.GridViewScreen', () => require('./GridViewScreen').default); + registrar('unicorn.components.GridViewScreen', () => gestureHandlerRootHOC(require('./GridViewScreen').default)); registrar('unicorn.components.KeyboardAwareScrollViewScreen', () => require('./KeyboardAwareScrollViewScreen').default); registrar('unicorn.components.MaskedInputScreen', () => require('./MaskedInputScreen').default); registrar('unicorn.components.MarqueeScreen', () => require('./MarqueeScreen').default); @@ -38,12 +38,12 @@ export function registerScreens(registrar) { registrar('unicorn.components.PanDismissibleScreen', () => require('./PanDismissibleScreen').default); registrar('unicorn.components.PanListenerScreen', () => require('./PanListenerScreen').default); registrar('unicorn.components.PanResponderScreen', () => require('./PanResponderScreen').default); - registrar('unicorn.components.PickerScreen', () => require('./PickerScreen').default); + registrar('unicorn.components.PickerScreen', () => gestureHandlerRootHOC(require('./PickerScreen').default)); registrar('unicorn.animations.ProgressBarScreen', () => require('../componentScreens/ProgressBarScreen').default); registrar('unicorn.components.ProgressiveImageScreen', () => require('./ProgressiveImageScreen').default); registrar('unicorn.components.RadioButtonScreen', () => require('./RadioButtonScreen').default); registrar('unicorn.components.ScrollBarScreen', () => require('./ScrollBarScreen').default); - registrar('unicorn.components.SectionsWheelPickerScreen', () => require('./SectionsWheelPickerScreen').default); + registrar('unicorn.components.SectionsWheelPickerScreen', () => gestureHandlerRootHOC(require('./SectionsWheelPickerScreen').default)); registrar('unicorn.components.SegmentedControlScreen', () => require('./SegmentedControlScreen').default); registrar('unicorn.components.SharedTransitionScreen', () => require('./SharedTransitionScreen').default); registrar('unicorn.components.SkeletonViewScreen', () => require('./SkeletonViewScreen').default); diff --git a/demo/src/screens/incubatorScreens/PanViewScreen.tsx b/demo/src/screens/incubatorScreens/PanViewScreen.tsx index efc4c5bcf5..ce15754904 100644 --- a/demo/src/screens/incubatorScreens/PanViewScreen.tsx +++ b/demo/src/screens/incubatorScreens/PanViewScreen.tsx @@ -146,9 +146,8 @@ class PanViewScreen extends Component { render() { const {showToast, showDialog} = this.state; - const Container = showDialog ? View : GestureHandlerRootView; return ( - + New Pan View @@ -164,7 +163,7 @@ class PanViewScreen extends Component { {showToast && this.renderToast()} {showDialog && this.renderDialog()} - + ); } } diff --git a/package.json b/package.json index 86120ef9ce..76624636b8 100644 --- a/package.json +++ b/package.json @@ -106,12 +106,12 @@ "react-dom": "^18.2.0", "react-native": "0.71.12", "react-native-fs": "^2.20.0", - "react-native-gesture-handler": "2.9.0", + "react-native-gesture-handler": "2.14.1", "react-native-haptic-feedback": "^1.11.0", "react-native-linear-gradient": "2.6.2", "react-native-mmkv": "2.11.0", "react-native-navigation": "7.32.1", - "react-native-reanimated": "3.4.0", + "react-native-reanimated": "3.8.1", "react-native-shimmer-placeholder": "^2.0.6", "react-native-svg": "^13.7.0", "react-native-svg-transformer": "1.1.0", diff --git a/src/components/marquee/index.tsx b/src/components/marquee/index.tsx index 0e83b9cb3c..9c9a7d8620 100644 --- a/src/components/marquee/index.tsx +++ b/src/components/marquee/index.tsx @@ -76,7 +76,6 @@ function Marquee(props: MarqueeProps) { } }, [viewLayout, textLayout]); - // @ts-expect-error should be fixed in version 3.5 (https://github.com/software-mansion/react-native-reanimated/pull/4881) const translateStyle = useAnimatedStyle(() => { if (offset.value) { return { @@ -90,7 +89,6 @@ function Marquee(props: MarqueeProps) { return ( - {/* @ts-expect-error should be fixed in version 3.5 (https://github.com/software-mansion/react-native-reanimated/pull/4881) */} {label} diff --git a/src/components/modal/api/modal.api.json b/src/components/modal/api/modal.api.json index 85c56251b7..7785707398 100644 --- a/src/components/modal/api/modal.api.json +++ b/src/components/modal/api/modal.api.json @@ -33,8 +33,7 @@ { "name": "useGestureHandlerRootView", "type": "boolean", - "description": "Should add a GestureHandlerRootView", - "note": "Android only" + "description": "Should add a GestureHandlerRootView" } ], "snippet": [ diff --git a/src/components/modal/index.tsx b/src/components/modal/index.tsx index 2329d219dd..482bc998dd 100644 --- a/src/components/modal/index.tsx +++ b/src/components/modal/index.tsx @@ -45,7 +45,7 @@ export interface ModalProps extends RNModalProps { */ accessibilityLabel?: string; /** - * Should add a GestureHandlerRootView (Android only) + * Should add a GestureHandlerRootView */ useGestureHandlerRootView?: boolean; /** @@ -112,9 +112,8 @@ class Modal extends Component { ...others } = this.props; const defaultContainer = enableModalBlur && Constants.isIOS && BlurView ? BlurView : View; - const useGestureHandler = useGestureHandlerRootView && Constants.isAndroid; - const GestureContainer = useGestureHandler ? GestureHandlerRootView : React.Fragment; - const gestureContainerProps = useGestureHandler ? {style: styles.fill} : {}; + const GestureContainer = useGestureHandlerRootView ? GestureHandlerRootView : React.Fragment; + const gestureContainerProps = useGestureHandlerRootView ? {style: styles.fill} : {}; const useKeyboardAvoiding = useKeyboardAvoidingView && Constants.isIOS; const KeyboardAvoidingContainer = useKeyboardAvoiding ? KeyboardAvoidingView : React.Fragment; const keyboardAvoidingContainerProps = useKeyboardAvoiding diff --git a/src/components/sortableGridList/SortableItem.tsx b/src/components/sortableGridList/SortableItem.tsx index 6f7c4ee023..cad24f8ae2 100644 --- a/src/components/sortableGridList/SortableItem.tsx +++ b/src/components/sortableGridList/SortableItem.tsx @@ -171,7 +171,6 @@ function SortableItem(props: PropsWithChildren { const scale = withSpring(isDragging.value ? 1.1 : 1); const zIndex = isDragging.value ? 100 : withTiming(0, animationConfig); @@ -183,7 +182,6 @@ function SortableItem(props: PropsWithChildren {props.children} diff --git a/src/components/tabController/PageCarousel.tsx b/src/components/tabController/PageCarousel.tsx index d9974415d4..484f70c57e 100644 --- a/src/components/tabController/PageCarousel.tsx +++ b/src/components/tabController/PageCarousel.tsx @@ -104,7 +104,6 @@ function PageCarousel(props: ScrollViewProps) { ; onLayout?: (event: LayoutChangeEvent, index: number) => void; } diff --git a/src/components/tabController/useScrollToItem.ts b/src/components/tabController/useScrollToItem.ts index 6aeac8550d..ff06062f0e 100644 --- a/src/components/tabController/useScrollToItem.ts +++ b/src/components/tabController/useScrollToItem.ts @@ -128,13 +128,6 @@ const useScrollToItem = (props: ScrollToItemPr const rightOffsets = []; rightOffsets.push(-containerWidth + widths[0] + outerSpacing + innerSpacing); while (index < itemsCount) { - /* map animated widths and offsets */ - itemsWidthsAnimated.value[index] = widths[index]; - if (index > 0) { - itemsOffsetsAnimated.value[index] = - itemsOffsetsAnimated.value[index - 1] + itemsWidthsAnimated.value[index - 1]; - } - /* calc center, left and right offsets */ centeredOffsets[index] = currentCenterOffset - screenCenter + widths[index] / 2; ++index; @@ -154,9 +147,24 @@ const useScrollToItem = (props: ScrollToItemPr setOffsets({CENTER: centeredOffsets, LEFT: leftOffsets, RIGHT: rightOffsets}); // default for DYNAMIC is CENTER - // trigger value change - itemsWidthsAnimated.value = [...itemsWidthsAnimated.value]; - itemsOffsetsAnimated.value = [...itemsOffsetsAnimated.value]; + // Update shared values + itemsWidthsAnimated.modify((value) => { + 'worklet'; + value.forEach((_, index) => { + value[index] = widths[index]; + }); + return value; + }); + + itemsOffsetsAnimated.modify((value) => { + 'worklet'; + value.forEach((_, index) => { + if (index > 0) { + value[index] = value[index - 1] + widths[index - 1]; + } + }); + return value; + }); }, [itemsCount, outerSpacing, innerSpacing, addOffsetMargin, containerWidth]); diff --git a/src/components/textField/ClearButton.tsx b/src/components/textField/ClearButton.tsx index 749c6c01da..cff3c3fda9 100644 --- a/src/components/textField/ClearButton.tsx +++ b/src/components/textField/ClearButton.tsx @@ -22,7 +22,6 @@ const ClearButton = ({testID, onClear, onChangeText}: Pick { return { transform: [{translateY: animatedValue.value}, {translateX: 0}], @@ -49,7 +48,6 @@ const ClearButton = ({testID, onClear, onChangeText}: Pick