diff options
author | Paul Frazee <pfrazee@gmail.com> | 2022-11-14 15:19:08 -0600 |
---|---|---|
committer | Paul Frazee <pfrazee@gmail.com> | 2022-11-14 15:19:08 -0600 |
commit | 4a2170be49d901b101ba2835c6684d40250fec41 (patch) | |
tree | 63701b1ba950730f65d9eb44b2932fde8027aa35 /src/view/com/modals/CreateScene.tsx | |
parent | 4a0b79da4a716e4993c8767610c12b0f51cf9608 (diff) | |
download | voidsky-4a2170be49d901b101ba2835c6684d40250fec41.tar.zst |
Enforce limits on create scene as well
Diffstat (limited to 'src/view/com/modals/CreateScene.tsx')
-rw-r--r-- | src/view/com/modals/CreateScene.tsx | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/src/view/com/modals/CreateScene.tsx b/src/view/com/modals/CreateScene.tsx index 4cda1ad1e..9c4cdc5da 100644 --- a/src/view/com/modals/CreateScene.tsx +++ b/src/view/com/modals/CreateScene.tsx @@ -4,7 +4,6 @@ import { ActivityIndicator, StyleSheet, Text, - TextInput, TouchableOpacity, View, } from 'react-native' @@ -13,7 +12,13 @@ import {BottomSheetScrollView, BottomSheetTextInput} from '@gorhom/bottom-sheet' import {ErrorMessage} from '../util/ErrorMessage' import {useStores} from '../../../state' import {s, colors, gradients} from '../../lib/styles' -import {makeValidHandle, createFullHandle} from '../../lib/strings' +import { + makeValidHandle, + createFullHandle, + enforceLen, + MAX_DISPLAY_NAME, + MAX_DESCRIPTION, +} from '../../lib/strings' import {AppBskyActorCreateScene} from '../../../third-party/api/index' export const snapPoints = ['60%'] @@ -102,6 +107,7 @@ export function Component({}: {}) { <BottomSheetTextInput style={styles.textInput} placeholder="e.g. alices-friends" + autoCorrect={false} value={handle} onChangeText={str => setHandle(makeValidHandle(str))} /> @@ -112,7 +118,9 @@ export function Component({}: {}) { style={styles.textInput} placeholder="e.g. Alice's Friends" value={displayName} - onChangeText={setDisplayName} + onChangeText={v => + setDisplayName(enforceLen(v, MAX_DISPLAY_NAME)) + } /> </View> <View style={styles.group}> @@ -122,7 +130,7 @@ export function Component({}: {}) { placeholder="e.g. Artists, dog-lovers, and memelords." multiline value={description} - onChangeText={setDescription} + onChangeText={v => setDescription(enforceLen(v, MAX_DESCRIPTION))} /> </View> {error !== '' && ( |