Skip to content

Commit 10a3964

Browse files
committed
feat(default): library-release
1 parent 393ef20 commit 10a3964

File tree

14 files changed

+19027
-32
lines changed

14 files changed

+19027
-32
lines changed

README.md

Lines changed: 99 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,115 @@
1-
# @appandflow/rn-magic-scroll
2-
3-
Library to help managing keyboard interaction in form
1+
The objective of the library is to ease the discomfort of scrolling by implementing keyboard management for user input. While another solution offered plug-and-play functionality, we opted against it because it lacked the flexibility to address issues when they arise. We believe our approach will empower you to resolve any challenges your app may encounter.
42

53
## Installation
64

75
```sh
8-
npm install @appandflow/rn-magic-scroll
6+
yarn install @appandflow/rn-magic-scroll
7+
```
8+
9+
```sh
10+
npm i @appandflow/rn-magic-scroll
911
```
1012

11-
## Usage
13+
## Basic Usage
1214

13-
```js
14-
import { multiply } from '@appandflow/rn-magic-scroll';
15+
Wrap your form/screen within our ScrollView. Utilizing context requires it to be one level higher for enhanced control over your inputs. Alternatively, you can employ the Higher Order Component (HOC) for this purpose.
1516

16-
// ...
17+
```tsx
18+
import MagicScroll from '@appandflow/rn-magic-scroll';
1719

18-
const result = await multiply(3, 7);
20+
// rest of your imports
21+
22+
const YourScreen = () => {
23+
return (
24+
<MagicScroll.SmartScrollView>
25+
<YourForm />
26+
</MagicScroll.SmartScrollView>
27+
);
28+
};
29+
30+
// Don't forget this portion
31+
export default MagicScroll.withSmartScroll(YourScreen);
1932
```
2033

21-
## Contributing
34+
Then inside your form/component you can use our TextInput.
2235

23-
See the [contributing guide](CONTRIBUTING.md) to learn how to contribute to the repository and the development workflow.
36+
```tsx
37+
import MagicScroll from '@appandflow/rn-magic-scroll';
2438

25-
## License
39+
// rest of your imports
40+
41+
const YourForm = () => {
42+
return (
43+
<View>
44+
<MagicScroll.TextInput
45+
name="email"
46+
renderTop={() => <Text>Email</Text>}
47+
textInputProps={{
48+
style: {
49+
height: 50,
50+
backgroundColor: '#ddd',
51+
borderRadius: 10,
52+
marginTop: 8,
53+
},
54+
}}
55+
/>
56+
<MagicScroll.TextInput
57+
name="password"
58+
// This is where you can design your custom label
59+
renderTop={() => <Text>Password</Text>}
60+
textInputProps={{
61+
secureTextEntry: true,
62+
style: {
63+
height: 50,
64+
backgroundColor: '#ddd',
65+
borderRadius: 10,
66+
marginTop: 8,
67+
},
68+
}}
69+
/>
70+
</View>
71+
);
72+
};
73+
```
2674

27-
MIT
75+
## Advance usage
2876

29-
---
77+
As mentioned in the introduction, the drawback of a plug-and-play library is its limitations when you need to deviate from the standard functionality. That's precisely why our library allows for customization, enabling you to tailor its usage to suit your specific needs and use cases.
3078

31-
Made with [create-react-native-library](https://github.com/callstack/react-native-builder-bob)
79+
## Tips
80+
81+
We encourage you to wrap our TextInput with your custom one.
82+
83+
Here an example
84+
85+
```tsx
86+
import MagicScroll from '@appandflow/rn-magic-scroll';
87+
88+
// rest of your imports
89+
90+
interface Props {
91+
label?: string;
92+
isPassword?: boolean;
93+
name?: string;
94+
description?: string;
95+
}
96+
97+
const YourCustomInput = (props: Props) => {
98+
return (
99+
<MagicScroll.TextInput
100+
name={props.name}
101+
renderTop={() => <Text>{props.label}</Text>}
102+
renderBottom={() => <Text>{props.description}</Text>}
103+
textInputProps={{
104+
secureTextEntry: props.isPassword,
105+
style: {
106+
height: 50,
107+
backgroundColor: '#ddd',
108+
borderRadius: 10,
109+
marginTop: 8,
110+
},
111+
}}
112+
/>
113+
);
114+
};
115+
```

example/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,15 @@
1212
"expo": "~50.0.17",
1313
"expo-status-bar": "~1.11.1",
1414
"react": "18.2.0",
15-
"react-native": "0.73.6",
1615
"react-dom": "18.2.0",
16+
"react-native": "0.73.6",
1717
"react-native-web": "~0.19.6"
1818
},
1919
"devDependencies": {
2020
"@babel/core": "^7.20.0",
21-
"babel-plugin-module-resolver": "^5.0.0",
2221
"@expo/webpack-config": "^18.0.1",
23-
"babel-loader": "^8.1.0"
22+
"babel-loader": "^8.1.0",
23+
"babel-plugin-module-resolver": "^5.0.0"
2424
},
2525
"private": true
2626
}

example/src/App.tsx

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,11 @@
11
import * as React from 'react';
22

33
import { StyleSheet, View, Text } from 'react-native';
4-
import { multiply } from '@appandflow/rn-magic-scroll';
54

65
export default function App() {
7-
const [result, setResult] = React.useState<number | undefined>();
8-
9-
React.useEffect(() => {
10-
multiply(3, 7).then(setResult);
11-
}, []);
12-
136
return (
147
<View style={styles.container}>
15-
<Text>Result: {result}</Text>
8+
<Text>To Be There</Text>
169
</View>
1710
);
1811
}

package.json

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@appandflow/rn-magic-scroll",
3-
"version": "0.1.0",
3+
"version": "0.0.1",
44
"description": "Library to help managing keyboard interaction in form",
55
"main": "lib/commonjs/index",
66
"module": "lib/module/index",
@@ -69,6 +69,7 @@
6969
"react": "18.2.0",
7070
"react-native": "0.73.6",
7171
"react-native-builder-bob": "^0.23.2",
72+
"react-native-reanimated": "^3.11.0",
7273
"release-it": "^15.0.0",
7374
"typescript": "^5.2.2"
7475
},
@@ -77,7 +78,8 @@
7778
},
7879
"peerDependencies": {
7980
"react": "*",
80-
"react-native": "*"
81+
"react-native": "*",
82+
"react-native-reanimated": "^3.0.0"
8183
},
8284
"workspaces": [
8385
"example"
@@ -128,7 +130,8 @@
128130
"trailingComma": "es5",
129131
"useTabs": false
130132
}
131-
]
133+
],
134+
"react-hooks/exhaustive-deps": "off"
132135
}
133136
},
134137
"eslintIgnore": [
@@ -155,5 +158,8 @@
155158
}
156159
]
157160
]
161+
},
162+
"dependencies": {
163+
"jotai": "^2.8.0"
158164
}
159165
}

0 commit comments

Comments
 (0)