Skip to content

Commit ee59eea

Browse files
feat(core): implement advanced keyboard management and fix monorepo b… (#1)
This commit introduces several new props to FieldForm (autoScroll, chainEnabled, autoReturnKeyType, dismissKeyboardOnTap, etc.) and resolves bundling issues in the monorepo showcase app by hoisting runtime polyfills to the project root.
1 parent 96cbc7e commit ee59eea

13 files changed

Lines changed: 158 additions & 28 deletions

File tree

bun.lock

Lines changed: 64 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

example/.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
2+
# @generated expo-cli sync-2b81b286409207a5da26e14c78851eb30d8ccbdb
3+
# The following patterns were generated by expo-cli
4+
5+
expo-env.d.ts
6+
# @end expo-cli

example/app/(tabs)/advanced.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,10 @@ import { useSafeAreaInsets } from 'react-native-safe-area-context';
1717
import {
1818
FieldForm,
1919
FieldInput,
20-
type FieldFormHandle,
20+
dismissKeyboard,
2121
useKeyboardState,
22-
} from 'react-native-fieldflow';
22+
type FieldFormHandle,
23+
} from '../../../packages/react-native-fieldflow/src';
2324
import {
2425
ActionButton,
2526
FeatureCard,

example/app/(tabs)/hooks.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import {
2121
useKeyboardHeight,
2222
useKeyboardState,
2323
useKeyboardVisible,
24-
} from 'react-native-fieldflow';
24+
} from '../../../packages/react-native-fieldflow/src';
2525
import {
2626
ActionButton,
2727
FeatureCard,

example/app/(tabs)/index.tsx

Lines changed: 26 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,23 +5,17 @@
55
* quick demo form, API list, and navigation to detail screens.
66
*/
77
import Ionicons from '@expo/vector-icons/Ionicons';
8+
import { useRouter } from 'expo-router';
89
import React, { useCallback, useRef, useState } from 'react';
910
import {
1011
Alert,
1112
Platform,
1213
StyleSheet,
13-
Switch,
1414
Text,
15-
View,
15+
View
1616
} from 'react-native';
1717
import { useSafeAreaInsets } from 'react-native-safe-area-context';
18-
import { useRouter } from 'expo-router';
1918

20-
import {
21-
FieldForm,
22-
useKeyboardState,
23-
type FieldFormHandle,
24-
} from 'react-native-fieldflow';
2519
import {
2620
ActionButton,
2721
FeatureCard,
@@ -34,6 +28,11 @@ import {
3428
ShowcaseRadius,
3529
ShowcaseSpacing,
3630
} from '@/constants/showcase-theme';
31+
import {
32+
FieldForm,
33+
useKeyboardState,
34+
type FieldFormHandle,
35+
} from '../../../packages/react-native-fieldflow/src';
3736

3837
export default function HomeScreen() {
3938
const router = useRouter();
@@ -48,7 +47,9 @@ export default function HomeScreen() {
4847
// ── Feature toggles ────────────────────────────────
4948
const [scrollEnabled, setScrollEnabled] = useState(true);
5049
const [avoidEnabled, setAvoidEnabled] = useState(true);
50+
const [autoScroll, setAutoScroll] = useState(true);
5151
const [chainEnabled, setChainEnabled] = useState(true);
52+
const [dismissOnTap, setDismissOnTap] = useState(true);
5253

5354
const handleSubmit = useCallback(() => {
5455
setSubmitted(true);
@@ -63,6 +64,9 @@ export default function HomeScreen() {
6364
onSubmit={handleSubmit}
6465
scrollable={scrollEnabled}
6566
avoidKeyboard={avoidEnabled}
67+
autoScroll={autoScroll}
68+
chainEnabled={chainEnabled}
69+
dismissKeyboardOnTap={dismissOnTap}
6670
extraScrollPadding={100}
6771
keyboardVerticalOffset={0}
6872
scrollViewProps={{
@@ -117,6 +121,20 @@ export default function HomeScreen() {
117121
toggleValue={chainEnabled}
118122
onToggle={setChainEnabled}
119123
/>
124+
<FeatureCard
125+
icon="color-filter-outline"
126+
title="Auto Scroll"
127+
description="Scroll to focused field"
128+
toggleValue={autoScroll}
129+
onToggle={setAutoScroll}
130+
/>
131+
<FeatureCard
132+
icon="hand-right-outline"
133+
title="Tap to Dismiss"
134+
description="Tap empty area to close"
135+
toggleValue={dismissOnTap}
136+
onToggle={setDismissOnTap}
137+
/>
120138
</View>
121139
</View>
122140

example/app/(tabs)/login.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import {
2020
FieldForm,
2121
type FieldFormHandle,
2222
useKeyboardState,
23-
} from 'react-native-fieldflow';
23+
} from '../../../packages/react-native-fieldflow/src';
2424
import {
2525
ActionButton,
2626
FeatureCard,

example/components/showcase/StyledInput.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import Ionicons from '@expo/vector-icons/Ionicons';
55
import React, { forwardRef, useState } from 'react';
66
import { StyleSheet, Text, TextInput, View, type TextInputProps } from 'react-native';
77

8-
import { FieldInput, type FieldInputProps } from 'react-native-fieldflow';
8+
import { FieldInput, type FieldInputProps } from '../../../packages/react-native-fieldflow/src';
99
import {
1010
ShowcaseColors as C,
1111
ShowcaseRadius,

example/metro.config.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ config.resolver.nodeModulesPaths = [
1717
path.resolve(workspaceRoot, 'node_modules'),
1818
];
1919

20-
// 3. Force Metro to resolve the same version of dependencies from the workspace root
21-
config.resolver.disableHierarchicalLookup = true;
20+
// 3. Let Metro resolve hierarchically (important for bun node_modules cache)
21+
config.resolver.disableHierarchicalLookup = false;
2222

2323
module.exports = config;

example/package.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@
1111
"lint": "expo lint"
1212
},
1313
"dependencies": {
14+
"@babel/runtime": "^7.24.0",
15+
"@expo/metro-runtime": "~6.1.2",
16+
"expo-modules-core": "~2.2.0",
17+
"invariant": "^2.2.4",
1418
"react-native-fieldflow": "workspace:*",
1519
"@expo/vector-icons": "^15.0.3",
1620
"@react-navigation/bottom-tabs": "^7.4.0",

package.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@
1616
"release": "cd packages/react-native-fieldflow && npm publish"
1717
},
1818
"devDependencies": {
19-
"turbo": "latest"
19+
"turbo": "latest",
20+
"whatwg-fetch": "^3.6.20",
21+
"anser": "^1.4.9",
22+
"stacktrace-parser": "^0.1.10",
23+
"pretty-format": "^29.7.0"
2024
}
2125
}

0 commit comments

Comments
 (0)