Skip to content

Commit 6a40b59

Browse files
committed
Fix issue #4: remove reference to react-bootstrap/ThemeProvider
1 parent b2ced7a commit 6a40b59

File tree

3 files changed

+17
-15
lines changed

3 files changed

+17
-15
lines changed

README.md

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
# React Bootstrap Range Slider
55

6-
A slider component for React Bootstrap v1.0.0-beta / Bootstrap 4 that extends the native HTML `<input type="range">` element.
6+
A slider component for React Bootstrap v1.0.0+ / Bootstrap 4 that extends the native HTML `<input type="range">` element.
77

88
Check out the [Examples Page](https://jaywilz.github.io/react-bootstrap-range-slider/) for live demos of all main slider features.
99

@@ -20,13 +20,21 @@ or
2020

2121
### Prerequisites
2222

23-
[React Bootstrap](https://github.com/react-bootstrap/react-bootstrap) and [Bootstrap](https://github.com/twbs/bootstrap) must be installed and the [CSS](https://react-bootstrap.netlify.com/getting-started/introduction#stylesheets) from Bootstrap imported.
23+
[React Bootstrap](https://github.com/react-bootstrap/react-bootstrap) must be installed and the [Bootstrap CSS](https://react-bootstrap.netlify.com/getting-started/introduction#stylesheets) imported.
2424

2525
## Usage
2626

27+
In your `index.js` or similar:
28+
2729
```JavaScript
28-
import React, { useState } from 'react';
30+
import 'bootstrap/dist/css/bootstrap.css';
2931
import 'react-bootstrap-range-slider/dist/react-bootstrap-range-slider.css';
32+
```
33+
34+
Your component:
35+
36+
```JavaScript
37+
import React, { useState } from 'react';
3038
import RangeSlider from 'react-bootstrap-range-slider';
3139

3240
const MyComponent = () => {
@@ -36,7 +44,7 @@ const MyComponent = () => {
3644
return (
3745
<RangeSlider
3846
value={value}
39-
onChange={changeEvent => setValue(changeEvent.target.value)}
47+
onChange={changeEvent => setValue(Number(changeEvent.target.value))}
4048
/>
4149
);
4250

@@ -45,7 +53,7 @@ const MyComponent = () => {
4553

4654
## Features
4755

48-
- Compatible with React Bootstrap v1.0.0-beta and Bootstrap 4;
56+
- Compatible with React Bootstrap v1.0.0+ and Bootstrap 4;
4957
- Implemented using native HTML `<input type="range">` element;
5058
- Aligns horizontally with Bootstrap form controls;
5159
- Bootstrap small (`sm`) and large (`lg`) sizes are supported;

package.json

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react-bootstrap-range-slider",
3-
"version": "0.3.5",
3+
"version": "0.3.6",
44
"description": "A range slider component for React Bootstrap (Bootstrap 4) that extends the native HTML input (type=range) element.",
55
"keywords": [
66
"react",
@@ -24,16 +24,12 @@
2424
"build:examples-umd": "BABEL_ENV=build NODE_ENV=examples rollup -c",
2525
"build:pages": "node_modules/@babel/cli/bin/babel.js docs/js/examples.src.js --out-file docs/js/examples.js --presets=@babel/preset-env,@babel/preset-react",
2626
"test": "cross-env BABEL_ENV=test NODE_ENV=test jest --no-cache",
27-
"test:coverage": "npm test -- --coverage",
28-
"test:badges": "npm run test:coverage && jest-coverage-badges"
27+
"test:coverage": "npm test -- --coverage"
2928
},
3029
"jest": {
3130
"moduleNameMapper": {
3231
"\\.(css|less)$": "<rootDir>/__mocks__/styleMock.js"
33-
},
34-
"coverageReporters": [
35-
"json-summary"
36-
]
32+
}
3733
},
3834
"devDependencies": {
3935
"@babel/cli": "^7.8.4",
@@ -58,7 +54,6 @@
5854
},
5955
"dependencies": {
6056
"classnames": "^2.2.6",
61-
"jest-coverage-badges": "^1.1.2",
6257
"prop-types": "^15.7.2"
6358
},
6459
"peerDependencies": {

src/RangeSlider.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424

2525
import React from 'react';
2626
import PropTypes from 'prop-types';
27-
import { useBootstrapPrefix } from 'react-bootstrap/ThemeProvider';
2827
import classNames from 'classnames';
2928

3029
const DEFAULT_CLASS_PREFIX = 'range-slider';
@@ -48,7 +47,7 @@ const RangeSlider = React.forwardRef(({
4847
className,
4948
}, ref) => {
5049

51-
const prefix = useBootstrapPrefix(bsPrefix, DEFAULT_CLASS_PREFIX);
50+
const prefix = bsPrefix || DEFAULT_CLASS_PREFIX;
5251

5352
const isTooltip = tooltip === 'auto' || tooltip === 'on';
5453

0 commit comments

Comments
 (0)