Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

change ReactProp to defaultDouble #681

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

vafada
Copy link
Contributor

@vafada vafada commented Jan 25, 2025

Summary:

no functionality change just make API consistent.

The change to https://github.com/callstack/react-native-slider/pull/649/files#diff-e1ce4a6b5a58885eafa4615c2f0835fb1561080fcbcffb2ac8ac50fd0fb3bbaa

changed the value parameter from float to double type

but the @ReactProp annotation still uses float. This PR changes it to defaultDouble to be consistent

double type for both annotation and value parameter type

Other Inconsistencies:

  1. the oldarch has
@ReactProp(name = "maximumValue", defaultDouble = 1d)
  public void setMaximumValue(ReactSlider view, double value) {
    ReactSliderManagerImpl.setMaximumValue(view, value);
  }

should we also default to 1d for setMaximumValue in newarch?

@ReactProp(name = "maximumValue", defaultDouble = 1d)
public void setMaximumValue(ReactSlider view, double value) {
ReactSliderManagerImpl.setMaximumValue(view, value);
}

  1. Why is ReactSliderManager.setValue still accepts a float type for value when the underlying implementation accepts a double?

public static void setValue(ReactSlider view, double value) {
if (view.isSliding() == false) {
view.setValue(value);
if (view.isAccessibilityFocused() && Build.VERSION.SDK_INT > Build.VERSION_CODES.Q) {
view.setupAccessibility((int)value);
}
}
}

should we also change the param type for value to double ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant