mirror of
https://github.com/facebook/react-native.git
synced 2026-11-18 20:19:07 +00:00
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/51372 I got notified that a recent change I made was causing a crash. This would happen when the endOffset of the link is larger than the end offset of the line. This can be repro'd with ``` /** * (c) Meta Platforms, Inc. and affiliates. Confidential and proprietary. * * flow strict-local * format */ import {useState} from 'react'; import {Platform, StyleSheet, Text, View} from 'react-native'; export default function Playground() { const [state, setState] = useState(false); function toggle() { setState(old => !old); } return ( <View style={styles.container}> <Text style={[styles.paragraph, state && {backgroundColor: 'red'}]} numberOfLines={3}> <Text>Bacon Ipsum{'\n'}</Text> <Text>Dolor sit amet{'\n'}</Text> <Text>{'\n'}</Text> <Text accessibilityRole="link" onPress={toggle}> http://www.google.com </Text> </Text> </View> ); } const styles = StyleSheet.create({ container: { flex: 1, justifyContent: 'center', paddingTop: 24, backgroundColor: '#ecf0f1', padding: 8, }, paragraph: { margin: 24, fontSize: 18, fontWeight: 'bold', textAlign: 'center', }, }); ``` This was encountered already by NickGerleman in D46206673 (https://github.com/facebook/react-native/pull/37050) and the fix is fairly straightforward. I modified that fix to check for the endOffset as well. Changelog: [Internal] Reviewed By: zeyap Differential Revision: D74823458 fbshipit-source-id: 08fe81893f1c41d1934215515f88a6e0e546e705