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

Rewrite header buttons

This commit is contained in:
Zhiyuan Zheng
2020-12-26 23:27:53 +01:00
parent da79674548
commit bd5601f8f9
11 changed files with 132 additions and 142 deletions

View File

@ -540,6 +540,8 @@ const Compose: React.FC<Props> = ({ route: { params }, navigation }) => {
const headerLeft = useCallback(
() => (
<HeaderLeft
type='text'
content='退出编辑'
onPress={() =>
Alert.alert('确认取消编辑?', '', [
{ text: '继续编辑', style: 'cancel' },
@ -550,7 +552,6 @@ const Compose: React.FC<Props> = ({ route: { params }, navigation }) => {
}
])
}
text='退出编辑'
/>
),
[]
@ -571,16 +572,15 @@ const Compose: React.FC<Props> = ({ route: { params }, navigation }) => {
[totalTextCount]
)
const headerRight = useCallback(
() =>
isSubmitting ? (
<ActivityIndicator />
) : (
<HeaderRight
onPress={async () => tootPost()}
text={params?.type ? postButtonText[params.type] : '发嘟嘟'}
disabled={rawCount < 1 || totalTextCount > 500}
/>
),
() => (
<HeaderRight
type='text'
content={params?.type ? postButtonText[params.type] : '发嘟嘟'}
onPress={async () => tootPost()}
loading={isSubmitting}
disabled={rawCount < 1 || totalTextCount > 500}
/>
),
[isSubmitting, rawCount, totalTextCount]
)
@ -605,7 +605,6 @@ const Compose: React.FC<Props> = ({ route: { params }, navigation }) => {
</Stack.Screen>
</Stack.Navigator>
</SafeAreaView>
<Toast ref={(ref: any) => Toast.setRef(ref)} config={toastConfig} />
</KeyboardAvoidingView>
)
}