Я хочу добавить подчеркивание и выравнивание влево, вправо, по центру для текста в RichEditor, но на панели инструментов есть только кнопки по умолчанию. Есть карта значков вызова реквизита, но не знаю, как ею пользоваться.

<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>
0
Prajapati Jigar 10 Апр 2020 в 06:56

1 ответ

Вы можете сделать что-то вроде ниже

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
markcc 21 Янв 2021 в 11:51