Skip to content

Commit

Permalink
[android][ios] Upgrade @react-native-community/slider to 4.2.4 (#19424)
Browse files Browse the repository at this point in the history
# Why

close ENG-6538

the latest slider version is v4.3.2, but it is incompatible with reanimated layout animation setup. mainly because it uses the [dispatchModern](https://github.com/callstack/react-native-slider/blob/7afcaeb754aad6e362cbf43da2d5ff32a1feb1f3/package/android/src/main/java/com/reactnativecommunity/slider/ReactSliderEvent.java#L50-L53). as we doesn't support fabric on android expo go, it should be fine to not upgrade slider 4.3 which is mainly for fabric support.

# How

- update to new style vendoring
- `et uvm -m @react-native-community/slider -c v4.2.4 -p android`
- `et uvm -m @react-native-community/slider -c v4.2.4 -p ios`

# Test Plan

- android unversioned expo go + NCL slider
- ios unversioned expo go + NCL slider
  • Loading branch information
Kudo committed Oct 7, 2022
1 parent e3115b1 commit d58f61a
Show file tree
Hide file tree
Showing 25 changed files with 133 additions and 99 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Expand Up @@ -20,6 +20,7 @@ Package-specific changes not released in any SDK will be added here just before
- Updated `@react-native-community/datetimepicker` from `6.2.0` to `6.5.0`. ([#19419](https://github.com/expo/expo/pull/19419) by [@byCedric](https://github.com/byCedric))
- Updated `react-native-maps` from `0.31.1` to `1.3.2`. ([#19414](https://github.com/expo/expo/pull/19414) by [@aleqsio](https://github.com/aleqsio))
- Updated `lottie-react-native` from `5.1.3` to `5.1.4`. ([#19433](https://github.com/expo/expo/pull/19433) by [@kudo](https://github.com/kudo))
- Updated `@react-native-community/slider` from `4.2.3` to `4.2.4`. ([#19424](https://github.com/expo/expo/pull/19424)) by [@kudo](https://github.com/kudo))

### 🛠 Breaking changes

Expand Down
Expand Up @@ -7,6 +7,7 @@ import com.facebook.react.ReactPackage
import com.facebook.react.bridge.NativeModule
import com.facebook.react.bridge.ReactApplicationContext
import com.facebook.react.uimanager.ViewManager
import com.reactnativecommunity.slider.ReactSliderPackage
import com.shopify.reactnative.flash_list.ReactNativeFlashListPackage
import com.shopify.reactnative.skia.RNSkiaPackage
import com.swmansion.rnscreens.RNScreensPackage
Expand Down Expand Up @@ -36,7 +37,6 @@ import versioned.host.exp.exponent.modules.api.components.picker.RNCPickerPackag
import versioned.host.exp.exponent.modules.api.components.reactnativestripesdk.StripeSdkPackage
import versioned.host.exp.exponent.modules.api.components.sharedelement.RNSharedElementModule
import versioned.host.exp.exponent.modules.api.components.sharedelement.RNSharedElementPackage
import versioned.host.exp.exponent.modules.api.components.slider.ReactSliderPackage
import versioned.host.exp.exponent.modules.api.components.svg.SvgPackage
import versioned.host.exp.exponent.modules.api.components.pagerview.PagerViewPackage
import versioned.host.exp.exponent.modules.api.components.webview.RNCWebViewModule
Expand Down
@@ -0,0 +1,40 @@
buildscript {
repositories {
mavenCentral()
google()
}

dependencies {
classpath 'com.android.tools.build:gradle:3.2.1'
}
}

def getExtOrDefault(name) {
return rootProject.ext.has(name) ? rootProject.ext.get(name) : project.properties['ReactNativeSlider_' + name]
}

def getExtOrIntegerDefault(name) {
return rootProject.ext.has(name) ? rootProject.ext.get(name) : (project.properties['ReactNativeSlider_' + name]).toInteger()
}

apply plugin: 'com.android.library'

android {
compileSdkVersion getExtOrIntegerDefault('compileSdkVersion')
buildToolsVersion getExtOrDefault('buildToolsVersion')

defaultConfig {
minSdkVersion getExtOrIntegerDefault('minSdkVersion')
targetSdkVersion getExtOrIntegerDefault('targetSdkVersion')
}
}

repositories {
google()
mavenCentral()
}

dependencies {
//noinspection GradleDynamicVersion
api 'com.facebook.react:react-native:+'
}
@@ -0,0 +1,3 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.reactnativecommunity.slider">
</manifest>
Expand Up @@ -4,7 +4,7 @@
* <p>This source code is licensed under the MIT license found in the LICENSE file in the root
* directory of this source tree.
*/
package versioned.host.exp.exponent.modules.api.components.slider;
package com.reactnativecommunity.slider;

import android.content.Context;
import android.graphics.Bitmap;
Expand Down Expand Up @@ -66,8 +66,8 @@ public class ReactSlider extends AppCompatSeekBar {

private List<String> mAccessibilityIncrements;

public ReactSlider(Context context, @Nullable AttributeSet attrs, int style) {
super(context, attrs, style);
public ReactSlider(Context context, @Nullable AttributeSet attrs) {
super(context, attrs);
I18nUtil sharedI18nUtilInstance = I18nUtil.getInstance();
super.setLayoutDirection(sharedI18nUtilInstance.isRTL(context) ? LAYOUT_DIRECTION_RTL : LAYOUT_DIRECTION_LTR);
disableStateListAnimatorIfNeeded();
Expand Down
Expand Up @@ -5,7 +5,7 @@
* LICENSE file in the root directory of this source tree.
*/

package versioned.host.exp.exponent.modules.api.components.slider;
package com.reactnativecommunity.slider;

import com.facebook.react.bridge.Arguments;
import com.facebook.react.bridge.WritableMap;
Expand Down
Expand Up @@ -5,7 +5,7 @@
* LICENSE file in the root directory of this source tree.
*/

package versioned.host.exp.exponent.modules.api.components.slider;
package com.reactnativecommunity.slider;

import android.graphics.PorterDuffColorFilter;
import android.os.Build;
Expand Down Expand Up @@ -38,8 +38,6 @@
*/
public class ReactSliderManager extends SimpleViewManager<ReactSlider> {

private static final int STYLE = android.R.attr.seekBarStyle;

public static final String REACT_CLASS = "RNCSlider";

static class ReactSliderShadowNode extends LayoutShadowNode implements
Expand All @@ -65,7 +63,7 @@ public long measure(
float height,
YogaMeasureMode heightMode) {
if (!mMeasured) {
SeekBar reactSlider = new ReactSlider(getThemedContext(), null, STYLE);
SeekBar reactSlider = new ReactSlider(getThemedContext(), null);
final int spec = View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED);
reactSlider.measure(spec, spec);
mWidth = reactSlider.getMeasuredWidth();
Expand Down Expand Up @@ -131,7 +129,7 @@ public Class getShadowNodeClass() {

@Override
protected ReactSlider createViewInstance(ThemedReactContext context) {
ReactSlider slider = new ReactSlider(context, null, STYLE);
ReactSlider slider = new ReactSlider(context, null);

if (Build.VERSION.SDK_INT >= 21) {
/**
Expand Down
@@ -1,4 +1,4 @@
package versioned.host.exp.exponent.modules.api.components.slider;
package com.reactnativecommunity.slider;

import java.util.Arrays;
import java.util.Collections;
Expand Down
Expand Up @@ -5,7 +5,7 @@
* LICENSE file in the root directory of this source tree.
*/

package versioned.host.exp.exponent.modules.api.components.slider;
package com.reactnativecommunity.slider;

import com.facebook.react.bridge.Arguments;
import com.facebook.react.bridge.WritableMap;
Expand Down
Expand Up @@ -5,7 +5,7 @@
* LICENSE file in the root directory of this source tree.
*/

package versioned.host.exp.exponent.modules.api.components.slider;
package com.reactnativecommunity.slider;

import com.facebook.react.bridge.Arguments;
import com.facebook.react.bridge.WritableMap;
Expand Down
2 changes: 1 addition & 1 deletion apps/bare-expo/package.json
Expand Up @@ -94,7 +94,7 @@
"@react-native-async-storage/async-storage": "~1.17.3",
"@react-native-community/datetimepicker": "6.5.0",
"@react-native-community/netinfo": "9.3.3",
"@react-native-community/slider": "4.2.3",
"@react-native-community/slider": "4.2.4",
"@react-native-community/viewpager": "5.0.11",
"@react-native-masked-view/masked-view": "0.2.6",
"@react-native-picker/picker": "2.4.6",
Expand Down
2 changes: 1 addition & 1 deletion apps/native-component-list/package.json
Expand Up @@ -44,7 +44,7 @@
"@react-native-async-storage/async-storage": "~1.17.3",
"@react-native-community/datetimepicker": "6.5.0",
"@react-native-community/netinfo": "9.3.3",
"@react-native-community/slider": "4.2.3",
"@react-native-community/slider": "4.2.4",
"@react-native-masked-view/masked-view": "0.2.6",
"@react-native-picker/picker": "2.4.6",
"@react-native-segmented-control/segmented-control": "2.4.0",
Expand Down
24 changes: 0 additions & 24 deletions ios/Exponent.xcodeproj/project.pbxproj

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit d58f61a

Please sign in to comment.