Skip to content

Commit 01c495c

Browse files
committed
fix(example-app): 🐛 fix web focus issues
1 parent a46da3c commit 01c495c

File tree

2 files changed

+39
-6
lines changed

2 files changed

+39
-6
lines changed

example/src/modules/forms/InputScreen.tsx

+20-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import React, { SetStateAction, useCallback, useRef, useState } from "react";
2-
import { Keyboard, TouchableWithoutFeedback } from "react-native";
2+
import { Keyboard, Platform, TouchableWithoutFeedback } from "react-native";
33
import { useSafeAreaInsets } from "react-native-safe-area-context";
44
import {
55
Box,
@@ -42,7 +42,24 @@ export const InputScreen = () => {
4242

4343
return (
4444
<Box style={tailwind.style("flex-1 justify-center bg-white-900")}>
45-
<TouchableWithoutFeedback onPress={() => Keyboard.dismiss()}>
45+
{Platform.OS === "ios" || Platform.OS === "android" ? (
46+
<TouchableWithoutFeedback onPress={() => Keyboard.dismiss()}>
47+
<Box
48+
style={tailwind.style("flex-1 px-2 justify-center items-center")}
49+
>
50+
<Input
51+
size={selectedSize}
52+
placeholder={"Placeholder"}
53+
variant={selectedVariant}
54+
prefix={prefix}
55+
suffix={suffix}
56+
ref={inputRef}
57+
editable={!isDisabled}
58+
invalid={isInvalid}
59+
/>
60+
</Box>
61+
</TouchableWithoutFeedback>
62+
) : (
4663
<Box style={tailwind.style("flex-1 px-2 justify-center items-center")}>
4764
<Input
4865
size={selectedSize}
@@ -55,7 +72,7 @@ export const InputScreen = () => {
5572
invalid={isInvalid}
5673
/>
5774
</Box>
58-
</TouchableWithoutFeedback>
75+
)}
5976
<Box
6077
style={tailwind.style(
6178
`rounded-t-lg shadow-lg bg-gray-100 justify-end px-2 pt-2 pb-[${

example/src/modules/forms/TextAreaScreen.tsx

+19-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import React, { useCallback, useRef, useState } from "react";
2-
import { Keyboard } from "react-native";
2+
import { Keyboard, Platform } from "react-native";
33
import { useSafeAreaInsets } from "react-native-safe-area-context";
44
import {
55
Box,
@@ -40,7 +40,22 @@ export const TextAreaScreen = () => {
4040

4141
return (
4242
<Box style={tailwind.style("flex-1 justify-center bg-white-900")}>
43-
<TouchableWithoutFeedback onPress={() => Keyboard.dismiss()}>
43+
{Platform.OS === "ios" || Platform.OS === "android" ? (
44+
<TouchableWithoutFeedback onPress={Keyboard.dismiss}>
45+
<Box style={tailwind.style("flex-1 px-2 justify-center")}>
46+
<TextArea
47+
placeholder={"Type Something...."}
48+
size={size}
49+
variant={hasvariant}
50+
loading={isLoading}
51+
invalid={isInvalid}
52+
suffix={suffix}
53+
editable={!isDisabled}
54+
ref={textAreaRef}
55+
/>
56+
</Box>
57+
</TouchableWithoutFeedback>
58+
) : (
4459
<Box style={tailwind.style("flex-1 px-2 justify-center")}>
4560
<TextArea
4661
placeholder={"Type Something...."}
@@ -53,7 +68,8 @@ export const TextAreaScreen = () => {
5368
ref={textAreaRef}
5469
/>
5570
</Box>
56-
</TouchableWithoutFeedback>
71+
)}
72+
5773
<Box
5874
style={tailwind.style(
5975
`rounded-t-lg shadow-lg bg-gray-100 justify-end px-2 pt-2 pb-[${

0 commit comments

Comments
 (0)