@@ -35,7 +35,10 @@ export const SlideInView = ({
3535
3636 const animatedStyle = useAnimatedStyle (
3737 ( ) => ( {
38- height : withSpring ( visible ? animatedHeight . value : 0 , { damping : 10 } ) ,
38+ height : withSpring ( visible ? animatedHeight . value : 0 , {
39+ damping : 20 ,
40+ overshootClamping : true ,
41+ } ) ,
3942 opacity : withTiming ( visible ? 1 : 0 , { duration : 500 } ) ,
4043 } ) ,
4144 [ visible ] ,
@@ -55,6 +58,7 @@ export const SlideInView = ({
5558const isAndroid = Platform . OS === 'android' ;
5659
5760type NotificationConfigItem = { label : string ; name : string ; id : string } ;
61+ type MessageListImplementationConfigItem = { label : string ; id : string } ;
5862
5963const SecretMenuNotificationConfigItem = ( {
6064 notificationConfigItem,
@@ -120,6 +124,23 @@ const SecretMenuNotificationConfigItem = ({
120124 ) ;
121125} ;
122126
127+ const SecretMenuMessageListConfigItem = ( {
128+ messageListImplementationConfigItem,
129+ storeMessageListImplementation,
130+ isSelected,
131+ } : {
132+ messageListImplementationConfigItem : MessageListImplementationConfigItem ;
133+ storeMessageListImplementation : ( item : MessageListImplementationConfigItem ) => void ;
134+ isSelected : boolean ;
135+ } ) => (
136+ < TouchableOpacity
137+ style = { [ styles . notificationItemContainer , { borderColor : isSelected ? 'green' : 'gray' } ] }
138+ onPress = { ( ) => storeMessageListImplementation ( messageListImplementationConfigItem ) }
139+ >
140+ < Text style = { styles . notificationItem } > { messageListImplementationConfigItem . label } </ Text >
141+ </ TouchableOpacity >
142+ ) ;
143+
123144export const SecretMenu = ( {
124145 close,
125146 visible,
@@ -130,6 +151,9 @@ export const SecretMenu = ({
130151 chatClient : StreamChat ;
131152} ) => {
132153 const [ selectedProvider , setSelectedProvider ] = useState < string | null > ( null ) ;
154+ const [ selectedMessageListImplementation , setSelectedMessageListImplementation ] = useState <
155+ string | null
156+ > ( null ) ;
133157 const {
134158 theme : {
135159 colors : { black, grey } ,
@@ -144,22 +168,43 @@ export const SecretMenu = ({
144168 [ ] ,
145169 ) ;
146170
171+ const messageListImplementationConfigItems = useMemo (
172+ ( ) => [
173+ { label : 'FlashList' , id : 'flashlist' } ,
174+ { label : 'FlatList' , id : 'flatlist' } ,
175+ ] ,
176+ [ ] ,
177+ ) ;
178+
147179 useEffect ( ( ) => {
148- const getSelectedProvider = async ( ) => {
149- const provider = await AsyncStore . getItem (
180+ const getSelectedConfig = async ( ) => {
181+ const notificationProvider = await AsyncStore . getItem (
150182 '@stream-rn-sampleapp-push-provider' ,
151183 notificationConfigItems [ 0 ] ,
152184 ) ;
153- setSelectedProvider ( provider ?. id ?? 'firebase' ) ;
185+ const messageListImplementation = await AsyncStore . getItem (
186+ '@stream-rn-sampleapp-messagelist-implementation' ,
187+ messageListImplementationConfigItems [ 0 ] ,
188+ ) ;
189+ setSelectedProvider ( notificationProvider ?. id ?? 'firebase' ) ;
190+ setSelectedMessageListImplementation ( messageListImplementation ?. id ?? 'flashlist' ) ;
154191 } ;
155- getSelectedProvider ( ) ;
156- } , [ notificationConfigItems ] ) ;
192+ getSelectedConfig ( ) ;
193+ } , [ notificationConfigItems , messageListImplementationConfigItems ] ) ;
157194
158195 const storeProvider = useCallback ( async ( item : NotificationConfigItem ) => {
159196 await AsyncStore . setItem ( '@stream-rn-sampleapp-push-provider' , item ) ;
160197 setSelectedProvider ( item . id ) ;
161198 } , [ ] ) ;
162199
200+ const storeMessageListImplementation = useCallback (
201+ async ( item : MessageListImplementationConfigItem ) => {
202+ await AsyncStore . setItem ( '@stream-rn-sampleapp-messagelist-implementation' , item ) ;
203+ setSelectedMessageListImplementation ( item . id ) ;
204+ } ,
205+ [ ] ,
206+ ) ;
207+
163208 const removeAllDevices = useCallback ( async ( ) => {
164209 const { devices } = await chatClient . getDevices ( chatClient . userID ) ;
165210 for ( const device of devices ?? [ ] ) {
@@ -169,12 +214,7 @@ export const SecretMenu = ({
169214
170215 return (
171216 < SlideInView visible = { visible } >
172- < View
173- style = { [
174- menuDrawerStyles . menuItem ,
175- { alignItems : 'flex-start' } ,
176- ] }
177- >
217+ < View style = { [ menuDrawerStyles . menuItem , { alignItems : 'flex-start' } ] } >
178218 < Notification height = { 24 } pathFill = { grey } width = { 24 } />
179219 < View >
180220 < Text
@@ -200,6 +240,22 @@ export const SecretMenu = ({
200240 </ View >
201241 </ View >
202242 </ View >
243+ < View style = { [ menuDrawerStyles . menuItem , { alignItems : 'flex-start' } ] } >
244+ < Notification height = { 24 } pathFill = { grey } width = { 24 } />
245+ < View >
246+ < Text style = { [ menuDrawerStyles . menuTitle ] } > Message List implementation</ Text >
247+ < View style = { { marginLeft : 16 } } >
248+ { messageListImplementationConfigItems . map ( ( item ) => (
249+ < SecretMenuMessageListConfigItem
250+ key = { item . id }
251+ messageListImplementationConfigItem = { item }
252+ storeMessageListImplementation = { storeMessageListImplementation }
253+ isSelected = { item . id === selectedMessageListImplementation }
254+ />
255+ ) ) }
256+ </ View >
257+ </ View >
258+ </ View >
203259 < TouchableOpacity onPress = { removeAllDevices } style = { menuDrawerStyles . menuItem } >
204260 < Delete height = { 24 } size = { 24 } pathFill = { grey } width = { 24 } />
205261 < Text
0 commit comments