Yes and no, at least in the United States. An aftermarket part may void the warranty IF it caused or led to the problem under consideration. For example, let's say your engine craters on you and you've the sprocket. They can't blame engine failure on a sprocket (unless the sprocket change clearly caused severe overrevving or lugging, for example.)
Now let's say you get your engine fixed and then add an exhaust can. Now your turn signals quit working. Warranty implications?? Naaaa. But what if your fuel injection quits working? Will they honor the warranty given the fact that you've added the exhaust can? Maybe, but they could probably say "no" also, and either answer might be justifiable.