Page MenuHomePhorge

D6556.1768818678.diff
No OneTemporary

Size
3 KB
Referenced Files
None
Subscribers
None

D6556.1768818678.diff

diff --git a/native/keyboard/keyboard-input-host.react.js b/native/keyboard/keyboard-input-host.react.js
--- a/native/keyboard/keyboard-input-host.react.js
+++ b/native/keyboard/keyboard-input-host.react.js
@@ -6,6 +6,7 @@
import { KeyboardAccessoryView } from 'react-native-keyboard-input';
import type { MediaLibrarySelection } from 'lib/types/media-types';
+import type { ThreadInfo } from 'lib/types/thread-types';
import { type InputState, InputStateContext } from '../input/input-state';
import { mediaGalleryKeyboardName } from '../media/media-gallery-keyboard.react';
@@ -46,11 +47,15 @@
const kbComponent = KeyboardInputHost.mediaGalleryOpen(this.props)
? mediaGalleryKeyboardName
: null;
+ const kbInitialProps = {
+ ...this.props.styles.kbInitialProps,
+ threadInfo: this.props.keyboardState.getMediaGalleryThread(),
+ };
return (
<KeyboardAccessoryView
kbInputRef={this.props.textInputRef}
kbComponent={kbComponent}
- kbInitialProps={this.props.styles.kbInitialProps}
+ kbInitialProps={kbInitialProps}
onItemSelected={this.onMediaGalleryItemSelected}
onKeyboardResigned={this.hideMediaGallery}
manageScrollView={false}
@@ -60,11 +65,15 @@
onMediaGalleryItemSelected = async (
keyboardName: string,
- selections: $ReadOnlyArray<MediaLibrarySelection>,
+ result: {
+ +selections: $ReadOnlyArray<MediaLibrarySelection>,
+ +threadInfo: ?ThreadInfo,
+ },
) => {
const { keyboardState } = this.props;
keyboardState.dismissKeyboard();
- const mediaGalleryThread = keyboardState.getMediaGalleryThread();
+
+ const { selections, threadInfo: mediaGalleryThread } = result;
if (!mediaGalleryThread) {
return;
}
diff --git a/native/media/media-gallery-keyboard.react.js b/native/media/media-gallery-keyboard.react.js
--- a/native/media/media-gallery-keyboard.react.js
+++ b/native/media/media-gallery-keyboard.react.js
@@ -22,6 +22,7 @@
} from 'lib/media/file-utils';
import { useIsAppForegrounded } from 'lib/shared/lifecycle-utils';
import type { MediaLibrarySelection } from 'lib/types/media-types';
+import type { ThreadInfo } from 'lib/types/thread-types';
import Button from '../components/button.react';
import type { DimensionsInfo } from '../redux/dimensions-updater.react';
@@ -40,7 +41,11 @@
useNativeDriver: true,
};
+type BaseProps = {
+ +threadInfo: ?ThreadInfo,
+};
type Props = {
+ ...BaseProps,
// Redux state
+dimensions: DimensionsInfo,
+foreground: boolean,
@@ -341,16 +346,7 @@
}
});
- const selectionURIs = selections.map(({ uri }) => uri);
- this.guardedSetState(prevState => ({
- error: null,
- selections: [...selections, ...(prevState.selections ?? [])],
- queuedMediaURIs: new Set([
- ...selectionURIs,
- ...(prevState.queuedMediaURIs ?? []),
- ]),
- focusedMediaURI: null,
- }));
+ this.sendMedia(selections);
} catch (e) {
if (__DEV__) {
console.warn(e);
@@ -587,10 +583,10 @@
...timeProps,
}));
- KeyboardRegistry.onItemSelected(
- mediaGalleryKeyboardName,
- selectionsWithTime,
- );
+ KeyboardRegistry.onItemSelected(mediaGalleryKeyboardName, {
+ selections: selectionsWithTime,
+ threadInfo: this.props.threadInfo,
+ });
}
}
@@ -653,7 +649,7 @@
},
};
-function ConnectedMediaGalleryKeyboard() {
+function ConnectedMediaGalleryKeyboard(props: BaseProps) {
const dimensions = useSelector(state => state.dimensions);
const foreground = useIsAppForegrounded();
const colors = useColors();
@@ -664,14 +660,15 @@
foreground={foreground}
colors={colors}
styles={styles}
+ {...props}
/>
);
}
-function ReduxMediaGalleryKeyboard() {
+function ReduxMediaGalleryKeyboard(props: BaseProps) {
return (
<Provider store={store}>
- <ConnectedMediaGalleryKeyboard />
+ <ConnectedMediaGalleryKeyboard {...props} />
</Provider>
);
}

File Metadata

Mime Type
text/plain
Expires
Mon, Jan 19, 10:31 AM (39 m, 47 s)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
5955894
Default Alt Text
D6556.1768818678.diff (3 KB)

Event Timeline