Skip to content

Commit 3ac8e8b

Browse files
committed
Merge branch 'new-text-composer' of github.com:GetStream/stream-chat-react-native into attachment-manager-integration
2 parents 7b9d7fa + 181e6a6 commit 3ac8e8b

File tree

3 files changed

+9
-6
lines changed

3 files changed

+9
-6
lines changed

package/src/components/MessageInput/CommandsButton.tsx

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@ import { Lightning } from '../../icons/Lightning';
1212
export type CommandsButtonProps = {
1313
/** Function that opens commands selector */
1414
handleOnPress?: PressableProps['onPress'];
15+
/**
16+
* Determins if the text input has text
17+
*/
18+
hasText?: boolean;
1519
};
1620

1721
const textComposerStateSelector = (state: TextComposerState) => ({
@@ -24,10 +28,10 @@ const searchSourceStateSelector = (nextValue: SearchSourceState) => ({
2428
});
2529

2630
export const CommandsButton = (props: CommandsButtonProps) => {
27-
const { handleOnPress } = props;
31+
const { handleOnPress, hasText } = props;
2832
const messageComposer = useMessageComposer();
2933
const { textComposer } = messageComposer;
30-
const { suggestions, text } = useStateStore(textComposer.state, textComposerStateSelector);
34+
const { suggestions } = useStateStore(textComposer.state, textComposerStateSelector);
3135
const { items } = useStateStore(suggestions?.searchSource.state, searchSourceStateSelector) ?? {};
3236
const trigger = suggestions?.trigger;
3337

@@ -60,7 +64,7 @@ export const CommandsButton = (props: CommandsButtonProps) => {
6064
},
6165
} = useTheme();
6266

63-
if (text) {
67+
if (hasText) {
6468
return null;
6569
}
6670

package/src/components/MessageInput/InputButtons.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ export const InputButtonsWithContext = (props: InputButtonsWithContextProps) =>
8585
<AttachButton />
8686
</View>
8787
)}
88-
{hasCommands && <CommandsButton />}
88+
{hasCommands && <CommandsButton hasText={hasText} />}
8989
</>
9090
);
9191
};

package/src/components/Poll/CreatePollContent.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,7 @@ export const CreatePollContent = () => {
8282
},
8383
};
8484
});
85-
// eslint-disable-next-line react-hooks/exhaustive-deps
86-
}, [createPollOptionHeight, options]);
85+
}, [createPollOptionHeight, currentOptionPositions, options]);
8786

8887
const onBackPressHandler = useCallback(() => {
8988
pollComposer.initState();

0 commit comments

Comments
 (0)