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

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

View File

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

View File

@ -84,7 +84,7 @@ const ComposePoll: React.FC = () => {
<View style={styles.controlAmount}> <View style={styles.controlAmount}>
<View style={styles.firstButton}> <View style={styles.firstButton}>
<Button <Button
{...((total > 2) {...(total > 2
? { ? {
accessibilityLabel: t( accessibilityLabel: t(
'content.root.footer.poll.quantity.reduce.accessibilityLabel', 'content.root.footer.poll.quantity.reduce.accessibilityLabel',
@ -139,78 +139,80 @@ const ComposePoll: React.FC = () => {
disabled={!(total < 4)} disabled={!(total < 4)}
/> />
</View> </View>
<MenuRow <View style={styles.controlOptions}>
title={t('content.root.footer.poll.multiple.heading')} <MenuRow
content={ title={t('content.root.footer.poll.multiple.heading')}
multiple content={
? t('content.root.footer.poll.multiple.options.multiple') multiple
: t('content.root.footer.poll.multiple.options.single') ? t('content.root.footer.poll.multiple.options.multiple')
} : t('content.root.footer.poll.multiple.options.single')
onPress={() => }
showActionSheetWithOptions( onPress={() =>
{ showActionSheetWithOptions(
options: [ {
t('content.root.footer.poll.multiple.options.single'), options: [
t('content.root.footer.poll.multiple.options.multiple'), t('content.root.footer.poll.multiple.options.single'),
t('content.root.footer.poll.multiple.options.cancel') t('content.root.footer.poll.multiple.options.multiple'),
], t('content.root.footer.poll.multiple.options.cancel')
cancelButtonIndex: 2 ],
}, cancelButtonIndex: 2
index => { },
if (index < 2) { index => {
analytics('compose_poll_expiration_press', { if (index < 2) {
current: multiple, analytics('compose_poll_expiration_press', {
new: index === 1 current: multiple,
}) new: index === 1
composeDispatch({ })
type: 'poll', composeDispatch({
payload: { multiple: index === 1 } type: 'poll',
}) payload: { multiple: index === 1 }
})
}
} }
} )
) }
} iconBack='ChevronRight'
iconBack='ChevronRight' />
/> <MenuRow
<MenuRow title={t('content.root.footer.poll.expiration.heading')}
title={t('content.root.footer.poll.expiration.heading')} content={t(`content.root.footer.poll.expiration.options.${expire}`)}
content={t(`content.root.footer.poll.expiration.options.${expire}`)} onPress={() => {
onPress={() => { const expirations: [
const expirations: [ '300',
'300', '1800',
'1800', '3600',
'3600', '21600',
'21600', '86400',
'86400', '259200',
'259200', '604800'
'604800' ] = ['300', '1800', '3600', '21600', '86400', '259200', '604800']
] = ['300', '1800', '3600', '21600', '86400', '259200', '604800'] showActionSheetWithOptions(
showActionSheetWithOptions( {
{ options: [
options: [ ...expirations.map(e =>
...expirations.map(e => t(`content.root.footer.poll.expiration.options.${e}`)
t(`content.root.footer.poll.expiration.options.${e}`) ),
), t('content.root.footer.poll.expiration.options.cancel')
t('content.root.footer.poll.expiration.options.cancel') ],
], cancelButtonIndex: 7
cancelButtonIndex: 7 },
}, index => {
index => { if (index < 7) {
if (index < 7) { analytics('compose_poll_expiration_press', {
analytics('compose_poll_expiration_press', { current: expire,
current: expire, new: expirations[index]
new: expirations[index] })
}) composeDispatch({
composeDispatch({ type: 'poll',
type: 'poll', payload: { expire: expirations[index] }
payload: { expire: expirations[index] } })
}) }
} }
} )
) }}
}} iconBack='ChevronRight'
iconBack='ChevronRight' />
/> </View>
</View> </View>
) )
} }
@ -247,6 +249,9 @@ const styles = StyleSheet.create({
justifyContent: 'flex-end', justifyContent: 'flex-end',
marginRight: StyleConstants.Spacing.M marginRight: StyleConstants.Spacing.M
}, },
controlOptions: {
paddingHorizontal: StyleConstants.Spacing.Global.PagePadding
},
firstButton: { firstButton: {
marginRight: StyleConstants.Spacing.S 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 { StackScreenProps } from '@react-navigation/stack'
import { useListsQuery } from '@utils/queryHooks/lists' import { useListsQuery } from '@utils/queryHooks/lists'
import React from 'react' import React from 'react'
@ -10,11 +10,12 @@ const TabMeLists: React.FC<StackScreenProps<
const { data } = useListsQuery({}) const { data } = useListsQuery({})
return ( return (
<> <MenuContainer>
{data?.map((d: Mastodon.List, i: number) => ( {data?.map((d: Mastodon.List, i: number) => (
<MenuRow <MenuRow
key={i} key={i}
iconFront='List' iconFront='List'
iconBack='ChevronRight'
title={d.title} title={d.title}
onPress={() => onPress={() =>
navigation.navigate('Tab-Me-Lists-List', { 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" resolved "https://registry.yarnpkg.com/react-native-blurhash/-/react-native-blurhash-1.1.4.tgz#820afd0ef1cea3b1d322d0448f92964286b85843"
integrity sha512-lQFDVzrRGU0r3kC7I66MEiGKlzMeRVUm5Jt50rGZnXkm+kLK+LQDOwqEGxxn2Y2OMoDylzrccdX7mP9bf5BnLA== 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: react-native-codegen@^0.0.6:
version "0.0.6" version "0.0.6"
resolved "https://registry.yarnpkg.com/react-native-codegen/-/react-native-codegen-0.0.6.tgz#b3173faa879cf71bfade8d030f9c4698388f6909" resolved "https://registry.yarnpkg.com/react-native-codegen/-/react-native-codegen-0.0.6.tgz#b3173faa879cf71bfade8d030f9c4698388f6909"