mirror of
https://github.com/tooot-app/app
synced 2025-06-05 22:19:13 +02:00
Removed autolinker
This commit is contained in:
@ -1,3 +1,4 @@
|
||||
import { emojis } from '@components/Emojis'
|
||||
import Icon from '@components/Icon'
|
||||
import { StyleConstants } from '@utils/styles/constants'
|
||||
import { useTheme } from '@utils/styles/ThemeManager'
|
||||
@ -16,7 +17,7 @@ const EmojisButton: React.FC = () => {
|
||||
|
||||
return (
|
||||
<Pressable
|
||||
disabled={!emojisState.emojis || !emojisState.emojis.length}
|
||||
disabled={!emojis.current || !emojis.current.length}
|
||||
onPress={() => {
|
||||
if (emojisState.targetIndex === -1) {
|
||||
Keyboard.dismiss()
|
||||
@ -38,12 +39,10 @@ const EmojisButton: React.FC = () => {
|
||||
}}
|
||||
>
|
||||
<Icon
|
||||
name={emojisState.emojis && emojisState.emojis.length ? 'Smile' : 'Meh'}
|
||||
name={emojis.current && emojis.current.length ? 'Smile' : 'Meh'}
|
||||
size={24}
|
||||
color={
|
||||
emojisState.emojis && emojisState.emojis.length
|
||||
? colors.primaryDefault
|
||||
: colors.disabled
|
||||
emojis.current && emojis.current.length ? colors.primaryDefault : colors.disabled
|
||||
}
|
||||
/>
|
||||
</View>
|
||||
|
@ -1,3 +1,4 @@
|
||||
import { emojis } from '@components/Emojis'
|
||||
import Icon from '@components/Icon'
|
||||
import CustomText from '@components/Text'
|
||||
import { useAppDispatch } from '@root/store'
|
||||
@ -175,17 +176,19 @@ const EmojisList = () => {
|
||||
? [
|
||||
{
|
||||
title: 'Search result',
|
||||
data: chunk(
|
||||
emojisState.emojis
|
||||
.filter(e => e.type !== 'frequent')
|
||||
.flatMap(e =>
|
||||
e.data.flatMap(e => e).filter(emoji => emoji.shortcode.includes(search))
|
||||
),
|
||||
2
|
||||
)
|
||||
data: emojis.current
|
||||
? chunk(
|
||||
emojis.current
|
||||
.filter(e => e.type !== 'frequent')
|
||||
.flatMap(e =>
|
||||
e.data.flatMap(e => e).filter(emoji => emoji.shortcode.includes(search))
|
||||
),
|
||||
2
|
||||
)
|
||||
: []
|
||||
}
|
||||
]
|
||||
: emojisState.emojis
|
||||
: emojis.current || []
|
||||
}
|
||||
keyExtractor={item => item[0]?.shortcode}
|
||||
renderSectionHeader={({ section: { title } }) => (
|
||||
|
@ -10,18 +10,21 @@ type inputProps = {
|
||||
addFunc?: (add: string) => void // For none default state update
|
||||
}
|
||||
|
||||
export type Emojis = MutableRefObject<
|
||||
| {
|
||||
title: string
|
||||
data: Pick<Mastodon.Emoji, 'shortcode' | 'url' | 'static_url'>[][]
|
||||
type?: 'frequent'
|
||||
}[]
|
||||
| null
|
||||
>
|
||||
|
||||
export type EmojisState = {
|
||||
emojis: {
|
||||
title: string
|
||||
data: Pick<Mastodon.Emoji, 'shortcode' | 'url' | 'static_url'>[][]
|
||||
type?: 'frequent'
|
||||
}[]
|
||||
inputProps: inputProps[]
|
||||
targetIndex: number
|
||||
}
|
||||
|
||||
export type EmojisAction =
|
||||
| { type: 'load'; payload: NonNullable<EmojisState['emojis']> }
|
||||
| { type: 'input'; payload: EmojisState['inputProps'] }
|
||||
| { type: 'target'; payload: EmojisState['targetIndex'] }
|
||||
|
||||
@ -33,8 +36,6 @@ const EmojisContext = createContext<ContextType>({} as ContextType)
|
||||
|
||||
export const emojisReducer = (state: EmojisState, action: EmojisAction) => {
|
||||
switch (action.type) {
|
||||
case 'load':
|
||||
return { ...state, emojis: action.payload }
|
||||
case 'input':
|
||||
return { ...state, inputProps: action.payload }
|
||||
case 'target':
|
||||
|
Reference in New Issue
Block a user