Skip to content

Commit f7aade0

Browse files
authored
Merge pull request #1 from lodev09/refactor/android
Refactor: Android improvements
2 parents 05e89e2 + 4a8c373 commit f7aade0

File tree

10 files changed

+374
-354
lines changed

10 files changed

+374
-354
lines changed

README.md

Lines changed: 23 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ npm i @lodev09/react-native-true-sheet
3131

3232
## Usage
3333

34-
```ts
34+
```tsx
3535
import { TrueSheet } from "@lodev09/react-native-true-sheet"
3636

3737
// ...
@@ -78,7 +78,7 @@ Extends `ViewProps`
7878

7979
## Methods
8080

81-
```ts
81+
```tsx
8282
const sheet = useRef<TrueSheet>(null)
8383

8484
const resize = () => {
@@ -108,7 +108,7 @@ return (
108108

109109
## Events
110110

111-
```ts
111+
```tsx
112112
const handleSizeChange = (info: SizeInfo) => {
113113
console.log(info)
114114
}
@@ -130,7 +130,7 @@ return (
130130

131131
### `SheetSize`
132132

133-
```ts
133+
```tsx
134134
<TrueSheet sizes={['auto', '80%', 'large']}>
135135
// ...
136136
</TrueSheet>
@@ -166,7 +166,7 @@ Grabber props to be used for android grabber or handle.
166166

167167
Blur tint that is mapped into native values in iOS.
168168

169-
```ts
169+
```tsx
170170
<TrueSheet blurTint="dark">
171171
// ...
172172
</TrueSheet>
@@ -200,7 +200,7 @@ Blur tint that is mapped into native values in iOS.
200200

201201
`Object` that comes with some events.
202202

203-
```ts
203+
```tsx
204204
{
205205
index: 1,
206206
value: 69
@@ -216,25 +216,37 @@ Blur tint that is mapped into native values in iOS.
216216

217217
When using `jest`, simply mock the entire package.
218218

219-
```ts
219+
```tsx
220220
jest.mock('@lodev09/react-native-true-sheet')
221221
```
222222

223223
## Troubleshooting
224224

225+
### Handling `ScrollView` on **Android**
226+
227+
On Android, `nestedScrollEnabled` needs to be enabled so that scrolling works when the sheet is expanded to its `maxHeight`.
228+
229+
```tsx
230+
<TrueSheet ref={sheet}>
231+
<ScrollView nestedScrollEnabled>
232+
// ...
233+
</ScrollView>
234+
</TrueSheet>
235+
```
236+
225237
### Using `react-native-gesture-handler` on **Android**
226238

227239
On Android, RNGH does not work by default because modals are not located under React Native Root view in native hierarchy. To fix that, components need to be wrapped with `GestureHandlerRootView`.
228240

229241
Example:
230-
```ts
242+
```tsx
231243
import { GestureHandlerRootView } from 'react-native-gesture-handler'
232244
```
233-
```ts
245+
```tsx
234246
return (
235247
<TrueSheet ref={sheet}>
236248
<GestureHandlerRootView>
237-
<MyComponent />
249+
// ...
238250
</GestureHandlerRootView>
239251
</TrueSheet>
240252
)
@@ -245,7 +257,7 @@ return (
245257
On iOS, navigating to a [React Navigation](https://reactnavigation.org) screen from within the Sheet can cause issues. To resolve this, dismiss the sheet before navigating!
246258

247259
Example:
248-
```ts
260+
```tsx
249261
const sheet = useRef<TrueSheet>(null)
250262

251263
const navigate = async () => {

android/src/main/java/com/lodev09/truesheet/TrueSheetBehavior.kt

Lines changed: 0 additions & 230 deletions
This file was deleted.

0 commit comments

Comments
 (0)