Photocatalytic degradation of typical pharmaceuticals in natural sunlight and in actual water is of great significance. In this study, the oxygen or nitrogen linked heptazine-base polymer (ONLH) was successfully incorporated with TiO2 nanoparticles and formed a TiO2/ONLH nanocomposite which was responded to the natural sunlight. Under natural sunlight, the TiO2/ONLH can effectively degrade ten types of pharmaceuticals. In particular, fluoroquinolone containing N-piperazinyl, and cardiovascular drugs containing long aromatic side chains were easily degraded. The half-life of the best degradation performance of propranolol was less than 5 min. The rate constants of propranolol using the TiO2/ONLH were approximately six- and eight-fold higher than those of pristine TiO2 and ONLH, respectively. Two reactive species (OH and O2-) facilitated the rapid degradation of propranolol, which occurred primarily through the hydroxyl radical addition, ring-opening, and ipso substitution reactions. An acute toxicity test using luminescent bacteria indicated that the toxicity of the propranolol reaction solution gradually decreased with lower total organic carbon (TOC). According to the toxicity evaluation of monomer products, the TiO2/ONLH also reduced the generation of toxic transformation products. The effects of actual water/wastewater have further shown the TiO2/ONLH might be applied for the removal of pharmaceuticals in wastewater. Copyright © 2020 Elsevier B.V. All rights reserved.