react-twitter-widgets
Advanced tools
Comparing version 0.2.4 to 1.0.0
@@ -50,3 +50,3 @@ 'use strict'; | ||
}; | ||
return changed('widgetId') || changed('options'); | ||
return changed('dataSource') || changed('options'); | ||
} | ||
@@ -57,3 +57,3 @@ }, { | ||
var _props = this.props; | ||
var widgetId = _props.widgetId; | ||
var dataSource = _props.dataSource; | ||
var options = _props.options; | ||
@@ -64,3 +64,3 @@ var onLoad = _props.onLoad; | ||
tw.widgets.createTimeline(widgetId, element, (0, _lodash4.default)(options)).then(function () { | ||
tw.widgets.createTimeline(dataSource, element, (0, _lodash4.default)(options)).then(function () { | ||
// Widget is loaded | ||
@@ -82,3 +82,3 @@ done(); | ||
Timeline.propTypes = { | ||
widgetId: _react2.default.PropTypes.string.isRequired, | ||
dataSource: _react2.default.PropTypes.object.isRequired, | ||
options: _react2.default.PropTypes.object, | ||
@@ -85,0 +85,0 @@ onLoad: _react2.default.PropTypes.func |
{ | ||
"name": "react-twitter-widgets", | ||
"version": "0.2.4", | ||
"version": "1.0.0", | ||
"description": "Twitter widgets as React components", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -23,3 +23,6 @@ # react-twitter-widgets | ||
<Timeline | ||
widgetId={'29838471883830183'} | ||
dataSource={{ | ||
sourceType: 'profile', | ||
screenName: 'twitterdev' | ||
}} | ||
options={{ | ||
@@ -40,3 +43,3 @@ username: 'TwitterDev', | ||
`Timeline` requires the widget id supplied by Twitter as `widgetId` (ex. `'123456'`). Also, note that you can override your configured screen name with a custom screenName (username) in the options object. | ||
`Timeline` requires a `dataSource` object prop, see [here](https://dev.twitter.com/web/javascript/creating-widgets#timelines) for info. The source type can be profile, likes, list, collection, URL, or legacy widget configuration. | ||
@@ -43,0 +46,0 @@ `Share` requires a `url` prop. |
@@ -8,3 +8,3 @@ import React from 'react' | ||
static propTypes = { | ||
widgetId: React.PropTypes.string.isRequired, | ||
dataSource: React.PropTypes.object.isRequired, | ||
options: React.PropTypes.object, | ||
@@ -21,10 +21,10 @@ onLoad: React.PropTypes.func | ||
const changed = name => !isEqual(this.props[name], nextProps[name]) | ||
return changed('widgetId') || changed('options') | ||
return changed('dataSource') || changed('options') | ||
} | ||
ready(tw, element, done) { | ||
const { widgetId, options, onLoad } = this.props | ||
const { dataSource, options, onLoad } = this.props | ||
// Options must be cloned since Twitter Widgets modifies it directly | ||
tw.widgets.createTimeline(widgetId, element, cloneDeep(options)) | ||
tw.widgets.createTimeline(dataSource, element, cloneDeep(options)) | ||
.then(() => { | ||
@@ -31,0 +31,0 @@ // Widget is loaded |
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
37921
1
69