There are companies whose "shareholders equity" in their balance sheet have been increasing due to positive earnings, but whose stock prices in the markets have dropped. Why is this happening? Isn't stock prices based on the future earnings?
There's no way to definitively answer the question, but remember that stock price should be based on the expectation of future cash flows. So it's possible that while the company has had positive net income (increasing equity) that the increase hasn't been as large as what was expected, or because some other factors cause investors to believe that the future earnings won't be as high as previously expected.
Yes, there are behavioral aspects as well - cargo-cult buying, panic selling, etc. but even from a fundamental standpoint there's to attribute stock price only to earnings. Startup tech companies often have negative equity for years but their stock has value because of the potential of earnings down the road.
Stock prices are based on what people are willing to pay for it, and what current owners are willing to sell for, nothing else.
Some people use the data you refer to - or other data - to make up their mind about what they are willing to pay, some not. Many follow the general direction - panic or euphoria - of the market, which leads to behavior as you describe.
Even accepting for the sake of discussion the premise that stock prices are based on future earnings, there are a lot of factors other than ownership share that will affect people's ideas of what those future earnings will be.
To take a not entirely contrived*example, suppose you have shares in an agribusiness company that grows soybeans and sells a lot of them to China. Along comes some idiot politician who starts a trade wary by slapping tariffs on a lot of Chinese imports, and in response, the Chinese raise tariffs on American soybeans. All of a sudden your agribusiness is stuck with a lot of soybeans it can't sell, its earnings fall, and so its share price drops.
*See e.g. https://www.npr.org/2018/09/19/649453312/soybean-farmers-worry-about-tariffs-impact or search for "tariff impact on american soybean farmers".