首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何在react-native-pell-react编辑器中使用RichEditor工具栏的图标映射?

如何在react-native-pell-react编辑器中使用RichEditor工具栏的图标映射?
EN

Stack Overflow用户
提问于 2020-04-10 11:56:14
回答 1查看 215关注 0票数 0

我想为RichEditor中的文本添加下划线和左、右、居中对齐,但工具栏中只有默认按钮。有一个道具呼叫图标地图,但不知道如何使用它。

代码语言:javascript
复制
<View style={{
  height: 250, width: '90%', borderRadius: 5, borderWidth: 0.6, borderColor: 'lightgrey',
  alignItems: 'flex-start', flexDirection: 'column', justifyContent: 'center', backgroundColor: 'rgb(242,240,244)', marginLeft: 20
}}>
  <View style={{ flex: 1, }}>
    <RichEditor
      ref={(r) => this.richtext = r}
      initialContentHTML={this.bizDetailsEditorVal}
      keyboardDisplayRequiresUserAction={true}
      onMessage={(s) => {
        console.log(s)
      }}
      style={{
        // minHeight:Platform.OS === 'ios' ? 30 : 40,
        // maxHeight:Platform.OS === 'ios' ? 100: 40,
        height: '100%',
        backgroundColor: 'white',
        flex: 1, justifyContent: 'center',
        minWidth: '100%', width: '100%'
      }}
    />
  </View>
  <View style={{ width: '100%' }}>
    <RichToolbar
      getEditor={() => this.richtext} />
  </View>
EN

回答 1

Stack Overflow用户

发布于 2021-01-21 16:51:12

你可以像下面这样做一些事情

代码语言:javascript
复制
RichToolbar editor={richText}
    actions={[
        actions.keyboard,
        actions.setBold,
        actions.setItalic,
        actions.setUnderline,
        actions.setStrikethrough,
        actions.heading1,
        actions.heading2,
        actions.heading3,
        actions.insertBulletsList,
        actions.insertOrderedList,
        actions.undo,
        actions.redo,
        actions.removeFormat
    ]}
    iconMap={{
        [actions.heading1]: ({ tintColor }) => (<Text style={[styles.tib, { color: tintColor }]}>H1</Text>),
        [actions.heading2]: ({ tintColor }) => (<Text style={[styles.tib, { color: tintColor }]}>H2</Text>),
        [actions.heading3]: ({ tintColor }) => (<Textstyle={[styles.tib, { color: tintColor }]}>H3</Text>),
    }}
/>
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/61133804

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档