Skip to content

Commit

Permalink
fix: update example 76
Browse files Browse the repository at this point in the history
  • Loading branch information
17Amir17 committed Dec 2, 2024
1 parent 9117ff7 commit 29f72c4
Showing 1 changed file with 4 additions and 28 deletions.
32 changes: 4 additions & 28 deletions example76/App.tsx
Original file line number Diff line number Diff line change
@@ -1,37 +1,25 @@
import type {NativeStackScreenProps} from '@react-navigation/native-stack';
import React from 'react';
import {
SafeAreaView,
StyleSheet,
KeyboardAvoidingView,
Platform,
useWindowDimensions,
StyleSheet,
} from 'react-native';
import {createStaticNavigation} from '@react-navigation/native';

import {RichText, Toolbar, useEditorBridge} from '@10play/tentap-editor';

import {createNativeStackNavigator} from '@react-navigation/native-stack';
import {useSafeAreaInsets} from 'react-native-safe-area-context';

export const Basic = () => {
export const App = ({}: NativeStackScreenProps<any, any, any>) => {
const editor = useEditorBridge({
autofocus: true,
avoidIosKeyboard: true,
initialContent,
});

const {top} = useSafeAreaInsets();
const {width, height} = useWindowDimensions();
const isLandscape = width > height;
const headerHeight = isLandscape ? 32 : 44;
const keyboardVerticalOffset = headerHeight + top;

return (
<SafeAreaView style={exampleStyles.fullScreen}>
<RichText editor={editor} />
<KeyboardAvoidingView
behavior={Platform.OS === 'ios' ? 'padding' : 'height'}
keyboardVerticalOffset={keyboardVerticalOffset}
style={exampleStyles.keyboardAvoidingView}>
<Toolbar editor={editor} />
</KeyboardAvoidingView>
Expand All @@ -50,18 +38,6 @@ const exampleStyles = StyleSheet.create({
},
});

const initialContent = '<p>This is a basic example!</p>';

const RootStack = createNativeStackNavigator({
screens: {
Home: Basic,
},
});

const Navigation = createStaticNavigation(RootStack);

function App() {
return <Navigation />;
}
const initialContent = `<p>This is a basic example!</p>`;

Check warning on line 41 in example76/App.tsx

View workflow job for this annotation

GitHub Actions / lint

Strings must use singlequote

export default App;

0 comments on commit 29f72c4

Please sign in to comment.