Skip to content

Commit

Permalink
Merge pull request #47114 from Expensify/roryabraham-cherry-pick-stag…
Browse files Browse the repository at this point in the history
…ing-47110-1

🍒 Cherry pick PR #47110 to staging 🍒
  • Loading branch information
marcaaron authored Aug 8, 2024
2 parents ce7ffe0 + 1148f99 commit 0e9e296
Show file tree
Hide file tree
Showing 9 changed files with 13 additions and 32 deletions.
4 changes: 2 additions & 2 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,8 @@ android {
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
multiDexEnabled rootProject.ext.multiDexEnabled
versionCode 1009001806
versionName "9.0.18-6"
versionCode 1009001807
versionName "9.0.18-7"
// Supported language variants must be declared here to avoid from being removed during the compilation.
// This also helps us to not include unnecessary language variants in the APK.
resConfigs "en", "es"
Expand Down
2 changes: 1 addition & 1 deletion ios/NewExpensify/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
</dict>
</array>
<key>CFBundleVersion</key>
<string>9.0.18.6</string>
<string>9.0.18.7</string>
<key>FullStory</key>
<dict>
<key>OrgId</key>
Expand Down
2 changes: 1 addition & 1 deletion ios/NewExpensifyTests/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>9.0.18.6</string>
<string>9.0.18.7</string>
</dict>
</plist>
2 changes: 1 addition & 1 deletion ios/NotificationServiceExtension/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<key>CFBundleShortVersionString</key>
<string>9.0.18</string>
<key>CFBundleVersion</key>
<string>9.0.18.6</string>
<string>9.0.18.7</string>
<key>NSExtension</key>
<dict>
<key>NSExtensionPointIdentifier</key>
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "new.expensify",
"version": "9.0.18-6",
"version": "9.0.18-7",
"author": "Expensify, Inc.",
"homepage": "https://new.expensify.com",
"description": "New Expensify is the next generation of Expensify: a reimagination of payments based atop a foundation of chat.",
Expand Down
21 changes: 2 additions & 19 deletions src/components/Composer/index.native.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import type {MarkdownStyle} from '@expensify/react-native-live-markdown';
import type {ForwardedRef} from 'react';
import React, {useCallback, useEffect, useMemo, useRef} from 'react';
import type {NativeSyntheticEvent, TextInput, TextInputPasteEventData} from 'react-native';
import React, {useCallback, useMemo, useRef} from 'react';
import type {TextInput} from 'react-native';
import {StyleSheet} from 'react-native';
import type {FileObject} from '@components/AttachmentModal';
import type {AnimatedMarkdownTextInputRef} from '@components/RNMarkdownTextInput';
import RNMarkdownTextInput from '@components/RNMarkdownTextInput';
import useMarkdownStyle from '@hooks/useMarkdownStyle';
Expand All @@ -22,7 +21,6 @@ function Composer(
{
shouldClear = false,
onClear = () => {},
onPasteFile = () => {},
isDisabled = false,
maxLines,
isComposerFullSize = false,
Expand Down Expand Up @@ -66,20 +64,6 @@ function Composer(
// eslint-disable-next-line react-compiler/react-compiler, react-hooks/exhaustive-deps
}, []);

const pasteFile = useCallback(
(e: NativeSyntheticEvent<TextInputPasteEventData>) => {
const clipboardContent = e.nativeEvent.items[0];
if (clipboardContent.type === 'text/plain') {
return;
}
const fileURI = clipboardContent.data;
const fileName = fileURI.split('/').pop();
const file: FileObject = {uri: fileURI, name: fileName, type: clipboardContent.type};
onPasteFile(file);
},
[onPasteFile],
);

useEffect(() => {
if (!shouldClear) {
return;
Expand Down Expand Up @@ -108,7 +92,6 @@ function Composer(
/* eslint-disable-next-line react/jsx-props-no-spreading */
{...props}
readOnly={isDisabled}
onPaste={pasteFile}
onBlur={(e) => {
if (!isFocused) {
// eslint-disable-next-line react-compiler/react-compiler
Expand Down
3 changes: 1 addition & 2 deletions src/components/Composer/types.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import type {NativeSyntheticEvent, StyleProp, TextInputProps, TextInputSelectionChangeEventData, TextStyle} from 'react-native';
import type {FileObject} from '@components/AttachmentModal';

type TextSelection = {
start: number;
Expand Down Expand Up @@ -32,7 +31,7 @@ type ComposerProps = TextInputProps & {
onChangeText?: (numberOfLines: string) => void;

/** Callback method to handle pasting a file */
onPasteFile?: (file: FileObject) => void;
onPasteFile?: (file: File) => void;

/** General styles to apply to the text input */
// eslint-disable-next-line react/forbid-prop-types
Expand Down
5 changes: 2 additions & 3 deletions src/stories/Composer.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import type {Meta} from '@storybook/react';
import {ExpensiMark} from 'expensify-common';
import React, {useState} from 'react';
import {Image, View} from 'react-native';
import type {FileObject} from '@components/AttachmentModal';
import Composer from '@components/Composer';
import type {ComposerProps} from '@components/Composer/types';
import RenderHTML from '@components/RenderHTML';
Expand All @@ -30,7 +29,7 @@ const parser = new ExpensiMark();

function Default(props: ComposerProps) {
const StyleUtils = useStyleUtils();
const [pastedFile, setPastedFile] = useState<FileObject | null>(null);
const [pastedFile, setPastedFile] = useState<File | null>(null);
const [comment, setComment] = useState(props.defaultValue);
const renderedHTML = parser.replace(comment ?? '');

Expand All @@ -54,7 +53,7 @@ function Default(props: ComposerProps) {
<View style={[defaultStyles.p5, defaultStyles.borderBottom, defaultStyles.borderRight, defaultStyles.borderTop, defaultStyles.flex1]}>
<Text style={[defaultStyles.mb2, defaultStyles.textLabelSupporting]}>Rendered Comment</Text>
{!!renderedHTML && <RenderHTML html={renderedHTML} />}
{!!pastedFile && pastedFile instanceof File && (
{!!pastedFile && (
<View style={defaultStyles.mv3}>
<Image
source={{uri: URL.createObjectURL(pastedFile)}}
Expand Down

0 comments on commit 0e9e296

Please sign in to comment.