Uncategorized

AOS with Dynamic Content in React

TL;DR  Using AOS, ReactWebpack & Babel

import '../node_modules/aos/dist/aos.css';
import React from 'react';
import AOS from 'aos';

class HomePage extends React.Component {
  constructor(props, context) {
    super(props, context);
    AOS.init();
  }

  componentWillReceiveProps (){
    AOS.refresh();
  }

  render(){
    return (
<div data-aos="fade-up">{this.props.dynamicContent}</div>
);
  }
}

Quick Explanation

When you load content asynchronously using, callbacks, promises or something like the redux-thunk library, it can sometimes change the height of your DOM after the inital mount of the component where you call AOS.init(). This will throw off the calculations in AOS (Animations On-Scroll). AOS has a built-in method to fix this AOS.refresh() but the question is, when to use it. React lifecycle methods to the rescue. Simple call AOS.refresh() every time the component receives new props using the componentWillReceiveProps lifecycle method. That way, when you receive the asynchronously loaded content, it will refresh AOS and all your animations will trigger at the correct time.

Spending Time With My Son

I spent almost all day yesterday with my 20 month-old son Ash at a Buddhist temple in Orlando. We were there for a spiritual workshop with some friends and family. I didn’t get to sit and listen to much of it or, I should say, I got to sit and listen to exactly as much as I was supposed to, but most of the time Ash and I were running around the temple. He ran up and down the stairs, in and out of tea rooms and sanctuaries, from 9am – 5pm. As you can imagine, I’m a little sore this morning. But it wasn’t until I got home that night, that I realized I had spent all day around my son without feeling any real connection to him at all. All day, part of me wanted to be back with everyone else listening to stories of divine intervention and miraculous healings, so I guess it feels like part of me didn’t want to be spending time with my son. My heart wasn’t in it.

I’m convinced kids are psychicly intuitive. As adults, we don’t really notice that they are aware of what we are thinking and feeling because they don’t exactly where it on their sleeves. If they notice we don’t really want to be spending time with them, they don’t look at us with anger or disappointment, they just keep doing whatever they would be doing. But if I pay attention to Ash very closely, there seems to be a notable difference, in his demeanor, when he’s doing something around me and when he’s doing the exact same thing, with me.

After we left the temple, we had dinner with friends and then Carly and I talked about the day on the way home. And when we got home, we were all pooped, especially Ash. He hadn’t gotten enough sleep that morning since we had to wake up for the workshop. And he didn’t really get a proper nap because it was interrupted by our lunch break. So by the time we got home, he was over-tired and pretty cranky. After watching him frustratedly trying to plug and unplug our phone into the charger for 30 minutes, crying whenever the frustration became too much, I decided to take him outside to run around and let off some steam. He climbed and threw things, running up and down our neighborhood for about a half-hour until we made it to the pond where he likes to throw little seed pods into the water to hear the kurplunk sound. He looked like he was having fun so I decided to let him go at it while I tried to do some meditation while keeping one eye on him.

I did exactly one Omkar meditation and three Kriya breaths before he decided to run off and I had to get up to run after him. For anyone who doesn’t know Kriya Yoga, that’s not a lot of meditation. Most people wouldn’t even count it, but I do. And not just because my life is so full of “life” that I’m lucky to get any meditation at all but also because right after I finished those three Kriya breaths, I was running after my son when I realized I had spent all day around my son but hadn’t spent a single second with him. It was like I had spent all day watching a dog run around, just making sure he didn’t get into any trouble. And so, he was acting like a dog, even at that moment he was running toward the street because he loves to watch the cars.

But something had changed in me, I didn’t see him the same way anymore. I stopped chasing him, and I spoke to him as if he was another adult who understood every word I was saying. I said, “Hey Ash,” he stopped and looked at me, “do you mind if we go inside? We’ve been out here for a while and we should really get ready for bed.” he responded with “Nom, nom, nom nom!” as he walked back to my side and then stayed by my side all the way back to the house. Needless to say, I was astonished. I had spent the entire day chasing after him with no sign that he was even aware I was there unless he wanted something from me. But as soon as I started treating him like a real person, opening my heart to him and feeling like we were in this together, he felt the exact same way. We were finally spending time with each other instead of just around each other.

So I learned two very valuable lessons yesterday:

  1. Not only is it easier to watch Ash if I treat him like a real human-being but I also feel closer and more connected to him.
  2. The tiniest bit of Kriya Yoga can expand my awareness in surprising ways so I should never hesitate to take advantage of any opportunity to sit and practice, no matter how short the practice might be.

Hello World!

This is my first attempt at public blogging and anyone reading this will suffer the pains expected from reading the work of a “newb.” I have already forgiven myself for the audacity of inflicting my opinions upon the world and I hope you will be similarly quick to forgive.

I finished a book today called “Mastery” by Robert Greene. Good book. In no way lacking in interest and inspiration, but I found myself surprised in my inability to take Mr. Greene’s, very well researched and articulately portrayed, words as actionable or even as a full picture of the concept of mastery. The words had vast implications about the evolution of the human race and our conscious role we play, by seeking mastery, in taking the next evolutionary steps for our species, the idea of which I find very attractive, but I felt it was missing a certain something.

As the final story, about the literary and scientific master, Johann Wolfgang von Goethe was shared and it’s lesson on mastery duly summarized I began to identify the source of my apprehensions and lack of motivation to practice what Mr. Greene was preaching to reach mastery. The book failed to discuss or even hint at the possibility that there is definitive mastery of oneself, a level of mastery that makes one master of being a human-being.

Greene, discussed at length the entire spectrum of mastery in particular subjects, everything from basketball to the laws of the universe, and not once was there a mention of an objective level of self-awareness or self-realization that could be called self-mastery. And, from my very earliest readings of the spiritual/occult, it was obvious, if not assumed, by almost all authorities, that there is an objective and even measurable level of self-mastery that earns one the title of being a Master. Not a master of this or that, but simply a master.

Coming upon this realization, I immediately understood why it was left out. Greene’s personal beliefs aside, most of his audience wouldn’t have expected or appreciated such “hooey” as a “universal master level” in an otherwise scientifically grounded work. Still, I think my stance on the book, as it progressed, remained very objective and open to Mr. Greene’s words and perspective, yet the potent feeling that something was missing remained, chapter after chapter. I believe this, along with the resolution of this feeling that accompanied the realization that the missing thing was most likely this “universal master”, to be proof that there must be a level of mastery, most likely measurable only by those who have reached it, that is the same in every human’s path of evolution. Why else, would Mr. Greene’s extensive account of mastery itself, leave so much to be desired on the subject?

If the subject of mastery, is in fact a subject with strong implications on human evolution, as Mr. Greene suggests, then I think, even without finding physical proof, we can assume that the potential for such mastery exists in every human. I think we may also assume that there are no blindingly bright halos above those who have reached mastery and so we must be wary of trusting those who claim to be masters lest we are steered toward the wrong goal. I beleive the surest way to reach the correct goal, and even the goal itself, is precisely what was missing from Robert Greene’s “Mastery.” A complete focus on self-mastery above all other forms of mastery. This way, only you can know what progress is and only you can judge how close you are to your goal.

If you have read the book or simply have something to comment on regarding the subject of mastery, please share below.