I would like to add an image
to TextInput
.
Like Android's Spannable
and IOS's NSAttributedString
<Text>
<Text> Test </ Text>
<Image source = {myImage} />
</Text>
I get the results I want.
However, it was not available in TextInput.
If add <Image>
or <Text>
to a TextInput
[Object object]
appears.
How can I add this?
addImage = () => {
const { content } = this.state;
this.setState({
content: content + <Image source={this.myImage} />
})
}
<TextInput
ref={(c) => { this.input = c; }}
multiline
style={[styles.inputStyle, { height: inputHeight }]}
underlineColorAndroid="transparent"
placeholder="PlaceHolder"
placeholderTextColor="#BCBCBC"
value={content}
onChangeText={text => changeContent(text)}
onContentSizeChange={event => changeInputHeight(event)}
/>
<Button onPress={() => addImage()} />
same result
<TextInput
ref={(c) => { this.input = c; }}
multiline
style={[styles.inputStyle, { height: inputHeight }]}
underlineColorAndroid="transparent"
placeholder="PlaceHolder"
placeholderTextColor="#BCBCBC"
value={content}
onChangeText={text => changeContent(text)}
onContentSizeChange={event => changeInputHeight(event)}
>
<Text>
{content}
</Text>
</TextInput
<Button onPress={() => addImage()} />
What I want is to say the image that goes between contents like emoji. It is not an image that is fixed to the left or right.
this is React Native Bug https://github.com/facebook/react-native/issues/18566