【发布时间】:2020-03-13 23:33:39
【问题描述】:
我想在 TextInput 中调整带有表情符号的文本大小,只有文本可以正常工作,但插入表情符号时不行。
const [fontSize, setFontSize] = useState(16);
const input = useRef(null);
// resize Input func
const onFontSizeChange = () => {
setFontSize(fontSize + 5);
input.current.setNativeProps({
style: {
fontSize: fontSize + 5,
},
});
}
<TextInput
ref={input}
multiline={true}
style={{fontSize: 16}}
forceStrutHeight={true}
value={textValue}
onChangeText={typedText => {
validate(typedText);
}}
/>
我该怎么做?
【问题讨论】:
-
onFontSizeChange 什么时候调用?
-
当我完成输入文本,然后点击 TouchableOpacity => 这个调用 onFontSizeChange func
标签: react-native emoji textinput