Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Highlight issue within TextInput [0.70.0] #34683

Closed
MikeCod opened this issue Sep 13, 2022 · 3 comments
Closed

Highlight issue within TextInput [0.70.0] #34683

MikeCod opened this issue Sep 13, 2022 · 3 comments
Labels
Component: TextInput Related to the TextInput component. Needs: Triage 🔍 Stale There has been a lack of activity on this issue and it may be closed soon.

Comments

@MikeCod
Copy link

MikeCod commented Sep 13, 2022

Description

Cannot highlight words using children.

Version

0.70.0

Output of npx react-native info

System:
OS: macOS 12.5.1
CPU: (4) x64 Intel(R) Core(TM) i7-5557U CPU @ 3.10GHz
Memory: 1.18 GB / 16.00 GB
Shell: 5.8.1 - /bin/zsh
Binaries:
Node: 16.15.1 - /usr/local/bin/node
Yarn: Not Found
npm: 8.19.1 - /usr/local/bin/npm
Watchman: 2022.08.22.00 - /usr/local/bin/watchman
Managers:
CocoaPods: Not Found
SDKs:
iOS SDK: Not Found
Android SDK: Not Found
IDEs:
Android Studio: 2021.2 AI-212.5712.43.2112.8609683
Xcode: 14.0/14A309 - /usr/bin/xcodebuild
Languages:
Java: 11.0.15 - /usr/bin/javac
npmPackages:
@react-native-community/cli: Not Found
react: 18.1.0 => 18.1.0
react-native: ^0.69.5 => 0.69.5
react-native-macos: Not Found
npmGlobalPackages:
react-native: Not Found

Steps to reproduce

Add children to TextInput.

Snack, code example, screenshot, or link to a repository

It works for 0.69.5, not for 0.70.0.

export const MyTextInput = ({ onChangeText, defaultText = "" }) => {
	const [text, setText] = useState(defaultText);
	
	return (
		<TextInput
				onChangeText={value => setText(value)}
				multiline={true}
			>
				{
					text.split(" ").filter(i => i).map((s, i, a) => {
						let color = "black";
						switch (s[0]) {
							case '@':
								color = "orange";
								break;
							case '#':
								color = "blue";
								break;
						}
						return <Text style={{ fontSize:13, color: color }}>{s + (i < a.length - 1 || text.substr(-1) == ' ' ? ' ' : '')}</Text>
					})
				}
			</TextInput>
	);
}
@react-native-bot react-native-bot added the Component: TextInput Related to the TextInput component. label Sep 13, 2022
@MikeCod MikeCod changed the title Highlight within TextInput Highlight issue within TextInput [0.70.0] Sep 14, 2022
@efstathiosntonas
Copy link

this might be related with: #34668

@github-actions
Copy link

This issue is stale because it has been open 180 days with no activity. Remove stale label or comment or this will be closed in 7 days.

@github-actions github-actions bot added the Stale There has been a lack of activity on this issue and it may be closed soon. label Mar 15, 2023
@github-actions
Copy link

This issue was closed because it has been stalled for 7 days with no activity.

@facebook facebook locked as resolved and limited conversation to collaborators Mar 23, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Component: TextInput Related to the TextInput component. Needs: Triage 🔍 Stale There has been a lack of activity on this issue and it may be closed soon.
Projects
None yet
Development

No branches or pull requests

3 participants