react-native
react-native copied to clipboard
Remove deprecated slider
Summary
Slider component is deprecated for a while, and the community package (https://github.com/react-native-community/react-native-slider) is now compatible with the new architecture (see https://github.com/react-native-community/discussions-and-proposals/issues/451).
I removed all occurrences of Slider, except:
RNTNativeComponentWithStateCustomShadowNode in RNTester
RNTNativeComponentWithStateCustomShadowNode.h#L25:
/*
* `ShadowNode` for <Slider> component.
*/
class RNTNativeComponentWithStateCustomShadowNode final
and RNTNativeComponentWithStateCustomShadowNode.cpp#L40:
// It is not possible to copy or move image requests from SliderLocalData,
// so instead we recreate any image requests (that may already be in-flight?)
// TODO: check if multiple requests are cached or if it's a net loss
because I'm not sure this code is specific to the Slider component.
AccessibilityExample in RNTester
<RNTesterBlock title="Adjustable with increment/decrement actions">
<View
accessible={true}
accessibilityRole="adjustable"
accessibilityActions={[{name: 'increment'}, {name: 'decrement'}]}
onAccessibilityAction={event => {
switch (event.nativeEvent.actionName) {
case 'increment':
Alert.alert('Alert', 'increment action success');
break;
case 'decrement':
Alert.alert('Alert', 'decrement action success');
break;
}
}}>
<Text>Slider</Text>
</View>
</RNTesterBlock>
because I think the text here does not refer to the Slider component.
Codegen fixtures
fixtures.js#L441 (3 more occurences in this file) and the snap file:
const IMAGE_PROP: SchemaType = {
modules: {
Slider: {
type: 'Component',
because I feel like the name here is just a string but does not refer specifically to the Slider component, it could be any component name.
Accessiblity roles and values
separator: undefined,
slider: 'adjustable',
spinbutton: 'spinbutton',
| 'separator'
| 'slider'
| 'spinbutton'
/**
* Represents the current value of a component. It can be a textual description of a component's value, or for range-based components, such as sliders and progress bars,
* it contains range information (minimum, current, and maximum).
*/
/**
* alias for accessibilityState
* It represents textual description of a component's value, or for range-based components, such as sliders and progress bars.
*/
because I feel that the slider role and the comments about slider are still relevant.
Changelog
[General] [Removed] - Remove deprecated Slider component
Test Plan
All the tests are green, and the RNTester app is running fine.
| Platform | Engine | Arch | Size (bytes) | Diff |
|---|---|---|---|---|
| android | hermes | arm64-v8a | 7,752,564 | -25,586 |
| android | hermes | armeabi-v7a | 7,154,731 | -24,475 |
| android | hermes | x86 | 8,062,880 | -28,189 |
| android | hermes | x86_64 | 8,034,203 | -28,638 |
| android | jsc | arm64-v8a | 9,612,083 | -25,269 |
| android | jsc | armeabi-v7a | 8,377,485 | -24,162 |
| android | jsc | x86 | 9,558,660 | -27,884 |
| android | jsc | x86_64 | 10,151,383 | -28,326 |
Base commit: 74fff88273f571e8c83f6dd3fe531020ce265e7b Branch: main
| Platform | Engine | Arch | Size (bytes) | Diff |
|---|---|---|---|---|
| ios | - | universal | n/a | -- |
Base commit: 74fff88273f571e8c83f6dd3fe531020ce265e7b Branch: main
@huntie has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.
@huntie I see that Facebook Internal Builds and Linter failed. Is there anything I can do ?
@AntoineDoubovetzky Hey, yes we gave this a go and CI flagged that we are still depending on this component in several places internally at Meta — enough that this cannot be immediately merged.
We are going to create tasks/reach out to maintainers so that these internal usages can be replaced, but this will take some time (we cannot make any near-term commitment).
Let's keep this PR open in the meantime. I've assigned it to @NickGerleman as a task hook and he/someone should re-import this PR in future when ready.
Reading the issue I thought that the Slider was not used internally anymore. Good luck replacing it!
@huntie I believe the Slider has been removed in another PR: https://github.com/facebook/react-native/pull/35365
I can close this one, right?
@AntoineDoubovetzky Yes, thanks!