Coder Social home page Coder Social logo

callstack / react-native-slider Goto Github PK

View Code? Open in Web Editor NEW
1.2K 1.2K 267.0 28.24 MB

React Native component exposing Slider from iOS and SeekBar from Android

License: MIT License

Java 20.86% JavaScript 1.98% Objective-C 8.42% Ruby 2.25% C++ 18.84% C 0.07% Objective-C++ 6.84% TypeScript 37.13% HTML 0.98% CSS 0.21% Kotlin 1.47% CMake 0.95%
react-native seekbar slider

react-native-slider's Introduction

@react-native-community/slider

Latest version released on npmjs Build on GitHub Actions Supported platforms License

React Native component used to select a single value from a range of values.
Currently supported on following platforms:

iOS Android Windows Web
iOS Screenshot Android Screenshot Windows Screenshot Web Screenshot

Installation & Usage

To install this module cd to your project directory and enter the following command:

yarn add @react-native-community/slider

or

npm install @react-native-community/slider --save

If using iOS please remember to install cocoapods by running: npx pod-install

The following code presents the basic usage scenario of this library:

import Slider from '@react-native-community/slider';

<Slider
  style={{width: 200, height: 40}}
  minimumValue={0}
  maximumValue={1}
  minimumTrackTintColor="#FFFFFF"
  maximumTrackTintColor="#000000"
/>

Check out the example project for more examples.


Migrating from the core react-native module

This module was created when the Slider was split out from the core of React Native.
To migrate to this module you need to follow the installation instructions above and then change you imports from:

import { Slider } from 'react-native';

to:

import Slider from '@react-native-community/slider';

React Native Compatibility

To use this library you need to ensure you are using the correct version of React Native.

@react-native-community/slider version Required React Native Version
4.3.0 >=0.64
4.x.x >=0.60; >=0.62 (on Windows);
3.1.x >=0.60
2.x.x >= 0.60
1.x.x <= 0.59

Properties

Property Description Type Required Platform
style Used to style and layout the Slider. See StyleSheet.js and ViewStylePropTypes.js for more info. View.style No
disabled If true the user won't be able to move the slider.
Default value is false.
bool No
maximumValue Initial maximum value of the slider.
Default value is 1.
number No
minimumTrackTintColor The color used for the track to the left of the button.
Overrides the default blue gradient image on iOS.
color No
minimumValue Initial minimum value of the slider.
Default value is 0.
number No
lowerLimit Slide lower limit. The user won't be able to slide below this limit. number No Android, iOS, Web
upperLimit Slide upper limit. The user won't be able to slide above this limit. number No Android, iOS, Web
onSlidingStart Callback that is called when the user picks up the slider.
The initial value is passed as an argument to the callback handler.
function No
onSlidingComplete Callback that is called when the user releases the slider, regardless if the value has changed.
The current value is passed as an argument to the callback handler.
function No
onValueChange Callback continuously called while the user is dragging the slider. function No
step Step value of the slider. The value should be between 0 and (maximumValue - minimumValue). Default value is 0.
On Windows OS the default value is 1% of slider's range (from minimumValue to maximumValue).
number No
maximumTrackTintColor The color used for the track to the right of the button.
Overrides the default gray gradient image on iOS.
color No
testID Used to locate this view in UI automation tests. string No
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.
The value should be between minimumValue and maximumValue, which default to 0 and 1 respectively. Default value is 0.
This is not a controlled component, you don't need to update the value during dragging.
number No
tapToSeek Permits tapping on the slider track to set the thumb position.
Defaults to false on iOS. No effect on Android or Windows.
bool No iOS
inverted Reverses the direction of the slider.
Default value is false.
bool No
vertical Changes the orientation of the slider to vertical, if set to true.
Default value is false.
bool No Windows
thumbTintColor Color of the foreground switch grip.
NOTE: This prop will override the thumbImage prop set, meaning that if both thumbImage and thumbTintColor will be set, image used for the thumb may not be displayed correctly!
color No Android
maximumTrackImage Assigns a maximum track image. Only static images are supported. The leftmost pixel of the image will be stretched to fill the track. Image
.propTypes
.source
No iOS
minimumTrackImage Assigns a minimum track image. Only static images are supported. The rightmost pixel of the image will be stretched to fill the track. Image
.propTypes
.source
No iOS
thumbImage Sets an image for the thumb. Only static images are supported. Needs to be a URI of a local or network image; base64-encoded SVG is not supported. Image
.propTypes
.source
No
trackImage Assigns a single image for the track. Only static images are supported. The center pixel of the image will be stretched to fill the track. Image
.propTypes
.source
No iOS
⚠️ Experimental:
StepMarker
Component to be rendered for each step on the track,
with the possibility to change the styling, when thumb is at that given step
FC<MarkerProps>,
where
MarkerProps: {stepMarked: boolean}
No iOS, Android, Windows
⚠️ Experimental:
renderStepNumber
Turns on the displaying of numbers of steps.
Numbers of steps are displayed under the track
bool No iOS, Android, Windows
ref Reference object. MutableRefObject No web
View Inherited View props...

Roadmap and Progress

There's a Project board available here which contains all reported issues organized into columns regarding their status.

If you are interested in knowing whether the issue you reported is handled or just to check the status of a feature you would like to have in Slider, please check the board.

Contributing

The main package implementation is done in the package/ directory. So when implementing changes there, make sure your code passes ESLint and the tests. Run the following to verify:

cd package/
npm run lint
npm run test
  • Remember to cover your changes with tests if possible.

When creating an issue please remember to specify the platform which the issue occurs on.

Running the example app

While developing, you can run the example app to test your changes.

Setup

  • Clone the repository
  • Run npm install in the root directory to install dependencies.
  • Run npm run example-<platform>, where platform can be: ios, android, windows

You can also do this manually by:

  • Installing node modules for example app
  • Installing pods for iOS app
  • Running example app like always: npx react-native run-<platform>

New architecture setup (Fabric)

In order to use the new architecture some extra steps are needed.

iOS

  • Install pods with new arch flag inside example/ios folder: RCT_NEW_ARCH_ENABLED=1 pod install
  • Run npm run example-ios

Android

  • Set newArchEnabled to true inside example/android/gradle.properties
  • Run npm run example-android
If you are using React Native version lower than 0.70, you need to setup manual linking for Android to work.

Inside example/android/app/src/main/jni/Android.mk add these lines:

+ include $(NODE_MODULES_DIR)/@react-native-community/slider/android/build/generated/source/codegen/jni/Android.mk
include $(CLEAR_VARS)
    libreact_codegen_rncore \
+   libreact_codegen_ReactSlider \
    libreact_debug \

Inside example/android/app/src/main/jni/MainComponentsRegistry.cpp update these lines:

#include <react/renderer/components/rncore/ComponentDescriptors.h>
+ #include <react/renderer/components/ReactSlider/ComponentDescriptors.h>

...

MainComponentsRegistry::sharedProviderRegistry() {
  auto providerRegistry = CoreComponentsRegistry::sharedProviderRegistry();

  // Custom Fabric Components go here. You can register custom
  // components coming from your App or from 3rd party libraries here.
  //
  // providerRegistry->add(concreteComponentDescriptorProvider<
  //        AocViewerComponentDescriptor>());
+ providerRegistry->add(concreteComponentDescriptorProvider<RNCSliderComponentDescriptor>());

  return providerRegistry;
}

Maintainers

Contributors

This module was extracted from react-native core. Please, refer to contributors graph for the complete list of contributors.


Made with ❤️ at Callstack

@callstack/react-native-slider is an open source project and will always remain free to use. If you think it's cool, please star it 🌟. Callstack is a group of React and React Native geeks, contact us at [email protected] if you need any help with these or just want to say hi!

Like the project? ⚛️ Join the team who does amazing stuff for clients and drives React Native Open Source! 🔥

react-native-slider's People

Contributors

bartoszklonowski avatar chakrihacker avatar davidaurelio avatar dependabot[bot] avatar dratwas avatar dstdnk avatar javache avatar jspizziri avatar karanjthakkar avatar landabaso avatar manask88 avatar markcsmith avatar mdvacca avatar michalchudziak avatar mikehardy avatar mikelambert avatar nicklockwood avatar okwasniewski avatar pbitkowski avatar rectified95 avatar retyui avatar rubennorte avatar sahrens avatar shergin avatar sophiebits avatar tadeuzagallo avatar thesavior avatar vjeux avatar wojteg1337 avatar yungsters avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

react-native-slider's Issues

Vertical Slider on Android Nougat

Description

Hi, I've tried to rotate the slider to vertical using "transform:rotate" and it show me this. I've tested this on Samsung Galaxy S7 edge on Android Nougat.

Any thoughts about why this is happening?

Reproducible Demo

ezgif-4-1084633681e9

Remove space before and after the slider bar

When a new Slideer is created, it is created inside a view and I can see an space before and after the slider (just set backgroundColor='red' on the style)

This is quite annoying in order to make it if with other components as the slider is always a bit smaller

Is this done in purpose? Can those spaces (padding or margin) be removed and make the bar use 100%

I tried setting the padding, margin, left, right to 0, but nothing...

Passing an array of values

Describe the Feature

A values props that takes an array of discrete values and only allows the slider to go through those values, e.g. see this jquery widget.

Possible Implementations

Not sure yet. Going to look into it and add it. Would you be interested in a pull request?

Related Issues

None

trackStyle and thumbStyle

in past version that depricated we have two property trackStyle and thumbStyle , but in this version of react-native-slider we have not this feature !! what do i for change thumb and track style ? :((

[ios] Setting thumbImage doesn't work if thumbTintColor is also set

Environment

info 
  React Native Environment Info:
    System:
      OS: macOS 10.14.2
      CPU: (8) x64 Intel(R) Core(TM) i5-8259U CPU @ 2.30GHz
      Memory: 511.48 MB / 16.00 GB
      Shell: 3.2.57 - /bin/bash
    Binaries:
      Node: 12.1.0 - /usr/local/bin/node
      Yarn: 1.16.0 - /usr/local/bin/yarn
      npm: 6.9.0 - /usr/local/bin/npm
      Watchman: 4.9.0 - /usr/local/bin/watchman
    SDKs:
      iOS SDK:
        Platforms: iOS 12.1, macOS 10.14, tvOS 12.1, watchOS 5.1
      Android SDK:
        API Levels: 19, 20, 22, 23, 24, 25, 26, 27, 28
        Build Tools: 19.1.0, 22.0.1, 23.0.2, 23.0.3, 25.0.0, 25.0.2, 26.0.1, 26.0.2, 26.0.3, 27.0.3, 28.0.2, 28.0.3
        System Images: android-23 | Google APIs Intel x86 Atom
    IDEs:
      Android Studio: 3.2 AI-181.5540.7.32.5056338
      Xcode: 10.1/10B61 - /usr/bin/xcodebuild
    npmPackages:
      react: 16.8.3 => 16.8.3 
      react-native: 0.59.9 => 0.59.9 
    npmGlobalPackages:
      create-react-native-app: 1.0.0
      react-native-cli: 1.3.0
      react-native-git-upgrade: 0.2.7
      react-native-rename: 2.3.2

Description

I have just upgraded from RN 0.57.7 to RN 0.59.9 and alongside it moved to this version of Slider due to the deprecation warnings. I noticed that my thumb image had stopped working on iOS, and after some debugging realised that if I commented out the thumbTintColor it would then use the image correctly. However, of course I need the tint for Android, so I've worked around it with a Platform.select, but this doesn't seem ideal.

Reproducible Demo

Broken:

    <Slider
      thumbTintColor={PRIMARY_COLOR}
      ...
      thumbImage={require('../../assets/images/icons/playback-position.png')}
    />

thumbImage doesn't render.

Working:

    <Slider
      thumbTintColor={Platform.select({ ios: null, android: PRIMARY_COLOR })}
      ...
      thumbImage={require('../../assets/images/icons/playback-position.png')}
    />

thumbImage renders.

Build android with the latest rn-0.59.5

Ask your Question

Build file '/Users/name/project/node_modules/@react-native-community/slider/android/build.gradle' line: 40

* What went wrong:
A problem occurred evaluating project ':react-native-community-slider'.
> Cannot get property 'supportLibVersion' on extra properties extension as it does not exist

I've never used supportLibVersion in my setup and have no idea how to use it now correctly. Can you please provide some help by explanation?

Android: Tint color inconsistency

Environment

  React Native Environment Info:
    System:
      OS: macOS 10.14.5
      CPU: (8) x64 Intel(R) Core(TM) i7-4850HQ CPU @ 2.30GHz
      Memory: 1.16 GB / 16.00 GB
      Shell: 3.2.57 - /bin/bash
    Binaries:
      Node: 11.14.0 - ~/.nvm/versions/node/v11.14.0/bin/node
      Yarn: 1.15.2 - ~/.yarn/bin/yarn
      npm: 6.9.0 - ~/.nvm/versions/node/v11.14.0/bin/npm
      Watchman: 3.9.0 - /usr/local/bin/watchman
    SDKs:
      iOS SDK:
        Platforms: iOS 12.2, macOS 10.14, tvOS 12.2, watchOS 5.2
      Android SDK:
        API Levels: 23, 24, 25, 26, 27, 28
        Build Tools: 23.0.1, 23.0.2, 23.0.3, 24.0.0, 25.0.0, 25.0.1, 25.0.2, 25.0.3, 26.0.1, 26.0.2, 26.0.3, 27.0.1, 27.0.2, 27.0.3, 28.0.3
        System Images: android-19 | Google APIs Intel x86 Atom, android-23 | Google APIs Intel x86 Atom, android-24 | Google APIs Intel x86 Atom, android-25 | Google Play Intel x86 Atom, android-26 | Google APIs Intel x86 Atom, android-26 | Google Play Intel x86 Atom, android-27 | Google APIs Intel x86 Atom, android-27 | Google Play Intel x86 Atom, android-28 | Google Play Intel x86 Atom
    IDEs:
      Android Studio: 3.4 AI-183.6156.11.34.5522156
      Xcode: 10.2.1/10E1001 - /usr/bin/xcodebuild
    npmPackages:
      react: 16.8.3 => 16.8.3
      react-native: 0.59.8 => 0.59.8
    npmGlobalPackages:
      react-native-cli: 2.0.1
      react-native-git-upgrade: 0.2.7

Description

When maximumTintColor matches minimumTintColor, Android overrides the colour setting and makes maximumTintColor lighter than minimumTintColor.

Also, something like below will be ignored as it appears that Android likes to paint a more visible shade on the minimum side.

{ minimumTrackTintColor: 'rgba(255,255,255,0.1)', maximumTrackTintColor: 'rgba(255,255,255,0.4)' }

iOS thumbTintColor causes handle to offset slightly

Environment

System:
OS: macOS 10.14.4
CPU: (8) x64 Intel(R) Core(TM) i7-7920HQ CPU @ 3.10GHz
Memory: 1.13 GB / 16.00 GB
Shell: 3.2.57 - /bin/bash
Binaries:
Node: 8.12.0 - ~/.nvm/versions/node/v8.12.0/bin/node
Yarn: 1.17.3 - /usr/local/bin/yarn
npm: 6.9.0 - ~/.nvm/versions/node/v8.12.0/bin/npm
Watchman: 4.9.0 - /usr/local/bin/watchman
SDKs:
iOS SDK:
Platforms: iOS 12.4, macOS 10.14, tvOS 12.4, watchOS 5.3
Android SDK:
API Levels: 22, 23, 26, 27, 28
Build Tools: 23.0.1, 26.0.0, 26.0.1, 26.0.2, 26.0.3, 27.0.3, 28.0.0, 28.0.2, 28.0.3, 29.0.1
System Images: android-22 | Google APIs Intel x86 Atom, android-23 | Google APIs Intel x86 Atom, android-26 | Google Play Intel x86 Atom, android-27 | Intel x86 Atom_64, android-27 | Google APIs Intel x86 Atom, android-28 | Google APIs Intel x86 Atom, android-28 | Google Play Intel x86 Atom
IDEs:
Android Studio: 3.4 AI-183.6156.11.34.5692245
Xcode: 10.3/10G8 - /usr/bin/xcodebuild
npmPackages:
react: 16.8.6 => 16.8.6
react-native: 0.60.3 => 0.60.3

Description

Not sure if this is a regression or even if it's new to this new community edition. But I noticed on iOS when I set the tint color of the thumb, it'll pull the slider to the right slightly.

Tint-Color-iOS

Ignore the tick marks, that's my own doing and not related.

Reproducible Demo

<Slider thumbTintColor={'orange'} />

vs

<Slider />

thumbImage support @2x @3x

Ask your Question

Is the prop thumbImage support @2x @3x,
and it will choice the right image automatic.

Or is there something like thumbStyle could define the style of thumb

Support native events

Describe the Feature

Native Events instead of js events:
onValueChange
onSlidingStart
onSlidingComplete

Possible Implementations

Supporting native events will unlock the abilities of Animated.event enabling tracking the Slider's value and animating stuff accordingly.
This will enable customizing this view to a large extent easily and with high performance.

Avoiding breaking changes can be achieved with a flag from props or by checking typeof props.onValueChange === 'object'

.

Android JS Impl

Uses Slider for value and renders the rest on top.
Native events will enhance this extremely and make dev experience easier (less code needed for customization)

Color Slider

Related Issues

Installing iOS as pod throws errors because of missing package.json details

Environment

React Native Environment Info:
System:
OS: macOS 10.14.3
CPU: (4) x64 Intel(R) Core(TM) i5-5287U CPU @ 2.90GHz
Memory: 42.91 MB / 8.00 GB
Shell: 5.3 - /bin/zsh
Binaries:
Node: 11.8.0 - ~/.nvm/versions/node/v11.8.0/bin/node
Yarn: 1.13.0 - /usr/local/bin/yarn
npm: 6.5.0 - ~/.nvm/versions/node/v11.8.0/bin/npm
Watchman: 4.9.0 - /usr/local/bin/watchman
SDKs:
iOS SDK:
Platforms: iOS 12.1, macOS 10.14, tvOS 12.1, watchOS 5.1
Android SDK:
API Levels: 23, 24, 25, 26, 27, 28
Build Tools: 23.0.1, 25.0.1, 25.0.2, 25.0.3, 26.0.1, 26.0.2, 27.0.3, 28.0.0, 28.0.2, 28.0.3
System Images: android-23 | Intel x86 Atom, android-25 | Google APIs Intel x86 Atom, android-26 | Google APIs Intel x86 Atom, android-27 | Google APIs Intel x86 Atom, android-28 | Google Play Intel x86 Atom
IDEs:
Android Studio: 3.3 AI-182.5107.16.33.5199772
Xcode: 10.1/10B61 - /usr/bin/xcodebuild
npmPackages:
react: 16.8.3 => 16.8.3
react-native: 0.59.0 => 0.59.0

Description

When install slider as a pod, process aborting because of following:

[!] The `react-native-slider` pod failed to validate due to 3 errors:
    - ERROR | attributes: Missing required attribute `authors`.
    - WARN  | attributes: Missing required attribute `license`.
    - ERROR | attributes: Missing required attribute `homepage`.
    - ERROR | attributes: Missing required attribute `summary`.
    - WARN  | license: Missing license type.

Reproducible Demo

  1. yarn add @react-native-community/slider
  2. add pod 'react-native-slider', :path => '../node_modules/@react-native-community/slider' to Podfile
  3. pod install

ReactSlider crash on Android release version


This issue was originally created by @ssg-luke as facebook/react-native#9979.


Issue Description

Hard crash randomly and unexpectedly on Android release version only (debug is fine, iOS is fine on both debug and release) when hiding and displaying sliders based on a state variable.

Steps to Reproduce / Code Snippets

We have a number of photo filters in our app which are selected by <TouchableOpacity> components and some have a slider to adjust the blur or brightness etc. These sliders are completely separate from each other and are displayed based on a string stored in the components state called filter.

Here is one such slider from render():

{filter === 'gamify' && ( <View style={styles.filterSlider}> <Text>How retro do you want to go?</Text> <Slider value={this.state.pixelSize} minimumValue={1} maximumValue={5} onValueChange={value => this.setState({pixelSize: value})} /> </View>)}

Expected Results

No crash when hiding and displaying sliders

Stack Trace

java.lang.NullPointerException: Attempt to write to field 'java.util.ArrayList android.animation.AnimatorSet$Node.nodeDependents' on a null object reference

http://pastebin.com/270Wg6Pu

Additional Information

  • React Native version: 0.33
  • Platform(s) (iOS, Android, or both?): Android (Release only)
  • Operating System (macOS, Linux, or Windows?): Mac OSX

Current version does not work.

Running yarn add @react-native-community/slider pulls down the broken version ^1.1.0 even though a later commit reverts the change back to 1.0.4.

Suggest bumping to 1.1.1 or similar to keep moving forward even if the code is the same as 1.0.4 under the hood, as I guess our dependency tools just ain't that smart.

As an aside "@react-native-community/slider": "https://github.com/react-native-community/react-native-slider.git#ede6b7378c06b6ff607d3f51d7d4454b314119e3", in my package.json works fine.

Build failed with an exception

Environment

React Native Environment Info:
System:
OS: Windows 10
CPU: (12) x64 AMD Ryzen 5 2600 Six-Core Processor
Memory: 21.67 GB / 31.94 GB
Binaries:
Yarn: 1.15.2 - C:\Users\Cheetahweb\AppData\Roaming\npm\yarn.CMD
npm: 6.4.1 - C:\Program Files\nodejs\npm.CMD
IDEs:
Android Studio: Version 3.3.0.0 AI-182.5107.16.33.5314842

Description

After installing react native slider with docs always gives me this error:

Could not determine the dependencies of task ':@react-native-community_slider:compileDebugAidl'.

Could not resolve all task dependencies for configuration ':@react-native-community_slider:debugCompileClasspath'.
Could not find androidx.appcompat:appcompat:28.0.0.
Required by:
project :@react-native-community_slider
Could not find androidx.appcompat:appcompat:28.0.0.
Required by:
project :@react-native-community_slider > com.facebook.react:react-native:0.59.5

-->

Yoga not found when run

Environment

info
  React Native Environment Info:
    System:
      OS: macOS 10.14.5
      CPU: (8) x64 Intel(R) Core(TM) i7-4850HQ CPU @ 2.30GHz
      Memory: 567.39 MB / 16.00 GB
      Shell: 3.2.57 - /bin/bash
    Binaries:
      Node: 8.4.0 - ~/.nvm/versions/node/v8.4.0/bin/node
      npm: 6.3.0 - ~/.nvm/versions/node/v8.4.0/bin/npm
      Watchman: 4.7.0 - /usr/local/bin/watchman
    SDKs:
      iOS SDK:
        Platforms: iOS 12.2, macOS 10.14, tvOS 12.2, watchOS 5.2
      Android SDK:
        API Levels: 19, 23, 25, 26, 27, 28
        Build Tools: 23.0.1, 25.0.2, 25.0.3, 26.0.1, 26.0.2, 26.0.3, 27.0.1, 27.0.3, 28.0.3
        System Images: android-19 | Intel x86 Atom, android-22 | Google APIs Intel x86 Atom, android-23 | Intel x86 Atom_64, android-23 | Google APIs Intel x86 Atom_64, android-26 | Google APIs Intel x86 Atom, android-26 | Google Play Intel x86 Atom, android-27 | Google APIs Intel x86 Atom
    IDEs:
      Android Studio: 3.3 AI-182.5107.16.33.5264788
      Xcode: 10.2.1/10E1001 - /usr/bin/xcodebuild
    npmPackages:
      react: 16.6.3 => 16.6.3
      react-native: ^0.59.3 => 0.59.3
    npmGlobalPackages:
      create-react-native-app: 2.0.2
      react-native-cli: 2.0.1
      react-native-git-upgrade: 0.2.7

Description

I've installed react-native-slider and on iOS works without problem, in Android I've got this error:

/Users/Mattia/Documents/Projects/Line/RideMe/Mobile/node_modules/@react-native-community/slider/android/src/main/java/com/reactnativecommunity/slider/ReactSliderManager.java:19: error: cannot find symbol
import com.facebook.react.uimanager.ReactShadowNodeImpl;
                                   ^
  symbol:   class ReactShadowNodeImpl
  location: package com.facebook.react.uimanager
/Users/Mattia/Documents/Projects/Line/RideMe/Mobile/node_modules/@react-native-community/slider/android/src/main/java/com/reactnativecommunity/slider/ReactSliderManager.java:26: error: package com.facebook.yoga does not exist
import com.facebook.yoga.YogaMeasureFunction;
                        ^
/Users/Mattia/Documents/Projects/Line/RideMe/Mobile/node_modules/@react-native-community/slider/android/src/main/java/com/reactnativecommunity/slider/ReactSliderManager.java:27: error: package com.facebook.yoga does not exist
import com.facebook.yoga.YogaMeasureMode;
                        ^
/Users/Mattia/Documents/Projects/Line/RideMe/Mobile/node_modules/@react-native-community/slider/android/src/main/java/com/reactnativecommunity/slider/ReactSliderManager.java:28: error: package com.facebook.yoga does not exist
import com.facebook.yoga.YogaMeasureOutput;
                        ^
/Users/Mattia/Documents/Projects/Line/RideMe/Mobile/node_modules/@react-native-community/slider/android/src/main/java/com/reactnativecommunity/slider/ReactSliderManager.java:29: error: package com.facebook.yoga does not exist
import com.facebook.yoga.YogaNode;
                        ^
/Users/Mattia/Documents/Projects/Line/RideMe/Mobile/node_modules/@react-native-community/slider/android/src/main/java/com/reactnativecommunity/slider/ReactSliderManager.java:44: error: cannot find symbol
      YogaMeasureFunction {
      ^
  symbol:   class YogaMeasureFunction
  location: class ReactSliderManager
/Users/Mattia/Documents/Projects/Line/RideMe/Mobile/node_modules/@react-native-community/slider/android/src/main/java/com/reactnativecommunity/slider/ReactSliderManager.java:60: error: cannot find symbol
        YogaNode node,
        ^
  symbol:   class YogaNode
  location: class ReactSliderShadowNode
/Users/Mattia/Documents/Projects/Line/RideMe/Mobile/node_modules/@react-native-community/slider/android/src/main/java/com/reactnativecommunity/slider/ReactSliderManager.java:62: error: cannot find symbol
        YogaMeasureMode widthMode,
        ^
  symbol:   class YogaMeasureMode
  location: class ReactSliderShadowNode
/Users/Mattia/Documents/Projects/Line/RideMe/Mobile/node_modules/@react-native-community/slider/android/src/main/java/com/reactnativecommunity/slider/ReactSliderManager.java:64: error: cannot find symbol
        YogaMeasureMode heightMode) {
        ^
  symbol:   class YogaMeasureMode
  location: class ReactSliderShadowNode
/Users/Mattia/Documents/Projects/Line/RideMe/Mobile/node_modules/@react-native-community/slider/android/src/main/java/com/reactnativecommunity/slider/ReactSliderManager.java:55: error: incompatible types: ReactSliderShadowNode cannot be converted to MeasureFunction
      setMeasureFunction(this);
                         ^
/Users/Mattia/Documents/Projects/Line/RideMe/Mobile/node_modules/@react-native-community/slider/android/src/main/java/com/reactnativecommunity/slider/ReactSliderManager.java:58: error: method does not override or implement a method from a supertype
    @Override
    ^
/Users/Mattia/Documents/Projects/Line/RideMe/Mobile/node_modules/@react-native-community/slider/android/src/main/java/com/reactnativecommunity/slider/ReactSliderManager.java:76: error: cannot find symbol
      return YogaMeasureOutput.make(mWidth, mHeight);
             ^
  symbol:   variable YogaMeasureOutput
  location: class ReactSliderShadowNode
/Users/Mattia/Documents/Projects/Line/RideMe/Mobile/node_modules/@react-native-community/slider/android/src/main/java/com/reactnativecommunity/slider/ReactSliderEvent.java:26: error: no suitable constructor found for Event(int)
    super(viewId);
    ^
    constructor Event.Event() is not applicable
      (actual and formal argument lists differ in length)
    constructor Event.Event(int,long) is not applicable
      (actual and formal argument lists differ in length)
/Users/Mattia/Documents/Projects/Line/RideMe/Mobile/node_modules/@react-native-community/slider/android/src/main/java/com/reactnativecommunity/slider/ReactSlidingCompleteEvent.java:25: error: no suitable constructor found for Event(int)
        super(viewId);
        ^
    constructor Event.Event() is not applicable
      (actual and formal argument lists differ in length)
    constructor Event.Event(int,long) is not applicable
      (actual and formal argument lists differ in length)
/Users/Mattia/Documents/Projects/Line/RideMe/Mobile/node_modules/@react-native-community/slider/android/src/main/java/com/reactnativecommunity/slider/ReactSlidingStartEvent.java:25: error: no suitable constructor found for Event(int)
        super(viewId);
        ^
    constructor Event.Event() is not applicable
      (actual and formal argument lists differ in length)
    constructor Event.Event(int,long) is not applicable
      (actual and formal argument lists differ in length)
Note: /Users/Mattia/Documents/Projects/Line/RideMe/Mobile/node_modules/@react-native-community/slider/android/src/main/java/com/reactnativecommunity/slider/ReactSliderManager.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
Note: Some messages have been simplified; recompile with -Xdiags:verbose to get full output
15 errors

FAILURE: Build failed with an exception.

Reproducible Demo

This is my gradle

buildscript {
    ext {
        buildToolsVersion = "28.0.3"
        minSdkVersion = 23
        compileSdkVersion = 27
        targetSdkVersion = 8
        supportLibVersion = "27.0.1"
        googlePlayServicesVersion = "16.+"
        playServicesVersion = "17.+"
    }
    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.3.0'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        mavenLocal()
        google()
        jcenter()
    }
}

wrapper {
    gradleVersion = '4.4'
    distributionUrl = distributionUrl.replace("bin", "all")
}

Upgrading to AndroidX (required for RN 0.60.x) breaks this package

Environment

System:
OS: macOS 10.14.5
CPU: (4) x64 Intel(R) Core(TM) i5-5287U CPU @ 2.90GHz
Memory: 73.84 MB / 8.00 GB
Shell: 3.2.57 - /bin/bash
Binaries:
Node: 11.13.0 - /var/folders/11/4dsnq9p12xx9s0lt7l20fbfh0000gq/T/yarn--1563831095058-0.9824635078112827/node
Yarn: 1.15.2 - /var/folders/11/4dsnq9p12xx9s0lt7l20fbfh0000gq/T/yarn--1563831095058-0.9824635078112827/yarn
npm: 6.7.0 - /usr/local/bin/npm
Watchman: 4.9.0 - /usr/local/bin/watchman
SDKs:
iOS SDK:
Platforms: iOS 12.2, macOS 10.14, tvOS 12.2, watchOS 5.2
Android SDK:
API Levels: 26, 27, 28
Build Tools: 26.0.2, 27.0.3, 28.0.3
System Images: android-27 | Google APIs Intel x86 Atom, android-27 | Google Play Intel x86 Atom, android-28 | Google APIs Intel x86 Atom
IDEs:
Android Studio: 3.3 AI-182.5107.16.33.5314842
Xcode: 10.2.1/10E1001 - /usr/bin/xcodebuild
npmPackages:
@react-native-community/cli: ^2.7.0 => 2.7.0
react: 16.8.6 => 16.8.6
react-native: 0.60.4 => 0.60.4

Description

This isn't a AndroidX compatible package. AFAIK React native 0.60 + requires you to use AndroidX.

Reproducible Demo

N/A

Testing plan

We should cover this component with unit/e2e tests.
I think with a free plan of CircleCI, we won't be able to run everything on the remote container (building ios, etc.), but at least some checks should be invoked there.

We can think of implementing the native/e2e tests but run them only locally.

RCTSlider produces a line no matter even when all colors values match background color


This issue was originally created by @bobber205 as facebook/react-native#23388.


🐛 Bug Report

The view that contains my Slider component is rgb(236,245,255)
I've set both minimumTrackTintColor and maximumTrackTintColor to rgb(236,245,255) as well.

As you can see in the attached screenshot there is always a slight grey shadow or gradient or something that is visible. My intention with setting the colors this way is to make a slider that is just under or above an image that gives the user more info on the value they are selecting.

Code Example

https://snack.expo.io/ry6ciFkS4

Environment

React Native Environment Info:
System:
OS: macOS High Sierra 10.13.6
CPU: (4) x64 Intel(R) Core(TM) i5-5287U CPU @ 2.90GHz
Memory: 58.29 MB / 8.00 GB
Shell: 3.2.57 - /bin/bash
Binaries:
Node: 11.6.0 - /usr/local/bin/node
Yarn: 1.13.0 - /usr/local/bin/yarn
npm: 6.5.0 - /usr/local/bin/npm
Watchman: 4.9.0 - /usr/local/bin/watchman
SDKs:
iOS SDK:
Platforms: iOS 12.1, macOS 10.14, tvOS 12.1, watchOS 5.1
Android SDK:
API Levels: 26, 27, 28
Build Tools: 26.0.2, 27.0.3, 28.0.3
System Images: android-27 | Google APIs Intel x86 Atom, android-27 | Google Play Intel x86 Atom, android-28 | Google APIs Intel x86 Atom
IDEs:
Android Studio: 3.2 AI-181.5540.7.32.5056338
Xcode: 10.1/10B61 - /usr/bin/xcodebuild
npmPackages:
react: 16.6.3 => 16.6.3
react-native: 0.57.8 => 0.57.8

Is there anyway to prevent that VERY slight grey line?

react native slider issue zoomed in

How to adjust the size of the thumb button

...
<Slider
    style={styles.scheduleBar}
    minimumValue={0}
    maximumValue={120}
    minimumTrackTintColor="#FFFFFF"
    maximumTrackTintColor="#000000"
    thumbImage={'../styles/dark/dot.png'}
    step={1}
 />
...

How to adjust the size of the thumb button,I checked the issue and found no useful information. Now it works on my page, but the thumb button is too big and looks very ugly

Automate publishing with semantic-release

Describe the Feature

I'd like to automate the publishing process with semantic-release. It should be done after #33 is closed.

Possible Implementations

  • Install semantic-release
  • Run scripts on CI

Related Issues

#33

RTL Support

Describe the Feature

The slider works but in LTR on RTL forced apps. It would be great to support RTL.

cannot use pods

Environment

Description

[!] /usr/bin/git clone https://github.com/react-native-community/react-native-slider.git /var/folders/74/djpw5tk1149dvyhglpjv1s0h0000gn/T/d20190510-55204-rxuuor --template= --single-branch --depth 1 --branch 1.1.1

Cloning into '/var/folders/74/djpw5tk1149dvyhglpjv1s0h0000gn/T/d20190510-55204-rxuuor'...
warning: Could not find remote branch 1.1.1 to clone.
fatal: Remote branch 1.1.1 not found in upstream origin

Reproducible Demo

Does not support typescript

Environment

Using react-native-web unfortunately so can't get diagnostics.

Description

Component explodes app with this error:

./node_modules/@react-native-community/slider/js/Slider.js
SyntaxError: /app/node_modules/@react-native-community/slider/js/Slider.js: Unexpected token (17:12)

  15 | const RCTSliderNativeComponent = require('./RNCSliderNativeComponent');
  16 | 
> 17 | import type {NativeComponent} from 'react-native/Libraries/Renderer/shims/ReactNative';
     |             ^
  18 | import type {ImageSource} from 'react-native/Libraries/Image/ImageSource';
  19 | import type {ViewStyleProp} from 'react-native/Libraries/StyleSheet/StyleSheet';
  20 | import type {ColorValue} from 'react-native/Libraries/StyleSheet/StyleSheetTypes';

Reproducible Demo

I can add if required but it looks like the flow types are tripping up, so should be easy to test on any react-native typescript project.

Android build lint error - "Value must be ? 0 (was -2)"

Environment

System:
    OS: Windows 10
    CPU: (4) x64 Intel(R) Core(TM) i5-4690K CPU @ 3.50GHz
    Memory: 1.63 GB / 7.89 GB
  Binaries:
    Node: 11.14.0 - C:\Program Files\nodejs\node.EXE
    npm: 6.9.0 - C:\Program Files\nodejs\npm.CMD

Description

When I try to build android app with command gradlew build, I get the following lint error.

Execution failed for task ':@react-native-community_slider:lint'.
> Lint found errors in the project; aborting build.

\node_modules\@react-native-community\slider\android\src\main\java\com\reactnativecommunity\slider\ReactSliderManager.java:68: Error: Value must be ? 0 (was -2) [Range]
              ViewGroup.LayoutParams.WRAP_CONTENT,
              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

https://github.com/react-native-community/react-native-slider/blob/master/android/src/main/java/com/reactnativecommunity/slider/ReactSliderManager.java#L68

Reproducible Demo

Run android app build with gradlew build command.

Vertical Slider

Describe the Feature

Same slider but for vertical orientation
Is it supported?

Is it possible to have another zone at the right of the thumb, for video pre-load?

I want to use the slider as a video progress bar. On youtube for example, the progress bar has a zone that shows how much of the video is already loaded in memory.

Is there a way to add a zone of a different color at the right of the thumb, that would represent the section of the video being loaded at a specific time?

See the image bellow for a better understanding:

Screenshot 2019-06-10 at 17 19 24

Version bump to 1.1.0 breaks npm install

Description

Yesterday, version 1.1.0 has been published but then reverted again. Still, npm lists 1.1.0 as the newest version and currently you manually need to pin to 1.0.4 to have it work.

Can you either increase the version of 1.0.4 or revoke 1.1.0 from npm?

[iOS] When I press slider there is no reaction.

Environment

info
React Native Environment Info:
System:
OS: macOS 10.14.4
CPU: (8) x64 Intel(R) Core(TM) i7-7820HQ CPU @ 2.90GHz
Memory: 53.64 MB / 16.00 GB
Shell: 3.2.57 - /bin/bash
Binaries:
Node: 8.11.1 - /usr/local/bin/node
Yarn: 1.10.1 - /usr/local/bin/yarn
npm: 6.4.1 - /usr/local/bin/npm
Watchman: 4.9.0 - /usr/local/bin/watchman
SDKs:
iOS SDK:
Platforms: iOS 12.2, macOS 10.14, tvOS 12.2, watchOS 5.2
Android SDK:
API Levels: 23, 25, 26, 27, 28
Build Tools: 23.0.1, 23.0.3, 25.0.2, 25.0.3, 26.0.1, 26.0.2, 26.0.3, 27.0.1, 27.0.2, 27.0.3, 28.0.3
System Images: android-23 | Intel x86 Atom_64, android-23 | Google APIs Intel x86 Atom_64, android-27 | Google APIs Intel x86 Atom, android-28 | Google Play Intel x86 Atom
IDEs:
Android Studio: 3.1 AI-173.4819257
Xcode: 10.2.1/10E1001 - /usr/bin/xcodebuild
npmPackages:
react: 16.8.3 => 16.8.3
react-native: 0.59.1 => 0.59.1
npmGlobalPackages:
create-react-native-app: 1.0.0
react-native-cli: 2.0.1
react-native-create-library: 3.1.2
react-native-git-upgrade: 0.2.7
svg-to-react-native-cli: 0.0.3

Description

Different behavior between android with iOS

[Android]
When you press slider the value is changed.

[iOS]
When you press slider there is no reaction.

I want to change sliders value on press just same as android.

AndroidX

I updated to the latest npm and the androidx support has caused quite a few issues. It seems that I have to change my root supportLibVersion to 1.0.2 to get slider to work but this caused ripple effects down my app causing other module (react-native-communit netinfo) to not find the support.v4.net library.

Did I miss a step somewhere or is react native not quite ready for modules to require the root version to be androidx.

Component 'RNCSlider' re-registered direct event 'topSlidingComplete' as a bubbling event

Environment

System:
OS: macOS 10.14.5
CPU: (4) x64 Intel(R) Core(TM) i5-5287U CPU @ 2.90GHz
Memory: 30.62 MB / 8.00 GB
Shell: 5.3 - /bin/zsh
Binaries:
Node: 11.6.0 - /usr/local/bin/node
Yarn: 1.16.0 - /usr/local/bin/yarn
npm: 6.5.0-next.0 - /usr/local/bin/npm
SDKs:
iOS SDK:
Platforms: iOS 12.2, macOS 10.14, tvOS 12.2, watchOS 5.2
IDEs:
Android Studio: 3.3 AI-182.5107.16.33.5199772
Xcode: 10.2.1/10E1001 - /usr/bin/xcodebuild
npmPackages:
react: 16.8.6 => 16.8.6
react-native: ^0.60.0 => 0.60.0
npmGlobalPackages:
create-react-native-app: 2.0.2
react-native-cli: 2.0.1
react-native-git-upgrade: 0.2.7

Description

Installed latest react-native, react and i guess also the latest version of community-slider and this error shows up after the bundler finishes.
Again, the entire error shown is:

Component 'RNCSlider' re-registered direct event 'topSlidingComplete' as a bubbling event (red screen)

Add thumbStyle & trackStyle

Describe the Feature

Add support for thumbStyle to allow customizing the thumb shape, colour and size. Relying on an image per style can be quite limiting for simple changes. If implemented, this could make thumbTintColor obsolete.

Android build failed : Task :@react-native-community_slider:compileDebugJavaWithJavac FAILED

Environment Android only

info
React Native Environment Info:
System:
OS: macOS High Sierra 10.13.6
CPU: (4) x64 Intel(R) Core(TM) i7-2640M CPU @ 2.80GHz
Memory: 568.49 MB / 8.00 GB
Shell: 3.2.57 - /bin/bash
Binaries:
Node: 8.11.3 - /usr/local/bin/node
Yarn: 1.9.4 - /usr/local/bin/yarn
npm: 5.6.0 - /usr/local/bin/npm
SDKs:
iOS SDK:
Platforms: iOS 11.4, macOS 10.13, tvOS 11.4, watchOS 4.3
Android SDK:
API Levels: 23, 25, 26, 27, 28
Build Tools: 23.0.1, 23.0.2, 23.0.3, 25.0.3, 26.0.2, 26.0.3, 27.0.3, 28.0.2, 28.0.3
System Images: android-23 | Intel x86 Atom_64, android-23 | Google APIs Intel x86 Atom_64, android-24 | Google Play Intel x86 Atom, android-27 | Intel x86 Atom_64, android-28 | Android TV Intel x86 Atom, android-28 | Google APIs Intel x86 Atom, android-28 | Google Play Intel x86 Atom_64
IDEs:
Android Studio: 3.1 AI-173.4907809
Xcode: 9.4.1/9F2000 - /usr/bin/xcodebuild
npmPackages:
react: 16.8.3 => 16.8.3
react-native: 0.59.9 => 0.59.9
npmGlobalPackages:
react-native-cli: 2.0.1
react-native-git-upgrade: 0.2.7

Description

Android Build faild if run react-native run-android.Also change react-native-slider version v1.1.3 ,v1.1.2 and v1.1.1

build error Error

Configure project :react-native-webview
WARNING: The following project options are deprecated and have been removed:
android.enableAapt2
This property has no effect, AAPT2 is now always used.

:react-native-webview:reactNativeAndroidRoot /Users/apple/Desktop/development/app/64bit/node_modules/react-native/android

Task :@react-native-community_slider:compileDebugJavaWithJavac FAILED
/Users/apple/Desktop/development/app/64bit/node_modules/@react-native-community/slider/android/src/main/java/com/reactnativecommunity/slider/ReactSlider.java:11: error: package android.support.v7.widget does not exist
import android.support.v7.widget.AppCompatSeekBar;
^
/Users/apple/Desktop/development/app/64bit/node_modules/@react-native-community/slider/android/src/main/java/com/reactnativecommunity/slider/ReactSlider.java:23: error: cannot find symbol
public class ReactSlider extends AppCompatSeekBar {
^
symbol: class AppCompatSeekBar
/Users/apple/Desktop/development/app/64bit/node_modules/@react-native-community/slider/android/src/main/java/com/reactnativecommunity/slider/ReactSlider.java:60: error: cannot find symbol
super.setStateListAnimator(null);
^
symbol: variable super
location: class ReactSlider
/Users/apple/Desktop/development/app/64bit/node_modules/@react-native-community/slider/android/src/main/java/com/reactnativecommunity/slider/ReactSlider.java:88: error: cannot find symbol
if (seekBarProgress == getMax()) {
^
symbol: method getMax()
location: class ReactSlider
/Users/apple/Desktop/development/app/64bit/node_modules/@react-native-community/slider/android/src/main/java/com/reactnativecommunity/slider/ReactSlider.java:99: error: cannot find symbol
setMax(getTotalSteps());
^
symbol: method setMax(int)
location: class ReactSlider
/Users/apple/Desktop/development/app/64bit/node_modules/@react-native-community/slider/android/src/main/java/com/reactnativecommunity/slider/ReactSlider.java:105: error: cannot find symbol
setProgress((int) Math.round((mValue - mMinValue) / (mMaxValue - mMinValue) * getTotalSteps()));
^
symbol: method setProgress(int)
location: class ReactSlider
/Users/apple/Desktop/development/app/64bit/node_modules/@react-native-community/slider/android/src/main/java/com/reactnativecommunity/slider/ReactSliderManager.java:37: error: type argument ReactSlider is not within bounds of type-variable T
public class ReactSliderManager extends SimpleViewManager {
^
where T is a type-variable:
T extends View declared in class SimpleViewManager
/Users/apple/Desktop/development/app/64bit/node_modules/@react-native-community/slider/android/src/main/java/com/reactnativecommunity/slider/ReactSliderManager.java:66: error: incompatible types: ReactSlider cannot be converted to SeekBar
SeekBar reactSlider = new ReactSlider(getThemedContext(), null, STYLE);
^
/Users/apple/Desktop/development/app/64bit/node_modules/@react-native-community/slider/android/src/main/java/com/reactnativecommunity/slider/ReactSliderManager.java:88: error: incompatible types: SeekBar cannot be converted to ReactSlider
((ReactSlider) seekbar).toRealProgress(progress),
^
/Users/apple/Desktop/development/app/64bit/node_modules/@react-native-community/slider/android/src/main/java/com/reactnativecommunity/slider/ReactSliderManager.java:98: error: incompatible types: SeekBar cannot be converted to ReactSlider
((ReactSlider) seekbar).toRealProgress(seekbar.getProgress())));
^
/Users/apple/Desktop/development/app/64bit/node_modules/@react-native-community/slider/android/src/main/java/com/reactnativecommunity/slider/ReactSliderManager.java:107: error: incompatible types: SeekBar cannot be converted to ReactSlider
((ReactSlider) seekbar).toRealProgress(seekbar.getProgress())));
^
/Users/apple/Desktop/development/app/64bit/node_modules/@react-native-community/slider/android/src/main/java/com/reactnativecommunity/slider/ReactSliderManager.java:133: error: cannot find symbol
view.setEnabled(enabled);
^
symbol: method setEnabled(boolean)
location: variable view of type ReactSlider
/Users/apple/Desktop/development/app/64bit/node_modules/@react-native-community/slider/android/src/main/java/com/reactnativecommunity/slider/ReactSliderManager.java:138: error: cannot find symbol
view.setOnSeekBarChangeListener(null);
^
symbol: method setOnSeekBarChangeListener()
location: variable view of type ReactSlider
/Users/apple/Desktop/development/app/64bit/node_modules/@react-native-community/slider/android/src/main/java/com/reactnativecommunity/slider/ReactSliderManager.java:140: error: cannot find symbol
view.setOnSeekBarChangeListener(ON_CHANGE_LISTENER);
^
symbol: method setOnSeekBarChangeListener(OnSeekBarChangeListener)
location: variable view of type ReactSlider
/Users/apple/Desktop/development/app/64bit/node_modules/@react-native-community/slider/android/src/main/java/com/reactnativecommunity/slider/ReactSliderManager.java:161: error: cannot find symbol
view.getThumb().clearColorFilter();
^
symbol: method getThumb()
location: variable view of type ReactSlider
/Users/apple/Desktop/development/app/64bit/node_modules/@react-native-community/slider/android/src/main/java/com/reactnativecommunity/slider/ReactSliderManager.java:163: error: cannot find symbol
view.getThumb().setColorFilter(color, PorterDuff.Mode.SRC_IN);
^
symbol: method getThumb()
location: variable view of type ReactSlider
/Users/apple/Desktop/development/app/64bit/node_modules/@react-native-community/slider/android/src/main/java/com/reactnativecommunity/slider/ReactSliderManager.java:169: error: cannot find symbol
LayerDrawable drawable = (LayerDrawable) view.getProgressDrawable().getCurrent();
^
symbol: method getProgressDrawable()
location: variable view of type ReactSlider
/Users/apple/Desktop/development/app/64bit/node_modules/@react-native-community/slider/android/src/main/java/com/reactnativecommunity/slider/ReactSliderManager.java:180: error: cannot find symbol
LayerDrawable drawable = (LayerDrawable) view.getProgressDrawable().getCurrent();
^
symbol: method getProgressDrawable()
location: variable view of type ReactSlider
/Users/apple/Desktop/development/app/64bit/node_modules/@react-native-community/slider/android/src/main/java/com/reactnativecommunity/slider/ReactSliderManager.java:191: error: cannot find symbol
view.setOnSeekBarChangeListener(ON_CHANGE_LISTENER);
^
symbol: method setOnSeekBarChangeListener(OnSeekBarChangeListener)
location: variable view of type ReactSlider
Note: /Users/apple/Desktop/development/app/64bit/node_modules/@react-native-community/slider/android/src/main/java/com/reactnativecommunity/slider/ReactSliderManager.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
19 errors

FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ':@react-native-community_slider:compileDebugJavaWithJavac'.

Compilation failed; see the compiler error output for details.

  • Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

  • Get more help at https://help.gradle.org

Deprecated Gradle features were used in this build, making it incompatible with Gradle 6.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/5.4.1/userguide/command_line_interface.html#sec:command_line_warnings

Reproducible Demo

yarn add @react-native-community/slider
react-native link @react-native-community/slider
react-native run-android

View config not found for name RNCSlider

Ask your Question

Just switched to this package. Getting this error on Android. The project itself builds fine. Testing on the real device. It was working fine with default react slider. The package is linked properly. What do I do wrong? How can I fix it?
Thanks

Env:
MacOS Mojave 10.14.5
react-native: 0.59.9
react: 16.8.6
@react-native-community/slider": "^1.1.3"

My code is:

    <RNCamera
            ref={ref => {
                this.camera = ref;
            }}
            style={{
                flex: 1,
            }}
            type={this.state.type}
            flashMode={this.state.flash}
            autoFocus={this.state.autoFocus}
            zoom={this.state.zoom}
            whiteBalance={this.state.whiteBalance}
            ratio={this.state.ratio}
            focusDepth={this.state.depth}
            permissionDialogTitle={'Permission to use camera'}
            permissionDialogMessage={'We need your permission to use your camera phone'}
            captureAudio={false}
        >
            <View
                style={{
                    flex: 0.4,
                    backgroundColor: 'transparent',
                    flexDirection: 'row',
                    alignSelf: 'flex-end',
                }}
            >
                <Slider
                    style={{width: 150, marginTop: 15, alignSelf: 'flex-end'}}
                    onValueChange={this.setFocusDepth.bind(this)}
                    step={0.1}
                    disabled={this.state.autoFocus === 'on'}
                />
            </View>

Slider visits every value when I drag.

Environment

React Native Environment Info:
System:
OS: macOS 10.14.4
CPU: (4) x64 Intel(R) Core(TM) i5-4260U CPU @ 1.40GHz
Memory: 29.04 MB / 4.00 GB
Shell: 3.2.57 - /bin/bash
Binaries:
Node: 11.14.0 - /usr/local/bin/node
Yarn: 1.15.2 - /usr/local/bin/yarn
npm: 6.9.0 - /usr/local/bin/npm
Watchman: 4.9.0 - /usr/local/bin/watchman
SDKs:
iOS SDK:
Platforms: iOS 12.2, macOS 10.14, tvOS 12.2, watchOS 5.2
IDEs:
Xcode: 10.2.1/10E1001 - /usr/bin/xcodebuild
npmPackages:
react: 16.6.1 => 16.6.1
react-native: 0.57.7 => 0.57.7
npmGlobalPackages:
react-native-cli: 2.0.1

Description

When I slide my slider I have a callback on onValueChange that calls the following method

private SliderValueChanged(value) {

   this.setState({ internalSliderValue: value });
 }

I have a text box that displays the internalSliderValue value.

When I drag the button and release far down the track the value slowly counts up or down to the indicated value.

how can I have it just calls the callback either the location of the nubbin, or the released point without going through every individual point?

On android it seems to work as I expect, on my iphone 5s I see this slow behaviour. Tho my android phone is a lot newer so I am not sure it is not just doing things faster.

Slider setup

```

          <Slider
            step={1}
            style={{ width: "90%" }}
            value={slider.sliderStartValue}
            onValueChange={val => this.SliderValueChanged(val)}
            onSlidingComplete={val =>
              (CalculatorStore.calculatorValues.sliderValue = val)
            }
            maximumValue={slider.sliderMaxValue}
            thumbTintColor="rgb(252, 228, 149)"
            minimumTrackTintColor="#FF0000"
            maximumTrackTintColor="#206F98"
          />

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.