Fix issues

This commit is contained in:
Zhiyuan Zheng 2021-05-09 23:16:53 +02:00
parent 46b63b33d6
commit 9658b0cb71
No known key found for this signature in database
GPG Key ID: 078A93AB607D85E0
5 changed files with 88 additions and 76 deletions

View File

@ -20,7 +20,8 @@
"ios": "react-native run-ios",
"app:build": "bundle exec fastlane build",
"test": "jest --watchAll",
"release": "scripts/release.sh"
"release": "scripts/release.sh",
"clean": "react-native-clean-project"
},
"dependencies": {
"@expo/react-native-action-sheet": "^3.9.0",
@ -114,6 +115,7 @@
"jest": "^26.6.3",
"jest-expo": "^40.0.2",
"nock": "^13.0.11",
"react-native-clean-project": "^3.6.3",
"react-navigation": "^4.4.4",
"react-navigation-stack": "^2.10.4",
"react-test-renderer": "^17.0.1",

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>
)
}

View File

@ -8731,6 +8731,11 @@ react-native-blurhash@^1.1.4:
resolved "https://registry.yarnpkg.com/react-native-blurhash/-/react-native-blurhash-1.1.4.tgz#820afd0ef1cea3b1d322d0448f92964286b85843"
integrity sha512-lQFDVzrRGU0r3kC7I66MEiGKlzMeRVUm5Jt50rGZnXkm+kLK+LQDOwqEGxxn2Y2OMoDylzrccdX7mP9bf5BnLA==
react-native-clean-project@^3.6.3:
version "3.6.3"
resolved "https://registry.yarnpkg.com/react-native-clean-project/-/react-native-clean-project-3.6.3.tgz#ad43b8e1491512f285b7f455ac56db3328b5a65f"
integrity sha512-sBbv+Zl05O9LfQqamLu2Crb//W/d8+l59TICF8nKxQ0nJsvear06a1CB2+FaO3rCrPNHiSjDDNXZ/D6muHTUkw==
react-native-codegen@^0.0.6:
version "0.0.6"
resolved "https://registry.yarnpkg.com/react-native-codegen/-/react-native-codegen-0.0.6.tgz#b3173faa879cf71bfade8d030f9c4698388f6909"