Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/components/TwitterDMButton.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ export default class TwitterDMButton extends Component {
this.state = {
isLoading: true
}
this.embedContainer = React.createRef()
}

componentDidMount() {
Expand All @@ -43,7 +44,7 @@ export default class TwitterDMButton extends Component {
if (!this.isMountCanceled) {
window.twttr.widgets.createDMButton(
this.props.id,
this.refs.embedContainer,
this.embedContainer.current,
this.props.options
).then((element) => {
this.setState({
Expand All @@ -68,7 +69,7 @@ export default class TwitterDMButton extends Component {
return (
<React.Fragment>
{isLoading && placeholder}
<div ref='embedContainer' />
<div ref={this.embedContainer} />
</React.Fragment>
)
}
Expand Down
5 changes: 3 additions & 2 deletions src/components/TwitterFollowButton.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ export default class TwitterFollowButton extends Component {
this.state = {
isLoading: true
}
this.embedContainer = React.createRef()
}

componentDidMount() {
Expand All @@ -43,7 +44,7 @@ export default class TwitterFollowButton extends Component {
if (!this.isMountCanceled) {
window.twttr.widgets.createFollowButton(
this.props.screenName,
this.refs.embedContainer,
this.embedContainer.current,
this.props.options
).then((element) => {
this.setState({
Expand All @@ -68,7 +69,7 @@ export default class TwitterFollowButton extends Component {
return (
<React.Fragment>
{isLoading && placeholder}
<div ref='embedContainer' />
<div ref={this.embedContainer} />
</React.Fragment>
)
}
Expand Down
5 changes: 3 additions & 2 deletions src/components/TwitterHashtagButton.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ export default class TwitterHashtagButton extends Component {
this.state = {
isLoading: true
}
this.embedContainer = React.createRef()
}

componentDidMount() {
Expand All @@ -43,7 +44,7 @@ export default class TwitterHashtagButton extends Component {
if (!this.isMountCanceled) {
window.twttr.widgets.createHashtagButton(
this.props.tag,
this.refs.embedContainer,
this.embedContainer.current,
this.props.options
).then((element) => {
this.setState({
Expand All @@ -68,7 +69,7 @@ export default class TwitterHashtagButton extends Component {
return (
<React.Fragment>
{isLoading && placeholder}
<div ref='embedContainer' />
<div ref={this.embedContainer} />
</React.Fragment>
)
}
Expand Down
5 changes: 3 additions & 2 deletions src/components/TwitterMentionButton.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ export default class TwitterMentionButton extends Component {
this.state = {
isLoading: true
}
this.embedContainer = React.createRef()
}

componentDidMount() {
Expand All @@ -43,7 +44,7 @@ export default class TwitterMentionButton extends Component {
if (!this.isMountCanceled) {
window.twttr.widgets.createMentionButton(
this.props.screenName,
this.refs.embedContainer,
this.embedContainer.current,
this.props.options
).then((element) => {
this.setState({
Expand All @@ -68,7 +69,7 @@ export default class TwitterMentionButton extends Component {
return (
<React.Fragment>
{isLoading && placeholder}
<div ref='embedContainer' />
<div ref={this.embedContainer} />
</React.Fragment>
)
}
Expand Down
5 changes: 3 additions & 2 deletions src/components/TwitterMomentShare.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ export default class TwitterMomentShare extends Component {
this.state = {
isLoading: true
}
this.shareMoment = React.createRef()
}

componentDidMount() {
Expand All @@ -43,7 +44,7 @@ export default class TwitterMomentShare extends Component {
if (!this.isMountCanceled) {
window.twttr.widgets.createMoment(
this.props.momentId,
this.refs.shareMoment,
this.shareMoment.current,
this.props.options
).then((element) => {
this.setState({
Expand All @@ -68,7 +69,7 @@ export default class TwitterMomentShare extends Component {
return (
<React.Fragment>
{isLoading && placeholder}
<div ref='shareMoment' />
<div ref={this.shareMoment} />
</React.Fragment>
)
}
Expand Down
5 changes: 3 additions & 2 deletions src/components/TwitterOnAirButton.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ export default class TwitterOnAirButton extends Component {
this.state = {
isLoading: true
}
this.embedContainer = React.createRef()
}

componentDidMount() {
Expand All @@ -43,7 +44,7 @@ export default class TwitterOnAirButton extends Component {
if (!this.isMountCanceled) {
window.twttr.widgets.createPeriscopeOnAirButton(
this.props.username,
this.refs.embedContainer,
this.embedContainer.current,
this.props.options
).then((element) => {
this.setState({
Expand All @@ -68,7 +69,7 @@ export default class TwitterOnAirButton extends Component {
return (
<React.Fragment>
{isLoading && placeholder}
<div ref='embedContainer' />
<div ref={this.embedContainer} />
</React.Fragment>
)
}
Expand Down
5 changes: 3 additions & 2 deletions src/components/TwitterShareButton.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ export default class TwitterShareButton extends Component {
this.state = {
isLoading: true
}
this.embedContainer = React.createRef()
}

componentDidMount() {
Expand All @@ -44,7 +45,7 @@ export default class TwitterShareButton extends Component {
if (!this.isMountCanceled) {
window.twttr.widgets.createShareButton(
this.props.url,
this.refs.embedContainer,
this.embedContainer.current,
this.props.options
).then((element) => {
this.setState({
Expand All @@ -69,7 +70,7 @@ export default class TwitterShareButton extends Component {
return (
<React.Fragment>
{isLoading && placeholder}
<div ref='embedContainer' />
<div ref={this.embedContainer} />
</React.Fragment>
)
}
Expand Down
7 changes: 4 additions & 3 deletions src/components/TwitterTimelineEmbed.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ export default class TwitterTimelineEmbed extends Component {
this.state = {
isLoading: true
}
this.embedContainer = React.createRef()
}

buildChromeOptions(options) {
Expand All @@ -119,7 +120,7 @@ export default class TwitterTimelineEmbed extends Component {

buildOptions() {
let options = Object.assign({}, this.props.options)
if (this.props.autoHeight) { options.height = this.refs.embedContainer.parentNode.offsetHeight }
if (this.props.autoHeight) { options.height = this.embedContainer.parentNode.offsetHeight }

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if (this.props.autoHeight) { options.height = this.embedContainer.parentNode.offsetHeight }
if (this.props.autoHeight) { options.height = this.embedContainer.current.parentNode.offsetHeight }


options = Object.assign({}, options, {
theme: this.props.theme,
Expand All @@ -144,7 +145,7 @@ export default class TwitterTimelineEmbed extends Component {
id: this.props.id || this.props.widgetId,
url: this.props.url
},
this.refs.embedContainer,
this.embedContainer.current,
options
).then((element) => {
this.setState({
Expand Down Expand Up @@ -184,7 +185,7 @@ export default class TwitterTimelineEmbed extends Component {
return (
<React.Fragment>
{isLoading && placeholder}
<div ref='embedContainer' />
<div ref={this.embedContainer} />
</React.Fragment>
)
}
Expand Down
5 changes: 3 additions & 2 deletions src/components/TwitterTweetEmbed.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ export default class TwitterTweetEmbed extends Component {
this.state = {
isLoading: true
}
this.embedContainer = React.createRef()
}

renderWidget() {
Expand All @@ -39,7 +40,7 @@ export default class TwitterTweetEmbed extends Component {
if (!this.isMountCanceled) {
window.twttr.widgets.createTweet(
this.props.tweetId,
this.refs.embedContainer,
this.embedContainer.current,
this.props.options
).then((element) => {
this.setState({
Expand Down Expand Up @@ -71,7 +72,7 @@ export default class TwitterTweetEmbed extends Component {
return (
<React.Fragment>
{isLoading && placeholder}
<div ref='embedContainer' />
<div ref={this.embedContainer} />
</React.Fragment>
)
}
Expand Down
5 changes: 3 additions & 2 deletions src/components/TwitterVideoEmbed.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ export default class TwitterVideoEmbed extends Component {
this.state = {
isLoading: true
}
this.embedContainer = React.createRef()
}

componentDidMount() {
Expand All @@ -38,7 +39,7 @@ export default class TwitterVideoEmbed extends Component {
if (!this.isMountCanceled) {
window.twttr.widgets.createVideo(
this.props.id,
this.refs.embedContainer
this.embedContainer.current
).then((element) => {
this.setState({
isLoading: false
Expand All @@ -62,7 +63,7 @@ export default class TwitterVideoEmbed extends Component {
return (
<React.Fragment>
{isLoading && placeholder}
<div ref='embedContainer' />
<div ref={this.embedContainer} />
</React.Fragment>
)
}
Expand Down
1 change: 0 additions & 1 deletion src/stories/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -635,7 +635,6 @@ storiesOf('Twitter Timeline Embed', module)
))
)


storiesOf('Twitter Share button', module)
.add(
'Share button',
Expand Down