Skip to content

Commit 9ed372d

Browse files
Do not send onSlidingCompleted when value is changed programmatically (#489)
* Do not send onSligingComplete event when not from user * Update the docs regarding event sent for controlled value
1 parent b8890ca commit 9ed372d

File tree

2 files changed

+2
-7
lines changed

2 files changed

+2
-7
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ To use this library you need to ensure you are using the correct version of Reac
9696
| `step` | Step value of the slider. The value should be between 0 and (maximumValue - minimumValue). Default value is 0.<br/>On Windows OS the default value is 1% of slider's range (from `minimumValue` to `maximumValue`). | number | No | |
9797
| `maximumTrackTintColor` | The color used for the track to the right of the button.<br/>Overrides the default gray gradient image on iOS. | [color](https://reactnative.dev/docs/colors) | No | |
9898
| `testID` | Used to locate this view in UI automation tests. | string | No | |
99-
| `value` | Write-only property representing the value of the slider. Can be used to programmatically control the position of the thumb. Entered once at the beginning still acts as an initial value. The value should be between minimumValue and maximumValue, which default to 0 and 1 respectively. Default value is 0.<br/>_This is not a controlled component_, you don't need to update the value during dragging. | number | No | |
99+
| `value` | Write-only property representing the value of the slider. Can be used to programmatically control the position of the thumb. Entered once at the beginning still acts as an initial value. Changing the value programmatically does not trigger any event.<br/>The value should be between minimumValue and maximumValue, which default to 0 and 1 respectively. Default value is 0.<br/>_This is not a controlled component_, you don't need to update the value during dragging. | number | No | |
100100
| `tapToSeek` | Permits tapping on the slider track to set the thumb position.<br/>Defaults to false on iOS. No effect on Android or Windows. | bool | No | iOS |
101101
| `inverted` | Reverses the direction of the slider.<br/>Default value is false. | bool | No | |
102102
| `vertical` | Changes the orientation of the slider to vertical, if set to `true`.<br/>Default value is false. | bool | No | Windows |

package/android/src/oldarch/java/com/reactnativecommunity/slider/ReactSliderManager.java

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,7 @@ public void onProgressChanged(SeekBar seekbar, int progress, boolean fromUser) {
4343
reactContext.getNativeModule(UIManagerModule.class).getEventDispatcher().dispatchEvent(
4444
new ReactSliderEvent(
4545
seekbar.getId(),
46-
slider.toRealProgress(progress), fromUser));
47-
} else {
48-
reactContext.getNativeModule(UIManagerModule.class).getEventDispatcher().dispatchEvent(
49-
new ReactSlidingCompleteEvent(
50-
seekbar.getId(),
51-
((ReactSlider)seekbar).toRealProgress(seekbar.getProgress())));
46+
slider.toRealProgress(progress), true));
5247
}
5348
}
5449

0 commit comments

Comments
 (0)