File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -48,6 +48,14 @@ function Screen2() {
4848 ) ;
4949}
5050
51+ function Screen3 ( ) {
52+ return (
53+ < ScrollScreen contentContainerStyle = { styles . scrollContainer } >
54+ < Text style = { styles . screenTitle } > Screen without sortable flex</ Text >
55+ </ ScrollScreen >
56+ ) ;
57+ }
58+
5159const tabBarOptions : BottomTabNavigationOptions = {
5260 tabBarIcon : ( { focused } ) => (
5361 < FontAwesomeIcon
@@ -63,13 +71,21 @@ const tabBarOptions: BottomTabNavigationOptions = {
6371function Tabs ( ) {
6472 return (
6573 < Tab . Navigator
74+ // This option breaks sortable state when navigating between screens
75+ // https://github.com/MatiPl01/react-native-sortables/issues/308
76+ detachInactiveScreens = { false }
6677 screenOptions = { {
6778 tabBarStyle : {
6879 shadowColor : 'transparent'
6980 }
7081 } } >
7182 < Tab . Screen component = { Screen1 } name = 'Screen1' options = { tabBarOptions } />
7283 < Tab . Screen component = { Screen2 } name = 'Screen2' options = { tabBarOptions } />
84+ < Tab . Screen
85+ component = { Screen3 }
86+ name = 'No sortable'
87+ options = { tabBarOptions }
88+ />
7389 </ Tab . Navigator >
7490 ) ;
7591}
Original file line number Diff line number Diff line change @@ -30,6 +30,7 @@ function Grid({ data }: GridProps) {
3030
3131 return (
3232 < Sortable . Grid
33+ dragActivationDelay = { 0 }
3334 columnGap = { 10 }
3435 columns = { 3 }
3536 data = { data }
@@ -57,27 +58,52 @@ function Screen2() {
5758 ) ;
5859}
5960
61+ function Screen3 ( ) {
62+ return (
63+ < ScrollScreen contentContainerStyle = { styles . scrollContainer } >
64+ < Text style = { styles . screenTitle } > Screen without sortable grid</ Text >
65+ </ ScrollScreen >
66+ ) ;
67+ }
68+
6069const tabBarOptions : BottomTabNavigationOptions = {
6170 tabBarIcon : ( { focused } ) => (
6271 < FontAwesomeIcon
6372 color = { focused ? colors . primary : colors . foreground3 }
6473 icon = { faCircle }
6574 />
6675 ) ,
67- tabBarLabel : ( { focused } ) => (
68- < Text style = { focused ? styles . focusedLabel : styles . label } > Screen 1 </ Text >
76+ tabBarLabel : ( { focused, children } ) => (
77+ < Text style = { focused ? styles . focusedLabel : styles . label } > { children } </ Text >
6978 )
7079} ;
80+
7181function Tabs ( ) {
7282 return (
7383 < Tab . Navigator
84+ // This option breaks sortable state when navigating between screens
85+ // https://github.com/MatiPl01/react-native-sortables/issues/308
86+ detachInactiveScreens = { false }
7487 screenOptions = { {
7588 tabBarStyle : {
7689 shadowColor : 'transparent'
7790 }
7891 } } >
79- < Tab . Screen component = { Screen1 } name = 'Screen1' options = { tabBarOptions } />
80- < Tab . Screen component = { Screen2 } name = 'Screen2' options = { tabBarOptions } />
92+ < Tab . Screen
93+ component = { Screen1 }
94+ name = 'Sortable 1'
95+ options = { tabBarOptions }
96+ />
97+ < Tab . Screen
98+ component = { Screen2 }
99+ name = 'Sortable 2'
100+ options = { tabBarOptions }
101+ />
102+ < Tab . Screen
103+ component = { Screen3 }
104+ name = 'No sortable'
105+ options = { tabBarOptions }
106+ />
81107 </ Tab . Navigator >
82108 ) ;
83109}
You can’t perform that action at this time.
0 commit comments