Skip to content

Commit

Permalink
fix(ColumnView): setState error
Browse files Browse the repository at this point in the history
dispose wasn't being called due to componentWillUnmount typo
  • Loading branch information
mmmoli committed Mar 17, 2016
1 parent 62c55a9 commit f289c06
Show file tree
Hide file tree
Showing 8 changed files with 55 additions and 27 deletions.
6 changes: 1 addition & 5 deletions example/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,4 @@
<link href="https://npmcdn.com/[email protected]/css/basscss.min.css" rel="stylesheet">
<body>
<div id="container"></div>
<script src="build/main.js"></script>
<div class="Climb"
data-collection-id="56b4b06908216f0cac62a86b"
data-limit="3"
data-view="regularSQUAREview"></div>
<script src="build/main.js"></script>
52 changes: 39 additions & 13 deletions example/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React from 'react';
import ReactDOM from 'react-dom';
import { ListView, ColumnView, RegularSquareView, ClimbView, StackedCard } from 'react-climb-social';
import { Tab, Tabs, TabList, TabPanel } from 'react-tabs';

import 'react-climb-social/styles/main.css';
import './style.css';
Expand All @@ -13,25 +14,50 @@ const App = () => {
React Climb Social
</h1>

<ClimbView collectionId='56b4b06908216f0cac62a86b' Card={ StackedCard } />
<Tabs>

<TabList>
<Tab>Default</Tab>
<Tab>RegularSquareView</Tab>
<Tab>Custom formatting</Tab>
<Tab>ColumnView</Tab>
<Tab>HTML</Tab>
</TabList>

<ClimbView collectionId='56b4b06908216f0cac62a86b'
View={ RegularSquareView } />
<TabPanel>
<ClimbView collectionId='56b4b06908216f0cac62a86b' Card={ StackedCard } />
</TabPanel>

<div className='sm-col sm-col-6 md-col-4 lg-col-3 px2'>
<h2>List View</h2>
<TabPanel>
<ClimbView collectionId='56b4b06908216f0cac62a86b'
View={ RegularSquareView } />
</TabPanel>

<ClimbView collectionId='56b4b06908216f0cac62a86b'
View={ ListView } />
<TabPanel>
<h2>List View</h2>

</div>
<ClimbView collectionId='56b4b06908216f0cac62a86b'
View={ ListView } />


</TabPanel>

<TabPanel>
<h2>Column View</h2>
<ClimbView collectionId='56b4b06908216f0cac62a86b'
View={ ColumnView } />

</TabPanel>

<TabPanel>
<div className="Climb"
data-collection-id="56b4b06908216f0cac62a86b"
data-limit="3"
data-view="columnView"></div>
</TabPanel>

</Tabs>

<div className='sm-col sm-col-6 md-col-8 lg-col-9 px2'>
<h2>Column View</h2>
<ClimbView collectionId='56b4b06908216f0cac62a86b'
View={ ColumnView } />
</div>

</div>
);
Expand Down
4 changes: 1 addition & 3 deletions example/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,7 @@ module.exports = {
loaders: ['style-loader', 'css-loader']
}
],
noParse: [
path.join(__dirname, '../node_modules/bricks.js/dist/bricks.min.js')
]
noParse: [/bricks.js/]
},

resolve: {
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@
"react-addons-test-utils": "^0.14.7",
"react-dom": "^0.14.0",
"react-hot-loader": "^1.2.3",
"react-tabs": "^0.5.3",
"style-loader": "^0.13.0",
"tape": "^4.4.0",
"webpack": "^1.8.11",
Expand Down
5 changes: 5 additions & 0 deletions src/styles/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@
background-size: cover;
}

.Climb--ColumnView {
margin-left: auto;
margin-right: auto;
}

.Climb--ColumnView .Climb__Card {
width: 275px;
}
Expand Down
2 changes: 1 addition & 1 deletion src/views/ClimbView/ClimbView.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class ClimbView extends React.Component {
});
}

componentWillUnMount() {
componentWillUnmount() {
this.subscription.dispose();
}

Expand Down
2 changes: 1 addition & 1 deletion src/views/ColumnView/ColumnView.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class ColumnView extends React.Component {
});
}

componentWillUnMount() {
componentWillUnmount() {
this.subscription.dispose();
}

Expand Down
10 changes: 6 additions & 4 deletions webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,14 @@ module.exports = {
{ test: /\.js$/, loader: 'eslint', exclude: /node_modules/ }
],
loaders: [
{ test: /\.js$/, loader: 'babel', exclude: /node_modules/ },
{
test: /\.js$/,
loader: 'babel',
exclude: /node_modules/
},
{ test: /\.css$/, loader: ExtractTextPlugin.extract('style-loader', 'css-loader', 'postcss-loader'), exclude: /node_modules/ }
],
noParse: [
path.join(__dirname, './node_modules/bricks.js/dist/bricks.min.js')
]
noParse: [/bricks.js/]
},
postcss: function (webpack) {
return [
Expand Down

0 comments on commit f289c06

Please sign in to comment.