Comments (10)
while i'm using VerticalTimelineElement component .vertical-timeline--animate .vertical-timeline-element-icon.is-hidden { visibility: hidden } this class name is coming and making the section hidden
from react-vertical-timeline.
while i'm using VerticalTimelineElement component .vertical-timeline--animate .vertical-timeline-element-icon.is-hidden { visibility: hidden } this class name is coming and making the section hidden
I think this is the intended functionality/setup, since the purpose is to animate the timeline when it is in view using. I suppose it uses Intersection Observer to change the element to visibility: visible
, but it it's not changing it for me as well, so I guess the Intersection Observer is not kicking in to display my <VerticalTimelineElement>
's.
@madhusportIT Did you find a solution to this?
from react-vertical-timeline.
Could you provide a full example please ?
from react-vertical-timeline.
import React from 'react';
import firebase from './Firebase';
import Cookies from 'universal-cookie';
import { VerticalTimeline, VerticalTimelineElement } from 'react-vertical-timeline-component';
import 'react-vertical-timeline-component/style.min.css';
import Header from './Header';
export default class LoginPage extends React.Component {
constructor(props){
super(props);
this.state = {
userID: null,
profileImgUrl: null,
name: null,
isDoneLoadingData: false
}
this.progressArray = [];
}
componentWillMount(){
let that = this;
firebase.auth().onAuthStateChanged(function(user) {
if (user) {
let userID = firebase.auth().currentUser.uid;
console.log(userID);
let cookies = new Cookies();
let profileImgUrl = (cookies.get('profileImgUrl',{doNotParse:true}));
let name = (cookies.get('name',{doNotParse:true}));
that.setState({userID: userID, profileImgUrl: profileImgUrl, name: name},()=>{
console.log(this.state);
that.fetchProgressData();
});
} else {
console.log('user not signed in');
his.props.history.replace('/progress');
}
});
}
fetchProgressData = () => {
let ref = firebase.database().ref('users/' + this.state.userID + '/progress')
ref.on('value', (snapshot)=>{
console.log(snapshot.val())
snapshot.forEach((childSnapshot)=>{
console.log(childSnapshot.val());
this.progressArray.push(childSnapshot.val());
this.setState({isDoneLoadingData: true});
})
});
}
constructTimeLine = () =>{
return(
this.progressArray.map((object,i) => {
console.log('test')
return (
<VerticalTimelineElement
key={i}
style={{visibility:'visible', height:'200px'}}
iconStyle={{ background: object.color, color: '#fff' }}
date={object.date}
position='right'
>
<div>
<div style={{display:'flex'}}>
{object.imageUrls.map((url,i)=>{
return(
<img key={i} src={url} style={{width:'50px', height:'50px',marginRight:'5px',borderRadius:'3px'}}></img>
)
})
}
</div>
<p style={{color:'green'}}>{object.comments}</p>
</div>
</VerticalTimelineElement>
);
})
)
}
render(){
return(
<div>
<Header
name={this.state.name}
imgUrl={this.state.profileImgUrl}
/>
{this.state.isDoneLoadingData&&
<VerticalTimeline>
{this.constructTimeLine()}
</VerticalTimeline>
}
</div>
)
}
}
This is the page that gets rendered using react-router. I have barebones styling as I'm building out functionality first, turns out the issue was with react-visibility, I have no clue why it was getting called and hidding all the VerticalTimeLineElements but I have commented it out in your ./dist-es6/VerticalTimeLineElement.js and the timeline is now visible. Although interestingly enough I can't seem to set the position for the elements (they all render on the right).
_createClass(VerticalTimelineElement, [{
key: 'onVisibilitySensorChange',
value: function onVisibilitySensorChange(isVisible) {
//if (isVisible) {
this.setState({ visible: true });
//}
}
}, {
from react-vertical-timeline.
I tried, It works for me.
For the position, if you remove the position prop, it will automatically position to left and right.
const constructTimeLine = () =>
[
{ color: 'red', comments: 'test', date: 'dada' },
{ color: 'blue', comments: 'test 2', date: 'dada' },
].map((object, i) => {
console.log('test');
return (
<VerticalTimelineElement
key={i}
style={{ visibility: 'visible', height: '200px' }}
iconStyle={{ background: object.color, color: '#fff' }}
date={object.date}
>
<div>
<div style={{ display: 'flex' }}>tata</div>
<p style={{ color: 'green' }}>{object.comments}</p>
</div>
</VerticalTimelineElement>
);
});
And I use in my render function :
render () {
return <VerticalTimeline>{constructTimeLine()}</VerticalTimeline>
}
from react-vertical-timeline.
I'm working on this mapping the elements of timeline today. It doesn't populate the elements for me.
`getIconClass(val) {
var iconClass = '';
switch (val) {
case 'initialize':
iconClass = "fa fa-3x fa-hourglass-start"
break;
case 'progress':
iconClass = "fa fa-3x fa-caret-square-o-down"
break;
case 'email':
iconClass = "fa fa-3x fa-envelope"
break;
case 'end':
iconClass = "fa fa-3x fa-hourglass-end"
break;
default:
iconClass = "fa fa-3x fa-caret-square-o-down"
break;
}
return iconClass;
}
renderTimelineElements() {
const { apiRes } = this.state;
apiRes.StaticWorkflowRes.forEach((element, ind) => {
if (element.reqType === this.props.reqTypeId) {
element.steps.map((eleMap, ind) => {
var iconClass = this.getIconClass(eleMap.stepType);
return (
<VerticalTimelineElement
key={ind}
className="vertical-timeline-element"
contentStyle={{ background: 'rgb(33, 150, 243)', color: '#fff' }}
contentArrowStyle={{ borderRight: '7px solid rgb(33, 150, 243)' }}
date={`Step ${ind + 1}`}
iconStyle={{ background: 'rgb(33, 150, 243)', color: '#fff' }}
icon={<i className={iconClass}
style={{
'position': 'absolute',
'right': '11px',
'top': '10px'
}}></i>}
>
<div>
<h3 className="vertical-timeline-element-title">{eleMap.titleVal}</h3>
<h4 className="vertical-timeline-element-subtitle">{eleMap.subtitleVal}</h4>
<p>{eleMap.stepDesc}</p>
</div>
</VerticalTimelineElement>
)
})
}
});
}
render() {
return (
<React.Fragment>
<VerticalTimeline animate={true}>
{this.renderTimelineElements()}
</VerticalTimeline>
</React.Fragment>
)
}`
from react-vertical-timeline.
Hi @wilbertcaba use visible={true} props inside of the VerticalTimelineElement Element
from react-vertical-timeline.
Hi @wilbertcaba use visible={true} props inside of the VerticalTimelineElement Element
@madhusportIT Thanks for the tip. That effectively makes the <VerticalTimelineElement>
visible, but then I loose the animation once the elements are in view. These animations are enabled by intersectionObserverProps={{ rootMargin: "0px 0px 40px 0px" }}
when the <VerticalTimeline>
enters the viewport, I guess only when visible={false}
.
@stephane-monnot Any thoughts?
from react-vertical-timeline.
@wilbertcaba but in my case the animation is working
from react-vertical-timeline.
@madhusportIT do you have the timeline above the fold?
If the timeline is in the viewport (or above the fold) when the page is loaded, the animation works for me as well. If the timeline is not in the viewport, the animation works as well, but by the time I scroll down to the timeline the animation has already been executed so I don't get to see it.
Anyways, I was using Next.js 14.1.0 and I did some magic tricks to make it work by creating a component for the <VerticalTimelineElement>
then importing and using it within <VerticalTimeline>
. But, I ended up downgrading to Next.js 13 (not my desired outcome) which also worked for me by using it as intended (as seen in the Docs) without having to use visible={true}
props.
from react-vertical-timeline.
Related Issues (20)
- How to modify style.min.css for custom styling
- enhancement: Ability to add custom breakpoints
- How to remove vertical line and icons HOT 1
- Can't find a way to remove connector below last item HOT 1
- change lineColor for tailwind dark mode HOT 2
- The white line not showing on the first render in NextJS 13 HOT 3
- No props for icon box shadow
- TypeError: Cannot read properties of undefined (reading 'prototype') HOT 3
- Animation Issue in Timeline when Loading More Items HOT 5
- In Next js 13.5 react-vertical-timeline not working HOT 35
- Typescript Error HOT 8
- [QUESTION] does react-vertical-timeline support live feed, out of the box? HOT 1
- Receiving warning: extra attributes from the server: style when using component HOT 1
- How do i change the border type for the sideline??
- Does the react-vertical-timeline-component doesn't work in latest next.js? HOT 17
- Have the 2 columns layaut also in mobile HOT 1
- VerticalTimelineElement doesn't properly center all icon elements HOT 4
- "Unable to resolve dependency tree" HOT 1
- how to customize width of the element HOT 1
- não funciona
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react-vertical-timeline.