@@ -3,6 +3,7 @@ import { BlockContext } from '@rocket.chat/ui-kit';
33import { dequal } from 'dequal' ;
44import { AccessibilityInfo , Alert , Keyboard , ScrollView , Text , View } from 'react-native' ;
55import { useForm } from 'react-hook-form' ;
6+ import { type SetValueConfig } from 'react-hook-form' ;
67import * as yup from 'yup' ;
78import { yupResolver } from '@hookform/resolvers/yup' ;
89
@@ -39,6 +40,10 @@ const MESSAGE_TYPE_VALUES = MessageTypeValues.map(m => ({
3940 text : { text : I18n . t ( 'Hide_type_messages' , { type : I18n . t ( m . text ) } ) }
4041} ) ) ;
4142
43+ const dirtyOptions : SetValueConfig = {
44+ shouldDirty : true
45+ } ;
46+
4247const schema = yup . object ( ) . shape ( {
4348 name : yup . string ( ) . required ( I18n . t ( 'Name_required' ) )
4449} ) ;
@@ -283,29 +288,29 @@ const RoomInfoEditView = ({ navigation, route }: IRoomInfoEditViewProps) => {
283288
284289 const toggleRoomType = ( value : boolean ) => {
285290 logEvent ( events . RI_EDIT_TOGGLE_ROOM_TYPE ) ;
286- setValue ( 't' , value ) ;
287- setValue ( 'encrypted' , value && encrypted ) ;
291+ setValue ( 't' , value , dirtyOptions ) ;
292+ setValue ( 'encrypted' , value && encrypted , dirtyOptions ) ;
288293 } ;
289294
290295 const toggleReadOnly = ( value : boolean ) => {
291296 logEvent ( events . RI_EDIT_TOGGLE_READ_ONLY ) ;
292- setValue ( 'readOnly' , value ) ;
297+ setValue ( 'readOnly' , value , dirtyOptions ) ;
293298 } ;
294299
295300 const toggleReactions = ( value : boolean ) => {
296301 logEvent ( events . RI_EDIT_TOGGLE_REACTIONS ) ;
297- setValue ( 'reactWhenReadOnly' , value ) ;
302+ setValue ( 'reactWhenReadOnly' , value , dirtyOptions ) ;
298303 } ;
299304
300305 const toggleHideSystemMessages = ( value : boolean ) => {
301306 logEvent ( events . RI_EDIT_TOGGLE_SYSTEM_MSG ) ;
302- setValue ( 'enableSysMes' , value ) ;
303- setValue ( 'systemMessages' , value ? systemMessages : [ ] ) ;
307+ setValue ( 'enableSysMes' , value , dirtyOptions ) ;
308+ setValue ( 'systemMessages' , value ? systemMessages : [ ] , dirtyOptions ) ;
304309 } ;
305310
306311 const toggleEncrypted = ( value : boolean ) => {
307312 logEvent ( events . RI_EDIT_TOGGLE_ENCRYPTED ) ;
308- setValue ( 'encrypted' , value ) ;
313+ setValue ( 'encrypted' , value , dirtyOptions ) ;
309314 } ;
310315
311316 const onResetPress = ( ) => {
0 commit comments