According to Bulbahandbook:
The following actions will break a chain:
- Fleeing the battle.
- The caller fainting without an ally being present.
- The caller calling a Pokémon that is not of the same family as the caller does not break the chain. However, it should be noted that if the caller faints while the ally is not of the same family as the caller, the chance that the non-family ally will call new allies is very low.
This says that encountering a shiny will not break your chain. Furthermore, in previous generations, chain fishing and PokeRadar chaining could continue even if a shiny Pokemon was encountered and caught, as long as all the other conditions for chaining were met. This is likely to be the case in Sun and Moon as well.
Hope I helped. :)
Source and Source