0

TypeScript выдает и подчеркивает ошибку, но тем не менее, код прекрасно работает без её исправления. Пример кода:

import React from 'react';
import QuillEditor, { QuillToolbar } from 'react-native-cn-quill';
import styled from 'styled-components/native';

export default function RichTextEditor() {
  const editor = React.createRef();

  return (
    <MainView>
      <EditorContainer>
        <QuillEditor ref={editor} />
        <QuillToolbar editor={editor} options="basic" theme="light" />
      </EditorContainer>
    </MainView>
  );
}

const MainView = styled.View`
flex: 1;
padding-left: 20px;
padding-right: 20px;
padding-top: 30px;
`;

const EditorContainer = styled.View`
flex: 1;
padding: 10px;
border-color: #DCDCDC;
border-width: 1px;
background-color: #fff;
`;

Код с ошибкой

Текст ошибки

0

1 ответ 1

0

В DATA свойство id вероятнее всего числовое, а в keyExtractor нужно отдавать string, то есть, если сделать так:

keyExtractor={(id) => id.toString()}

будет ок

Ваш ответ

By clicking “Отправить ответ”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Всё ещё ищете ответ? Посмотрите другие вопросы с метками или задайте свой вопрос.