Skip to content

Commit

Permalink
Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
abanobmikaeel committed Sep 30, 2023
1 parent d6f4d3b commit 2652b28
Showing 1 changed file with 2 additions and 29 deletions.
31 changes: 2 additions & 29 deletions src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,35 +48,8 @@ export const CKEditor5 = ({
placeHolderText,
onLoadEnd,
}: CKEditorProps) => {
const currentHeight = height ?? 150;
const webview = useRef(null);

const [currentHeight, setCurrentHeight] = useState<number>(height ?? 150);
// static defaultProps = {
// currentHeight: 150,
// }

// const onError = (error: WebViewProps) => {
// if (this.props.onError) {
// this.props.onError(error);
// } else {
// Alert.alert('WebView onError', error, [
// { text: 'OK', onPress: () => console.log('OK Pressed') },
// ]);
// }

const onRenderError = (
errorDomain: string | undefined,
errorCode: number,
errorDesc: string
): React.ReactElement<any, string | React.JSXElementConstructor<any>> => {
if (renderError) {
renderError(errorDomain, errorCode, errorDesc);
return <></>;
} else {
return <Text>Unable to run editor</Text>;
}
};

const onMessage = (event: WebViewMessageEvent) => {
const data = event.nativeEvent.data;

Expand Down Expand Up @@ -187,7 +160,7 @@ export const CKEditor5 = ({
source={webapp}
scalesPageToFit={true}
onError={onError}
renderError={onError}
renderError={renderError}
javaScriptEnabled
onLoadEnd={onLoadEnd}
onHttpError={onError}
Expand Down

0 comments on commit 2652b28

Please sign in to comment.