Skip to content

Commit ce62340

Browse files
authored
fix(web): fix issues preventing web implementation from working (#462)
* fix(web): fix issues preventng web implementation from working * feat(web): animate the position of the web slider * chore(example-web): add an example web project * feat(web): add the ability to render a thumbImage for web #355 * fix(web): fix issue where disabled web sliders are still functional * Update package/src/RNCSliderNativeComponent.web.tsx
1 parent a649f8f commit ce62340

27 files changed

+29898
-47
lines changed

example-web/.gitignore

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2+
3+
# dependencies
4+
/node_modules
5+
/.pnp
6+
.pnp.js
7+
8+
# testing
9+
/coverage
10+
11+
# production
12+
/build
13+
14+
# misc
15+
.DS_Store
16+
.env.local
17+
.env.development.local
18+
.env.test.local
19+
.env.production.local
20+
21+
npm-debug.log*
22+
yarn-debug.log*
23+
yarn-error.log*

example-web/README.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# Web Example
2+
3+
This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).
4+
5+
## Setup
6+
7+
This example project can be used to test/demo this project in the context of
8+
`react-native-web`. Here's how to use it:
9+
10+
1. Build the library:
11+
```sh
12+
# go to the `package` folder
13+
cd ../package
14+
# build the library
15+
npm run prepare
16+
# go back to the example
17+
cd ../example-web
18+
```
19+
2. Run the dev server:
20+
```sh
21+
npm start
22+
```
23+
24+
25+
:warning: **NOTE**: each time you make a change to the underlying lib you'll
26+
need to run `npm run prepare` and `npm start` again.

example-web/craco.config.js

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
const path = require('path');
2+
const babelInclude = require('@dealmore/craco-plugin-babel-include');
3+
const webpack = require('webpack');
4+
5+
const LIB_PATH = `../package/dist/Slider.js`;
6+
7+
module.exports = {
8+
webpack: {
9+
alias: {
10+
'react-native$': 'react-native-web',
11+
'@react-native-community/slider': path.resolve(__dirname, LIB_PATH),
12+
// make sure we don't include multiple versions of react
13+
'react': path.resolve(__dirname, './node_modules/react'),
14+
},
15+
babel: {
16+
presets: [
17+
'@babel/preset-react',
18+
'@babel/preset-typescript',
19+
],
20+
plugins: [
21+
'@babel/plugin-proposal-private-methods',
22+
'@babel/plugin-proposal-class-properties',
23+
'@babel/plugin-proposal-private-property-in-object',
24+
],
25+
},
26+
},
27+
28+
plugins: [
29+
{
30+
plugin: babelInclude,
31+
options: {
32+
include: [
33+
path.resolve(__dirname, LIB_PATH),
34+
],
35+
},
36+
},
37+
],
38+
};

0 commit comments

Comments
 (0)