Skip to content

Commit d400282

Browse files
committed
fix: Fixed bottom sheet not closing when going to play item
1 parent 0b8dde5 commit d400282

File tree

10 files changed

+56
-45
lines changed

10 files changed

+56
-45
lines changed

app/mobile/components/ItemOptions/ItemOptions.js

+11-3
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,9 @@ export const ItemOptions = ({
3030
animatable,
3131
onClose,
3232
onTorrentPress,
33-
canOpenBottomSheet
33+
canOpenBottomSheet,
3434
}) => {
35-
const [openBottomSheet, updateBottomSheet] = useBottomSheet()
35+
const [openBottomSheet, updateBottomSheet, closeBottomSheet] = useBottomSheet()
3636

3737
const getBottomSheetConfig = () => {
3838
// When allTorrents changes update the content heights
@@ -94,6 +94,14 @@ export const ItemOptions = ({
9494

9595
}, [visible])
9696

97+
const handleTorrentPress = !onTorrentPress
98+
? undefined
99+
: React.useCallback((torrent, download) => {
100+
closeBottomSheet()
101+
102+
onTorrentPress(torrent, download)
103+
}, [])
104+
97105
const renderBottomSheetContent = React.useCallback(() => {
98106
return (
99107
<View>
@@ -108,7 +116,7 @@ export const ItemOptions = ({
108116
item={item}
109117
variant={variant}
110118
torrents={allTorrents}
111-
onPress={onTorrentPress} />
119+
onPress={handleTorrentPress} />
112120

113121
{variant === constants.TYPE_DOWNLOAD && (
114122
<>

app/mobile/screens/Home/ShowsSlider/ShowsSlider.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ export const ShowsSlider = ({ handleGoTo, onPress }) => {
2222
<CardSlider
2323
onPress={onPress}
2424
title={i18n.t('Shows')}
25-
items={!data || !data.shows ? [] : data.shows.filter(show => !show.bookmarked)}
25+
items={!data || !data.shows ? [] : data.shows.filter((show) => !show.bookmarked)}
2626
goToMore={handleGoTo('Shows')}
2727
loading={loading}
2828
onEndReached={fetchMoreUpdateQuery('shows', data, fetchMore)}

app/modules/BottomSheetManager/BottomSheetProvider.js

+7-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import React from 'react'
2-
import PropTypes from 'prop-types'
32
import { StyleSheet, View } from 'react-native'
43
import BottomSheet from 'reanimated-bottom-sheet'
54
import ReAnimated from 'react-native-reanimated'
@@ -56,7 +55,7 @@ export const BottomSheetProvider = ({ children }) => {
5655

5756
useBackButton(() => {
5857
if (visible && sheetRef.current) {
59-
sheetRef.current.snapTo(bottomSheetConfig.snapPoints.length - 1)
58+
closeBottomSheet()
6059

6160
return true
6261
}
@@ -88,8 +87,12 @@ export const BottomSheetProvider = ({ children }) => {
8887
}
8988
}
9089

90+
const closeBottomSheet = () => {
91+
sheetRef.current.snapTo(bottomSheetConfig.snapPoints.length - 1)
92+
}
93+
9194
return (
92-
<BottomSheetContext.Provider value={[openBottomSheet, updateBottomSheet]}>
95+
<BottomSheetContext.Provider value={[openBottomSheet, updateBottomSheet, closeBottomSheet]}>
9396

9497
{children}
9598

@@ -124,7 +127,7 @@ export const BottomSheetProvider = ({ children }) => {
124127
style={{
125128
height: bottomSheetConfig.biggestSnapPoint,
126129
}}>
127-
{bottomSheetConfig.renderContent()}
130+
{visible && bottomSheetConfig.renderContent()}
128131
</Container>
129132
)}
130133
/>

app/modules/GraphQL/Apollo.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { CachePersistor } from 'apollo-cache-persist'
55
import { WebSocketLink } from '@apollo/client/link/ws'
66
import { getMainDefinition } from '@apollo/client/utilities'
77

8-
const SCHEMA_VERSION = '7' // Must be a string.
8+
const SCHEMA_VERSION = '9' // Must be a string.
99
const SCHEMA_VERSION_KEY = 'apollo-schema-version'
1010

1111
export default async(host) => {
@@ -44,8 +44,8 @@ export default async(host) => {
4444
const definition = getMainDefinition(query)
4545

4646
return (
47-
definition.kind === 'OperationDefinition' &&
48-
definition.operation === 'subscription'
47+
definition.kind === 'OperationDefinition'
48+
&& definition.operation === 'subscription'
4949
)
5050
},
5151
new WebSocketLink({

app/modules/GraphQL/ShowsGraphQL.js

-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ export const MostWatchedShowsQuery = gql`
2222
${showMinimalFragment}
2323
`
2424

25-
2625
export default gql`
2726
query shows($offset: Float!, $query: String) {
2827
shows(limit: 25, offset: $offset, query: $query) {

app/modules/GraphQL/fragments/movieFragment.js

+1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ export const movieMinimalFragment = gql`
2121
_id
2222
title
2323
type
24+
bookmarked
2425
watched {
2526
complete
2627
progress

app/modules/GraphQL/helpers/fetchMoreUpdateQuery.js

+1-2
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ let fetchingMore = false
1111
export default (type, data, fetchMore) => () => {
1212
// Make sure we are only fetching more once
1313
if (fetchingMore || !data) {
14-
return
14+
return null
1515
}
1616

1717
fetchingMore = true
@@ -33,4 +33,3 @@ export default (type, data, fetchMore) => () => {
3333
},
3434
})
3535
}
36-

index.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ enableScreens()
66

77
LogBox.ignoreLogs([
88
'Debugger and device times',
9-
'Cache data may be lost when replacing'
9+
'Cache data may be lost when replacing',
10+
'The updateQuery callback for fetchMore is deprecated'
1011
])
1112

1213
import App from './app/index'

package.json

+4-4
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,12 @@
2727
},
2828
"dependencies": {
2929
"@apollo/client": "^3.2.2",
30-
"@react-native-community/async-storage": "1.12.0",
30+
"@react-native-community/async-storage": "1.12.1",
3131
"@react-native-community/masked-view": "^0.1.10",
3232
"@react-native-community/netinfo": "5.9.7",
3333
"@react-native-community/slider": "3.0.3",
34-
"@react-navigation/native": "5.7.5",
35-
"@react-navigation/stack": "5.9.2",
34+
"@react-navigation/native": "5.7.6",
35+
"@react-navigation/stack": "5.9.3",
3636
"apollo-cache-persist": "^0.1.1",
3737
"graphql": "15.3.0",
3838
"graphql-tag": "2.11.0",
@@ -44,7 +44,7 @@
4444
"react": "16.13.1",
4545
"react-native": "0.63.3",
4646
"react-native-animatable": "1.3.3",
47-
"react-native-device-info": "6.0.4",
47+
"react-native-device-info": "6.2.0",
4848
"react-native-fs": "2.16.6",
4949
"react-native-gesture-handler": "1.8.0",
5050
"react-native-google-cast": "github:pct-org/react-native-google-cast#7e409ca7c129d628d5c2902944790bc611b64aaa",

yarn.lock

+26-26
Original file line numberDiff line numberDiff line change
@@ -1413,10 +1413,10 @@
14131413
"@nodelib/fs.scandir" "2.1.3"
14141414
fastq "^1.6.0"
14151415

1416-
"@react-native-community/[email protected].0":
1417-
version "1.12.0"
1418-
resolved "https://registry.yarnpkg.com/@react-native-community/async-storage/-/async-storage-1.12.0.tgz#d2fc65bc08aa1c3e9514bbe9fe7095eab8e8aca3"
1419-
integrity sha512-y3zVxuVyiOxI8TXrvajmYfDbIt2vFNxzV5MiA28v15DQTxDk6uJH3rpc9my+la7u2Tiwt3PpdU2+59ZgZ4h7wA==
1416+
"@react-native-community/[email protected].1":
1417+
version "1.12.1"
1418+
resolved "https://registry.yarnpkg.com/@react-native-community/async-storage/-/async-storage-1.12.1.tgz#25f821b4f6b13abe005ad67e47c6f1cee9f27b24"
1419+
integrity sha512-70WGaH3PKYASi4BThuEEKMkyAgE9k7VytBqmgPRx3MzJx9/MkspwqJGmn3QLCgHLIFUgF1pit2mWICbRJ3T3lg==
14201420
dependencies:
14211421
deep-assign "^3.0.0"
14221422

@@ -1554,24 +1554,24 @@
15541554
resolved "https://registry.yarnpkg.com/@react-native-community/slider/-/slider-3.0.3.tgz#830167fd757ba70ac638747ba3169b2dbae60330"
15551555
integrity sha512-8IeHfDwJ9/CTUwFs6x90VlobV3BfuPgNLjTgC6dRZovfCWigaZwVNIFFJnHBakK3pW2xErAPwhdvNR4JeNoYbw==
15561556

1557-
"@react-navigation/core@^5.12.4":
1558-
version "5.12.4"
1559-
resolved "https://registry.yarnpkg.com/@react-navigation/core/-/core-5.12.4.tgz#1bd0c81d098895c8ffe49f8624fae60c9abc5684"
1560-
integrity sha512-vhaVIJGfSgln4dIoO4R2HeX9p3Vc7OJLa0/JpKHpXn/DZgNVn+RP7ktk1CRZ16ikUJ0k8CxzuvRxeRIg7EhA7w==
1557+
"@react-navigation/core@^5.12.5":
1558+
version "5.12.5"
1559+
resolved "https://registry.yarnpkg.com/@react-navigation/core/-/core-5.12.5.tgz#434a34893368de1c9daca9508fdd7be94d1ec642"
1560+
integrity sha512-+QdQDtC75K1sBfACwCUNFlrCOYf36GYGr9YURHugm3LDEHUwAj7HPJA8FFLw1Rmp5N/P5q9Uct2B/XxJhYzKqA==
15611561
dependencies:
15621562
"@react-navigation/routers" "^5.4.12"
15631563
escape-string-regexp "^4.0.0"
15641564
nanoid "^3.1.12"
1565-
query-string "^6.13.1"
1565+
query-string "^6.13.5"
15661566
react-is "^16.13.0"
15671567
use-subscription "^1.4.0"
15681568

1569-
"@react-navigation/[email protected].5":
1570-
version "5.7.5"
1571-
resolved "https://registry.yarnpkg.com/@react-navigation/native/-/native-5.7.5.tgz#478579435549a1c5c9901c9c6b3c1f75fa7dbf0c"
1572-
integrity sha512-HZpfxXF740XsA0HkeohGETo/zOmlMFb65XElQOk9+dPoN+36y2olZC/f7HuqpucsU925zg7jrnyUnW6tCtc3IA==
1569+
"@react-navigation/[email protected].6":
1570+
version "5.7.6"
1571+
resolved "https://registry.yarnpkg.com/@react-navigation/native/-/native-5.7.6.tgz#47546c512488d0e9c343219af635e1a44881761d"
1572+
integrity sha512-u+o9Ifs4//Ah6UczXiaAV+hiWPL0NyTbErj5WayeQUd6K5IIbA1UwumRVWs2Xp8q/4Q9h6FpPHUcKOyiTxhaqA==
15731573
dependencies:
1574-
"@react-navigation/core" "^5.12.4"
1574+
"@react-navigation/core" "^5.12.5"
15751575
nanoid "^3.1.12"
15761576

15771577
"@react-navigation/routers@^5.4.12":
@@ -1581,10 +1581,10 @@
15811581
dependencies:
15821582
nanoid "^3.1.12"
15831583

1584-
"@react-navigation/[email protected].2":
1585-
version "5.9.2"
1586-
resolved "https://registry.yarnpkg.com/@react-navigation/stack/-/stack-5.9.2.tgz#68841c9ef032177d15664b14cff62e16698f89c7"
1587-
integrity sha512-imEvTuCNsIo3ZriN6eIreGaxypuuB9ZOqdUXfxJznzMCkb7lN4OR/YVztAJW3QQzhuD4vwly+7jDvt7SxyfSuw==
1584+
"@react-navigation/[email protected].3":
1585+
version "5.9.3"
1586+
resolved "https://registry.yarnpkg.com/@react-navigation/stack/-/stack-5.9.3.tgz#c12cbd7cc8436e3995aa291d7617c5b8f7a950ea"
1587+
integrity sha512-/CJ5Rsrc9bMI20dD8oC/QSZHARMFuUv8DeoiYE7R2N0M44cFupF1CrzaZBBC/S4Zi1ahZ0A+Hj/gAzAEQrNTvA==
15881588
dependencies:
15891589
color "^3.1.2"
15901590
react-native-iphone-x-helper "^1.2.1"
@@ -7476,10 +7476,10 @@ qs@~6.5.2:
74767476
resolved "https://registry.yarnpkg.com/qs/-/qs-6.5.2.tgz#cb3ae806e8740444584ef154ce8ee98d403f3e36"
74777477
integrity sha512-N5ZAX4/LxJmF+7wN74pUD6qAh9/wnvdQcjq9TZjevvXzSUo7bfmw91saqMjzGS2xq91/odN2dW/WOl7qQHNDGA==
74787478

7479-
query-string@^6.13.1:
7480-
version "6.13.1"
7481-
resolved "https://registry.yarnpkg.com/query-string/-/query-string-6.13.1.tgz#d913ccfce3b4b3a713989fe6d39466d92e71ccad"
7482-
integrity sha512-RfoButmcK+yCta1+FuU8REvisx1oEzhMKwhLUNcepQTPGcNMp1sIqjnfCtfnvGSQZQEhaBHvccujtWoUV3TTbA==
7479+
query-string@^6.13.5:
7480+
version "6.13.5"
7481+
resolved "https://registry.yarnpkg.com/query-string/-/query-string-6.13.5.tgz#99e95e2fb7021db90a6f373f990c0c814b3812d8"
7482+
integrity sha512-svk3xg9qHR39P3JlHuD7g3nRnyay5mHbrPctEBDUxUkHRifPHXJDhBUycdCC0NBjXoDf44Gb+IsOZL1Uwn8M/Q==
74837483
dependencies:
74847484
decode-uri-component "^0.2.0"
74857485
split-on-first "^1.0.0"
@@ -7545,10 +7545,10 @@ [email protected]:
75457545
dependencies:
75467546
prop-types "^15.7.2"
75477547

7548-
react-native-device-info@6.0.4:
7549-
version "6.0.4"
7550-
resolved "https://registry.yarnpkg.com/react-native-device-info/-/react-native-device-info-6.0.4.tgz#88ef9f19715186d0b016b37e738d08b990fcf9e3"
7551-
integrity sha512-nLwQ2yPmR0Z/msVP7vD0dZe1qzBMpzYpyY5q4/t31pPHT08bu0D5MYVr0K+MnPZMISu1UOUZpVARvfVMLZBMJg==
7548+
react-native-device-info@6.2.0:
7549+
version "6.2.0"
7550+
resolved "https://registry.yarnpkg.com/react-native-device-info/-/react-native-device-info-6.2.0.tgz#6eda29dee048b73b29b57b7ec0c21545bd89dada"
7551+
integrity sha512-UtAk/ZAdCVCepEmRNM/3Kx7dWbLwmEPh527HTjoQUQy1utpoXm3y4sYtCrP2tjczSIyeMs5nLP4Wf3c8bc0fwQ==
75527552

75537553
react-native-fit-image@^1.5.2:
75547554
version "1.5.5"

0 commit comments

Comments
 (0)