1
0
mirror of https://github.com/tooot-app/app synced 2025-06-05 22:19:13 +02:00

Fix issues

This commit is contained in:
Zhiyuan Zheng
2021-05-09 23:16:53 +02:00
parent 46b63b33d6
commit 9658b0cb71
5 changed files with 88 additions and 76 deletions

View File

@@ -116,7 +116,6 @@ const ComponentEmojis: React.FC<Props> = ({
const addEmoji = useCallback(
(emojiShortcode: string) => {
console.log(selectionRange.current)
if (value?.length) {
const contentFront = value.slice(0, selectionRange.current?.start)
const contentRear = value.slice(selectionRange.current?.end)

View File

@@ -84,7 +84,7 @@ const ComposePoll: React.FC = () => {
<View style={styles.controlAmount}>
<View style={styles.firstButton}>
<Button
{...((total > 2)
{...(total > 2
? {
accessibilityLabel: t(
'content.root.footer.poll.quantity.reduce.accessibilityLabel',
@@ -139,78 +139,80 @@ const ComposePoll: React.FC = () => {
disabled={!(total < 4)}
/>
</View>
<MenuRow
title={t('content.root.footer.poll.multiple.heading')}
content={
multiple
? t('content.root.footer.poll.multiple.options.multiple')
: t('content.root.footer.poll.multiple.options.single')
}
onPress={() =>
showActionSheetWithOptions(
{
options: [
t('content.root.footer.poll.multiple.options.single'),
t('content.root.footer.poll.multiple.options.multiple'),
t('content.root.footer.poll.multiple.options.cancel')
],
cancelButtonIndex: 2
},
index => {
if (index < 2) {
analytics('compose_poll_expiration_press', {
current: multiple,
new: index === 1
})
composeDispatch({
type: 'poll',
payload: { multiple: index === 1 }
})
<View style={styles.controlOptions}>
<MenuRow
title={t('content.root.footer.poll.multiple.heading')}
content={
multiple
? t('content.root.footer.poll.multiple.options.multiple')
: t('content.root.footer.poll.multiple.options.single')
}
onPress={() =>
showActionSheetWithOptions(
{
options: [
t('content.root.footer.poll.multiple.options.single'),
t('content.root.footer.poll.multiple.options.multiple'),
t('content.root.footer.poll.multiple.options.cancel')
],
cancelButtonIndex: 2
},
index => {
if (index < 2) {
analytics('compose_poll_expiration_press', {
current: multiple,
new: index === 1
})
composeDispatch({
type: 'poll',
payload: { multiple: index === 1 }
})
}
}
}
)
}
iconBack='ChevronRight'
/>
<MenuRow
title={t('content.root.footer.poll.expiration.heading')}
content={t(`content.root.footer.poll.expiration.options.${expire}`)}
onPress={() => {
const expirations: [
'300',
'1800',
'3600',
'21600',
'86400',
'259200',
'604800'
] = ['300', '1800', '3600', '21600', '86400', '259200', '604800']
showActionSheetWithOptions(
{
options: [
...expirations.map(e =>
t(`content.root.footer.poll.expiration.options.${e}`)
),
t('content.root.footer.poll.expiration.options.cancel')
],
cancelButtonIndex: 7
},
index => {
if (index < 7) {
analytics('compose_poll_expiration_press', {
current: expire,
new: expirations[index]
})
composeDispatch({
type: 'poll',
payload: { expire: expirations[index] }
})
)
}
iconBack='ChevronRight'
/>
<MenuRow
title={t('content.root.footer.poll.expiration.heading')}
content={t(`content.root.footer.poll.expiration.options.${expire}`)}
onPress={() => {
const expirations: [
'300',
'1800',
'3600',
'21600',
'86400',
'259200',
'604800'
] = ['300', '1800', '3600', '21600', '86400', '259200', '604800']
showActionSheetWithOptions(
{
options: [
...expirations.map(e =>
t(`content.root.footer.poll.expiration.options.${e}`)
),
t('content.root.footer.poll.expiration.options.cancel')
],
cancelButtonIndex: 7
},
index => {
if (index < 7) {
analytics('compose_poll_expiration_press', {
current: expire,
new: expirations[index]
})
composeDispatch({
type: 'poll',
payload: { expire: expirations[index] }
})
}
}
}
)
}}
iconBack='ChevronRight'
/>
)
}}
iconBack='ChevronRight'
/>
</View>
</View>
)
}
@@ -247,6 +249,9 @@ const styles = StyleSheet.create({
justifyContent: 'flex-end',
marginRight: StyleConstants.Spacing.M
},
controlOptions: {
paddingHorizontal: StyleConstants.Spacing.Global.PagePadding
},
firstButton: {
marginRight: StyleConstants.Spacing.S
}

View File

@@ -1,4 +1,4 @@
import { MenuRow } from '@components/Menu'
import { MenuContainer, MenuRow } from '@components/Menu'
import { StackScreenProps } from '@react-navigation/stack'
import { useListsQuery } from '@utils/queryHooks/lists'
import React from 'react'
@@ -10,11 +10,12 @@ const TabMeLists: React.FC<StackScreenProps<
const { data } = useListsQuery({})
return (
<>
<MenuContainer>
{data?.map((d: Mastodon.List, i: number) => (
<MenuRow
key={i}
iconFront='List'
iconBack='ChevronRight'
title={d.title}
onPress={() =>
navigation.navigate('Tab-Me-Lists-List', {
@@ -24,7 +25,7 @@ const TabMeLists: React.FC<StackScreenProps<
}
/>
))}
</>
</MenuContainer>
)
}