Skip to content

feat: example with KeyboardAwareScrollView that covers entire screen #751

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

Merged
merged 4 commits into from
Jan 3, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
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
23 changes: 23 additions & 0 deletions FabricExample/src/screens/Examples/AwareScrollView/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,23 @@ import type { StackScreenProps } from "@react-navigation/stack";
type Props = StackScreenProps<ExamplesStackParamList>;
const snapToOffsets = [125, 225, 325, 425, 525, 625];

const BIG_TEXT = `Where does it come from?
Contrary to popular belief, Lorem Ipsum is not simply random text. It has roots in a piece of classical Latin literature from 45 BC, making it over 2000 years old. Richard, a Latin professor at Hampden-Sydney College in Virginia, looked up one of the more obscure Latin words, consectetur, from a Lorem Ipsum passage, and going through the cites of the word in classical literature, discovered the certain source. Lorem Ipsum comes from sections 1.10.32 and 1.10.33 of The Extremes of Good and Evil by Cicero, written in 45 BC. This book is a treatise on the theory of ethics, very popular during the Renaissance. The first line of Lorem Ipsum, "Lorem ipsum dolor sit..", comes from a line in section 1.10.32.

s
s
s

Where does it come from?
Contrary to popular belief, Lorem Ipsum is not simply random text. It has roots in a piece of classical Latin literature from 45 BC, making it over 2000 years old. Richard, a Latin professor at Hampden-Sydney College in Virginia, looked up one of the more obscure Latin words, consectetur, from a Lorem Ipsum passage, and going through the cites of the word in classical literature, discovered the certain source. Lorem Ipsum comes from sections 1.10.32 and 1.10.33 of The Extremes of Good and Evil by Cicero, written in 45 BC. This book is a treatise on the theory of ethics, very popular during the Renaissance. The first line of Lorem Ipsum, "Lorem ipsum dolor sit..", comes from a line in section 1.10.32.

s
s
s

Where does it come from?
Contrary to popular belief, Lorem Ipsum is not simply random text. It has roots in a piece of classical Latin literature from 45 BC, making it over 2000 years old. Richard, a Latin professor at Hampden-Sydney College in Virginia, looked up one of the more obscure Latin words, consectetur, from a Lorem Ipsum passage, and going through the cites of the word in classical literature, discovered the certain source. Lorem Ipsum comes from sections 1.10.32 and 1.10.33 of The Extremes of Good and Evil by Cicero, written in 45 BC. This book is a treatise on the theory of ethics, very popular during the Renaissance. The first line of Lorem Ipsum, "Lorem ipsum dolor sit..", comes from a line in section 1.10.32.`;

export default function AwareScrollView({ navigation }: Props) {
const bottomSheetModalRef = useRef<BottomSheet>(null);
const [_, setText] = useState("");
Expand Down Expand Up @@ -81,6 +98,12 @@ export default function AwareScrollView({ navigation }: Props) {
onChangeText={setText}
/>
))}
<TextInput
defaultValue={BIG_TEXT}
placeholder="TextInput#10"
style={styles.input}
onChangeText={setText}
/>
</KeyboardAwareScrollView>
<BottomSheet ref={bottomSheetModalRef} index={-1} snapPoints={["40%"]}>
<Button
Expand Down
7 changes: 7 additions & 0 deletions FabricExample/src/screens/Examples/AwareScrollView/styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,11 @@ export const styles = StyleSheet.create({
flex: 1,
backgroundColor: "black",
},
input: {
width: "100%",
borderWidth: 2,
borderColor: "black",
borderRadius: 8,
paddingHorizontal: 12,
},
});
23 changes: 23 additions & 0 deletions example/src/screens/Examples/AwareScrollView/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,23 @@ import type { StackScreenProps } from "@react-navigation/stack";
type Props = StackScreenProps<ExamplesStackParamList>;
const snapToOffsets = [125, 225, 325, 425, 525, 625];

const BIG_TEXT = `Where does it come from?
Contrary to popular belief, Lorem Ipsum is not simply random text. It has roots in a piece of classical Latin literature from 45 BC, making it over 2000 years old. Richard, a Latin professor at Hampden-Sydney College in Virginia, looked up one of the more obscure Latin words, consectetur, from a Lorem Ipsum passage, and going through the cites of the word in classical literature, discovered the certain source. Lorem Ipsum comes from sections 1.10.32 and 1.10.33 of The Extremes of Good and Evil by Cicero, written in 45 BC. This book is a treatise on the theory of ethics, very popular during the Renaissance. The first line of Lorem Ipsum, "Lorem ipsum dolor sit..", comes from a line in section 1.10.32.

s
s
s

Where does it come from?
Contrary to popular belief, Lorem Ipsum is not simply random text. It has roots in a piece of classical Latin literature from 45 BC, making it over 2000 years old. Richard, a Latin professor at Hampden-Sydney College in Virginia, looked up one of the more obscure Latin words, consectetur, from a Lorem Ipsum passage, and going through the cites of the word in classical literature, discovered the certain source. Lorem Ipsum comes from sections 1.10.32 and 1.10.33 of The Extremes of Good and Evil by Cicero, written in 45 BC. This book is a treatise on the theory of ethics, very popular during the Renaissance. The first line of Lorem Ipsum, "Lorem ipsum dolor sit..", comes from a line in section 1.10.32.

s
s
s

Where does it come from?
Contrary to popular belief, Lorem Ipsum is not simply random text. It has roots in a piece of classical Latin literature from 45 BC, making it over 2000 years old. Richard, a Latin professor at Hampden-Sydney College in Virginia, looked up one of the more obscure Latin words, consectetur, from a Lorem Ipsum passage, and going through the cites of the word in classical literature, discovered the certain source. Lorem Ipsum comes from sections 1.10.32 and 1.10.33 of The Extremes of Good and Evil by Cicero, written in 45 BC. This book is a treatise on the theory of ethics, very popular during the Renaissance. The first line of Lorem Ipsum, "Lorem ipsum dolor sit..", comes from a line in section 1.10.32.`;

export default function AwareScrollView({ navigation }: Props) {
const bottomSheetModalRef = useRef<BottomSheet>(null);
const [_, setText] = useState("");
Expand Down Expand Up @@ -81,6 +98,12 @@ export default function AwareScrollView({ navigation }: Props) {
onChangeText={setText}
/>
))}
<TextInput
defaultValue={BIG_TEXT}
placeholder="TextInput#10"
style={styles.input}
onChangeText={setText}
/>
</KeyboardAwareScrollView>
<BottomSheet ref={bottomSheetModalRef} index={-1} snapPoints={["40%"]}>
<Button
Expand Down
7 changes: 7 additions & 0 deletions example/src/screens/Examples/AwareScrollView/styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,11 @@ export const styles = StyleSheet.create({
flex: 1,
backgroundColor: "black",
},
input: {
width: "100%",
borderWidth: 2,
borderColor: "black",
borderRadius: 8,
paddingHorizontal: 12,
},
});
Loading