mirror of
https://github.com/laurent22/joplin.git
synced 2024-12-24 10:27:10 +02:00
Make sure title height is correct with multi line text
This commit is contained in:
parent
4761606330
commit
229fc4ed2e
@ -90,8 +90,8 @@ android {
|
|||||||
applicationId "net.cozic.joplin"
|
applicationId "net.cozic.joplin"
|
||||||
minSdkVersion 16
|
minSdkVersion 16
|
||||||
targetSdkVersion 22
|
targetSdkVersion 22
|
||||||
versionCode 36
|
versionCode 37
|
||||||
versionName "0.9.23"
|
versionName "0.9.24"
|
||||||
ndk {
|
ndk {
|
||||||
abiFilters "armeabi-v7a", "x86"
|
abiFilters "armeabi-v7a", "x86"
|
||||||
}
|
}
|
||||||
|
@ -48,6 +48,7 @@ const styleObject = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
styleObject.titleContainer = {
|
styleObject.titleContainer = {
|
||||||
|
flex: 0,
|
||||||
flexDirection: 'row',
|
flexDirection: 'row',
|
||||||
paddingLeft: globalStyle.marginLeft,
|
paddingLeft: globalStyle.marginLeft,
|
||||||
paddingRight: globalStyle.marginRight,
|
paddingRight: globalStyle.marginRight,
|
||||||
@ -76,6 +77,7 @@ class NoteScreenComponent extends BaseScreenComponent {
|
|||||||
lastSavedNote: null,
|
lastSavedNote: null,
|
||||||
isLoading: true,
|
isLoading: true,
|
||||||
resources: {},
|
resources: {},
|
||||||
|
titleTextInputHeight: 20,
|
||||||
};
|
};
|
||||||
|
|
||||||
this.saveButtonHasBeenShown_ = false;
|
this.saveButtonHasBeenShown_ = false;
|
||||||
@ -275,6 +277,11 @@ class NoteScreenComponent extends BaseScreenComponent {
|
|||||||
await this.saveOneProperty('todo_completed', checked ? time.unixMs() : 0);
|
await this.saveOneProperty('todo_completed', checked ? time.unixMs() : 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
titleTextInput_contentSizeChange(event) {
|
||||||
|
let height = event.nativeEvent.contentSize.height;
|
||||||
|
this.setState({ titleTextInputHeight: height });
|
||||||
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
if (this.state.isLoading) {
|
if (this.state.isLoading) {
|
||||||
return (
|
return (
|
||||||
@ -344,6 +351,25 @@ class NoteScreenComponent extends BaseScreenComponent {
|
|||||||
|
|
||||||
const titleContainerStyle = isTodo ? styles.titleContainerTodo : styles.titleContainer;
|
const titleContainerStyle = isTodo ? styles.titleContainerTodo : styles.titleContainer;
|
||||||
|
|
||||||
|
const titleTextInputStyle = Object.assign({}, styleObject.titleTextInput);
|
||||||
|
titleTextInputStyle.height = this.state.titleTextInputHeight;
|
||||||
|
|
||||||
|
const titleComp = (
|
||||||
|
<View style={titleContainerStyle}>
|
||||||
|
{ isTodo && <Checkbox checked={!!Number(note.todo_completed)} onChange={(checked) => { this.todoCheckbox_change(checked) }} /> }
|
||||||
|
<TextInput
|
||||||
|
onContentSizeChange={(event) => this.titleTextInput_contentSizeChange(event)}
|
||||||
|
autoFocus={isNew}
|
||||||
|
multiline={true}
|
||||||
|
underlineColorAndroid="#ffffff00"
|
||||||
|
autoCapitalize="sentences"
|
||||||
|
style={titleTextInputStyle}
|
||||||
|
value={note.title}
|
||||||
|
onChangeText={(text) => this.title_changeText(text)}
|
||||||
|
/>
|
||||||
|
</View>
|
||||||
|
);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<View style={this.styles().screen}>
|
<View style={this.styles().screen}>
|
||||||
<ScreenHeader
|
<ScreenHeader
|
||||||
@ -377,9 +403,7 @@ class NoteScreenComponent extends BaseScreenComponent {
|
|||||||
saveButtonDisabled={saveButtonDisabled}
|
saveButtonDisabled={saveButtonDisabled}
|
||||||
onSaveButtonPress={() => this.saveNoteButton_press()}
|
onSaveButtonPress={() => this.saveNoteButton_press()}
|
||||||
/>
|
/>
|
||||||
<View style={titleContainerStyle}>
|
{ titleComp }
|
||||||
{ isTodo && <Checkbox checked={!!Number(note.todo_completed)} onChange={(checked) => { this.todoCheckbox_change(checked) }} /> }<TextInput autoFocus={isNew} underlineColorAndroid="#ffffff00" autoCapitalize="sentences" style={styles.titleTextInput} value={note.title} onChangeText={(text) => this.title_changeText(text)} />
|
|
||||||
</View>
|
|
||||||
{ bodyComponent }
|
{ bodyComponent }
|
||||||
{ actionButtonComp }
|
{ actionButtonComp }
|
||||||
{ this.state.showNoteMetadata && <Text style={{ paddingLeft: globalStyle.marginLeft, paddingRight: globalStyle.marginRight, }}>{this.state.noteMetadata}</Text> }
|
{ this.state.showNoteMetadata && <Text style={{ paddingLeft: globalStyle.marginLeft, paddingRight: globalStyle.marginRight, }}>{this.state.noteMetadata}</Text> }
|
||||||
|
Loading…
Reference in New Issue
Block a user