Skip to content

Commit

Permalink
added formatting for iamges to the add note screen as well
Browse files Browse the repository at this point in the history
  • Loading branch information
irvinet20 committed Oct 22, 2023
1 parent 2cfbdc9 commit c0d6fb8
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
14 changes: 11 additions & 3 deletions lib/screens/AddNoteScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,15 @@ const AddNoteScreen: React.FC<AddNoteScreenProps> = ({ navigation, route }) => {
};

const addImageToEditor = (imageUri: string) => {
richTextRef.current?.insertImage(imageUri);
const customStyle = `
max-width: 50%;
height: auto; /* Maintain aspect ratio */
/* Additional CSS properties for sizing */
`;

const imgTag = `<img src="${imageUri}" style="${customStyle}" />`;

richTextRef.current?.insertHTML(imgTag);
};

const saveNote = async () => {
Expand Down Expand Up @@ -295,7 +303,7 @@ const AddNoteScreen: React.FC<AddNoteScreenProps> = ({ navigation, route }) => {
</View>
<View
style={[
{ paddingBottom: keyboardOpen ? 50 : 150 },
{ paddingBottom: keyboardOpen ? 200 : 200 },
{ minHeight: 900 },
]}
>
Expand All @@ -316,7 +324,7 @@ const AddNoteScreen: React.FC<AddNoteScreenProps> = ({ navigation, route }) => {
handleScroll(position);
}}
/>
<View style={{ height: keyboardOpen ? 590 : 270 }} />
<View style={{ height: keyboardOpen ? 400 : 90 }} />
</View>
</ScrollView>
</View>
Expand Down
2 changes: 1 addition & 1 deletion lib/screens/EditNoteScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ const EditNoteScreen: React.FC<EditNoteScreenProps> = ({

const addImageToEditor = (imageUri: string) => {
const customStyle = `
max-width: 50%; /* Set max width to 25% */
max-width: 50%;
height: auto; /* Maintain aspect ratio */
/* Additional CSS properties for sizing */
`;
Expand Down

0 comments on commit c0d6fb8

Please sign in to comment.