The emergence of ridesharing services has transformed the shape of urban transportation and brought impacts on the traditional public transit system. While many previous studies have shed light on the relationship between the two transportation modes from a qualitative perspective, there has not been enough quantitative evidence to characterize the pattern thus far. The outbreak of the Covid-19 pandemic in late 2019 further raises interests in the role of ridesharing services under the public health crisis. This study extends the model proposed by Kong et al. 2020 to identify the potential substitution or complementary effects between ridesharing and public transit and further enriches the model’s interpretability by integrating a preference-based choice model. With real-world ridesharing data from Didi in Shenzhen, China, this study provides a quantitative measurement of the relationship between ridesharing and public transit. The spatial-temporal heterogeneity underlying the pattern is examined using linear and spatial regression designs. Using the ridesharing data of the pre and post-covid time, this study further investigates the shifts in the relationship and makes inferences about the change of passenger preferences under the Covid-19 outbreak. The results show that 2.20% of ridesharing trips have the potential of substituting for public transits in 2019, which slightly increases to 2.56% under the Covid-19 outbreak in 2020. The substitution effect becomes stronger during the morning and evening peak hours when public transit is overcrowded, and the complementarity effect is more evident during the night hours when transit routes are less accessible. The results also suggest that ridesharing exhibits a stronger substitution effect to public transit in the central business districts, which are associated with higher housing prices, higher intensity of POIs, more diversified land use, and better spatial coverage of transit stops, and it complements public transit in the areas that are less developed and underserved by public transits. The Covid-19 situation results in an upward shift in the potential substitution effect during the morning (+4.38%) and evening peaks (+3.08%), holding other factors constant, which indicates that ridesharing provides passengers with a utility premium under the Covid-19 situation by reducing the risk of virus exposure in a crowded transit cabin. The findings enrich the literature by providing quantitative support for the relationship and emphasize the important role of ridesharing services under the Covid-19 pandemic.