React Native 富文本编辑器 `react-native-pell-rich-editor`. 使用中遇到的问题

React Native 富文本编辑器 react-native-pell-rich-editor. 使用中遇到的问题.

以下只是比较肤浅的解决方案, 有更好的解决方案, 大家可以告诉我, 如果我研究了, 也会更新.

工具栏

1. 默认 Editor 想工具栏是一行, 滚动的, 但是如果想显示多行, 可以通过以下方式实现:

<RichToolbar> 的 style 增加一个高度, 例如 height: 130

修改 RichToolbar.js

<FlatList
    // horizontal
    numColumns={8}
    style={{width: '100%'}}
    columnWrapperStyle={{justifyContent: 'space-around'}}
    
    keyboardShouldPersistTaps={'always'}
    keyExtractor={(item, index) => item.action + '-' + index}
    data={this.state.data}
    alwaysBounceHorizontal={false}
    showsHorizontalScrollIndicator={false}
    renderItem={({item}) => this._renderAction(item.action, item.selected)}
    contentContainerStyle={flatContainerStyle}
/>

输入框高度

输入框的高度, 随着内容的增加或者减少, 只增不减. 以下方法可以解决减少的场景, 让高度更新.

componentDidMount() {
	interval = setInterval(() => {
	  this.richText.current && this.richText.current.setState({height: this.richText.current.state.height});
	}, 10000);
}

componentWillUnmount(): void {
	interval && clearInterval(interval);
}
  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 4
    评论
评论 4
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值