Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RN Challenge - Muhammad Rayhan Ravianda #35

Open
wants to merge 10 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix keyboardAvoidingView
  • Loading branch information
ravmhmmd committed Jan 27, 2023
commit 25cad3c1dcd65d5ef175a6842094348359047bd0
2 changes: 1 addition & 1 deletion components/todo-item/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ const TodoItem = ({ todo, onSubmit }: TodoItemProps) => {
<View
style={{
flexDirection: 'row',
alignItems: 'center',
alignItems: 'flex-start',
marginVertical: 4,
}}
>
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"react-native-events": "^1.0.21",
"react-native-gesture-handler": "~1.8.0",
"react-native-safe-area-context": "3.1.9",
"react-native-screens": "~2.15.0",
"react-native-screens": "3.11.1",
"react-native-web": "~0.13.12"
},
"devDependencies": {
Expand Down
10 changes: 8 additions & 2 deletions screens/TabOneScreen.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { useHeaderHeight } from '@react-navigation/stack';
import React, { useState } from 'react';
import { StyleSheet, FlatList, TextInput, KeyboardAvoidingView, Platform } from 'react-native';
import { Text, View } from '../components/Themed';
Expand All @@ -7,6 +8,8 @@ let id = '5'

export default function TabOneScreen() {

const height = useHeaderHeight()

const [titleList, setTitleList] = useState('');

const [todos, setTodos] = useState([
Expand Down Expand Up @@ -42,7 +45,9 @@ export default function TabOneScreen() {
return (
<KeyboardAvoidingView
style={styles.container}
behavior={Platform.OS === 'ios' ? 'height' : 'height'}
behavior={Platform.OS === 'ios' ? 'padding' : 'height'}
keyboardVerticalOffset={height+47}
enabled
>
<TextInput
style={styles.title}
Expand All @@ -52,6 +57,7 @@ export default function TabOneScreen() {
/>

<FlatList
removeClippedSubviews={false}
data={todos}
renderItem={({ item, index }) => (
<TodoItem
Expand All @@ -78,4 +84,4 @@ const styles = StyleSheet.create({
fontWeight: 'bold',
marginVertical: 8,
},
});
});7