Releases: UdaySravanK/RNSwipeButton
Improved a11y support
- Updated the entire button to receive and act as a normal button instead of just dragable thumb.
- Switching from a11y to normal or vice-versa is not detecting the isA11yEnabled value correctly. So, reading the value again in on Focus.
- Made changes to make the button work better in a11y mode. However, testing with iOS simulator is not going well. A11y status listener event name 'change' has been deprecated. So, updated it to the latest value.
forceCompleteSwipe & reduced package size
-
Added 2 new props to support the force complete functionality.
By using the callback approach, now the swipe gesture can be completed programmatically. This will be helpful to persist the button state a completed operation. When there is a orientation change, the button state will be updated. By using the force complete, we can now show the button as in completed state. Updated the documentation. -
Pass a boolean to indicate how the swipe completed.
Passing a boolean to onSwipeSuccess callback to indicate whether the swipe completed with a real gesture or programmatically using forceCompleteSwipe. -
This would give us more control to differentiate certain operations in the swipe complete callback.
-
Reduced the npm published package size by excluding a lot of unnecessary files.
v2.0.0 | v2.0.2 | |
---|---|---|
Unpacked Size | 42.6 kB | 32.7 kB |
Total Files | 25 | 10 |
Warning Fixes, Dependency upgrades and 2 lines title support
- Upgraded the react and react-native min required dependencies
- Fixed code analysis warnings. Deprecated defaultProps and thumIconComponent type error.
- Added support to set the max number of lines
Handle the deprecated removeEventListener
Patch release v1.3.8 fixes issue #92
New prop titleMaxFontScale
#68 Supporting large font size
- Introduced a new prop "titleMaxFontScale" to support large font scaling
New prop thumbIconWidth
New prop disableResetOnTap
Fixed git issue #49: Prevent returning to initial state
- Adding a new prop called disableResetOnTap. After swipe success, tap on button resets it. This behavior can be disabled by setting this prop to true.
Use updated props in PanResponder callbacks
Issue: Using useRef memoizes initial disable value. So the swipe functionality continues to work though the disabled prop is set as true.
Fix: Use useCallback instead of useRef to update PanResponder callbacks every time props update
Example:
const MyComponent = (props) => {
const [disableSwipeButton, setDisableSwipeButton] = useState(false)
return (
<div>
<RNSwipeButton disabled={disableSwipeButton} />
<Button onPress={() => setDisableSwipeButton(!disableSwipeButton)} title="Toggle disable" />
</div>
)
}
railStyles defect fix
This release has
railStyles
prop is not overriding thumb rail container styles. Due to which unable to match the rail styles with button container styles. With this release developer will get full control to style the thumb rail container.
Example code snippet:
<SwipeButton
containerStyles={{ borderRadius: 5 }}
railStyles={{ borderRadius: 5 }}
/>
Right to left (RTL) layouts support
This release has
- Fix for issue #38
enableRightToLeftSwipe
prop has been renamed toenableReverseSwipe
, so it makes sense for both LTR and RTL layouts.- Out of the box support for RTL layouts.
If RTL is enabled at OS settings (by selecting languages like Arabic) then thern-swipe-button
works automatically as right to left swipe. To change it back to left to right swipe, propenableReverseSwipe
can be used.