-
-
Notifications
You must be signed in to change notification settings - Fork 353
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Hey! First off, thanks for this awesome library - it's been great to work with.
Issue
I noticed that the Pagination.Custom component triggers Reanimated's strict mode warning when rendering:
WARN [Reanimated] Reading from `value` during component render. Please ensure that you don't access the `value` property nor use `get` method of a shared value while React is rendering a component.
Where it happens
In src/components/Pagination/Custom/PaginationItem.tsx (lines 111-112), animValue.value is read directly in the JSX for accessibility props:
<Pressable
// ...
accessibilityHint={animValue.value === index ? "" : `Go to ${accessibilityLabel}`}
accessibilityState={{ selected: animValue.value === index }}
>Possible fix
One approach could be to sync the selected state to regular React state:
const [isSelected, setIsSelected] = useState(false);
useDerivedValue(() => {
runOnJS(setIsSelected)(animValue.value === index);
});
// Then in JSX
accessibilityHint={isSelected ? "" : `Go to ${accessibilityLabel}`}
accessibilityState={{ selected: isSelected }}Happy to submit a PR if that would help!
Environment
react-native-reanimated-carousel: 4.0.3react-native-reanimated: ~3.17.4- Platforms: iOS & Android
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working