| fix: TextInput cursorColor is not following selectionColor
Co-authored-by: zichenyang<zichen834194@163.com>
# message auto-generated for no-merge-commit merge:
merge default_cursor_color_not_selection into 0.77.1-rc.1-ohos
fix: TextInput cursorColor is not following selectionColor
Created-by: zichenyang21
Commit-by: zichenyang
Merged-by: huangyouhua
Description: # Why are these changes being made?
When cursorColor is not set and selectionColor has been set, the cursorColor is still black, which is not consistant with selectionColor.
# Changelog
set cursorColor as black by default.
# Test Plan
Run the following demo, observe that default cursorColor is black, and when selectionColor is set, cursorColor should be the same as selectionColor.
```
import React, { useState } from 'react';
import { View, Text, TextInput, StyleSheet } from 'react-native';
const DefaultCursorColorDemo = () => {
const [text, setText] = useState('');
const [password, setPassword] = useState('');
return (
<View style={styles.container}>
<Text style={styles.title}>TextInput Demo</Text>
<TextInput
style={styles.input}
placeholder="Black cursorColor"
value="value test"
/>
<TextInput
style={styles.input}
placeholder="Red selectionColor, red cursorColor"
value="value test"
selectionColor='red'
/>
</View>
);
};
const styles = StyleSheet.create({
container: {
flex: 1,
padding: 20,
justifyContent: 'center',
},
title: {
fontSize: 20,
fontWeight: 'bold',
marginBottom: 20,
textAlign: 'center',
},
input: {
height: 40,
borderColor: 'gray',
borderWidth: 1,
marginBottom: 20,
paddingHorizontal: 10,
borderRadius: 5,
},
});
export default DefaultCursorColorDemo;
```
See merge request: openharmony-sig/ohos_react_native!1237 | 10 个月前 |