Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

React-Lite, Material-UI and fastclick problem #96

Open
Cartman720 opened this issue Feb 1, 2017 · 5 comments
Open

React-Lite, Material-UI and fastclick problem #96

Cartman720 opened this issue Feb 1, 2017 · 5 comments

Comments

@Cartman720
Copy link

Cartman720 commented Feb 1, 2017

Hi, I am using react-lite and its's react-lite/lib/react-tap-event-plugin with installed as dependency fastclick, because without fastclick webpack throws error since react-lite/lib/react-tap-event-plugin requires it. Everything was great until I opened browser and clicked on material-ui buttons and found that my click events don't working. Maybe I have done something wrong.
I found react-lite really useful, but this is huge problem because my project uses material-ui and as I found they are not compatible.

that would be great if someone could help me with this!
Thanks in advance.

And this is my webpack with aliases

let path = require('path');
let ExtractTextPlugin = require('extract-text-webpack-plugin');
let CleanWebpackPlugin = require('clean-webpack-plugin');

var DefinePlugin = new webpack.DefinePlugin({
	__DEV__: JSON.stringify(JSON.parse(process.env.DEBUG || 'false')),
	process: {
		env: {
			NODE_ENV: JSON.stringify(process.env.NODE_ENV || 'development')		
		}
	}
});

let isProd = process.env.NODE_ENV == 'production';

module.exports = {
	context: __dirname,
	devtool: 'inline-source-map',
	entry: {
		bundle: './src/app/app-client.jsx',
		styles: './src/app/sass/main.scss',
		vendor: ['react', 'react-dom']
	},
	output: {
		publicPath: '/build/',
		filename: '[name].js',
		chunkFilename: '[name].[chunkhash].js',
		path: './src/build',
	},
	resolve: {
		extensions: ['.js', '.jsx'],
		alias: {
			'react': 'react-lite',
			'react-dom': 'react-lite',
			'react-tap-event-plugin': 'react-lite/lib/react-tap-event-plugin'
		}
	},
	module : {
		rules : [
			{
				test: /\.scss$/,
				loader: ExtractTextPlugin.extract(['css-loader','sass-loader'])
			},
			{
				test: /\.jsx?$/,
				exclude: [/node_modules/, /libs/],
				use: {
					loader: "babel-loader",
					query: {
						presets: [['es2015', { modules: false }], 'react', 'stage-2', 'stage-3' ],
						plugins: [ "transform-runtime" ]
					}
				}
			},
			{
				test: /\.woff2?$|\.ttf$|\.eot$|\.svg$|\.png|\.jpe?g|\.gif$/,
				use: {
					loader:'file-loader'
				}
			}
		]
	},
	plugins: [
		DefinePlugin,
		new ExtractTextPlugin('[name].css'),
		new CleanWebpackPlugin(['build'], {
		    root: path.resolve(__dirname, 'src'),
		    verbose: true, 
		    dry: false,
		    exclude: ['bundle.js', 'styles.css', 'styles.js', 'vendor.js']
		}),
		new webpack.optimize.CommonsChunkPlugin({ 
			name: 'vendor',
			filename: "[name].js",
			minChunks: Infinity
		}),
		new webpack.optimize.UglifyJsPlugin({
			comments: false, // remove comments
			compress: {
				unused: true,
				dead_code: true, // big one--strip code that will never execute
				warnings: false, // good for prod apps so users can't peek behind curtain
				drop_debugger: true,
				conditionals: true,
				evaluate: true,
				drop_console: true, // strips console statements
				sequences: true,
				booleans: true,
			}
	    })
	]
}
@Lucifier129
Copy link
Owner

Which browser did you use?

We should emulate mobile device for enabling tap event in some browsers of PC.

@Cartman720
Copy link
Author

Hi

Thanks for response.
I have tried on latest Chrome, and on both desktop and real mobile (Galaxy S5), as well as chrome devtools emulator of mobile.
can you show me your example or step by step little tutorial about that, though I think it is very simple and problem is in my approach of using it.

@Lucifier129
Copy link
Owner

Which version of Material-UI did you use?

In this demo, it works well. Click here to see the commit of code change.

@Cartman720
Copy link
Author

Cartman720 commented Feb 2, 2017 via email

@mauron85
Copy link

@Lucifier129 Great work. But I also have an issue with material-ui. In chrome (ff seems ok).
Switching tabs doesn't work well. Usually first click is not registered. Repeaded clicks are usually fine.
https://lucifier129.github.io/material-ui/build/#/components/tabs

material-ui: 0.18.3
react-lite: 0.15.37
Chrome 59

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants