@fto-consult/expo-ui 8.82.4 → 8.82.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fto-consult/expo-ui",
3
- "version": "8.82.4",
3
+ "version": "8.82.6",
4
4
  "description": "Bibliothèque de composants UI Expo,react-native",
5
5
  "react-native-paper-doc": "https://github.com/callstack/react-native-paper/tree/main/docs/docs/guides",
6
6
  "scripts": {
@@ -8,7 +8,7 @@ import BackAction from "./BackAction";
8
8
  import {StyleSheet} from "react-native";
9
9
  import {goBack as navGoBack,useNavigation,useRoute,useScreenOptions } from "$cnavigation";
10
10
  import PropTypes from "prop-types";
11
- import {View,Pressable} from "react-native";
11
+ import {Pressable} from "react-native";
12
12
  import Dimensions from "$cdimensions";
13
13
  import Content from "./Content";
14
14
  import Icon from "$ecomponents/Icon";
@@ -11,7 +11,7 @@ import {
11
11
  import { Portal } from 'react-native-paper';
12
12
  import PropTypes from "prop-types";
13
13
  import View from "$ecomponents/View";
14
- import {defaultStr,defaultObj} from "$cutils";
14
+ import {defaultStr,defaultObj,extendObj} from "$cutils";
15
15
  import theme,{Colors} from "$theme";
16
16
  import {isMobileMedia} from "$cplatform/dimensions";
17
17
  import Preloader from "$epreloader";
@@ -20,6 +20,7 @@ import {HStack} from "$ecomponents/Stack";
20
20
  import Divider from "$ecomponents/Divider";
21
21
  import Label from "$ecomponents/Label";
22
22
  import Icon from "$ecomponents/Icon";
23
+ import AppBar from '$ecomponents/AppBar';
23
24
 
24
25
  const MIN_SWIPE_DISTANCE = 3;
25
26
  const DEVICE_WIDTH = Math.max(Dimensions.get('window').width,280);
@@ -127,30 +128,20 @@ export default class DrawerLayout extends React.PureComponent {
127
128
  return defaultStr(this.state.portalProps.testID,"RN_DrawerLayoutPortal");
128
129
  }
129
130
  renderPortalTitle(){
130
- if(React.isValidElement(this.state.portalProps?.title)) return this.state.portalProps?.title;
131
+ const testID = this.getPortalTestID();
131
132
  const title = this.state.portalProps?.title;
132
133
  const isPositionRight = this.isPositionRight();
133
- if(typeof title == 'string' && title || typeof title =="number"){
134
- const titleProps = defaultObj(this.state.portalProps.titleProps);
135
- const testID = this.getPortalTestID();
136
- const icon = <Icon
137
- onPress = {this.closeDrawer.bind(this)}
138
- icon = {this.state.portalProps?.closeIcon || !this.isPositionRight() == 'left'? 'chevron-left' : 'chevron-right'}
139
- {...defaultObj(this.state.portalProps.closeIconProps)}
140
- />;
141
- const titleContainerProps = defaultObj(this.state.portalProps?.titleContainerProps);
142
- return <>
143
- <HStack testID={testID+"_TitleContainer"} {...titleContainerProps} style={[styles.portalTitle,titleContainerProps.style]}>
144
- {isPositionRight? icon : null}
145
- <Label testID={testID+"_DrawerLayoutTitle"} {...titleProps} style={[styles.portalTitleText,titleProps.style]} >
146
- {title}
147
- </Label>
148
- {!isPositionRight ? icon : null}
149
- </HStack>
150
- <Divider/>
151
- </>;
152
- }
153
- return null;
134
+ const appBarProps = defaultObj(this.state.portalProps?.appBarProps);
135
+ return <AppBar
136
+ title={React.isValidElement(title) ? title : title || null}
137
+ testID={testID+"_TitleContainer"}
138
+ onBackActionPress={(...args) =>{
139
+ this.closeDrawer();
140
+ return false;
141
+ }}
142
+ {...appBarProps}
143
+ backActionProps = {extendObj(true,{},appBarProps.backActionProps,{icon:this.state.portalProps?.closeIcon || !isPositionRight == 'left'? 'chevron-left' : 'chevron-right'})}
144
+ />
154
145
  }
155
146
  renderPortalChildren(){
156
147
  return <>
@@ -572,8 +563,8 @@ DrawerLayout.propTypes = {
572
563
  drawerPosition : posPropType,
573
564
  position : posPropType,
574
565
  drawerWidth : PropTypes.number,
575
- titleContainerProps : PropTypes.shape({
576
- ...defaultObj(HStack.propTypes),
566
+ appBarProps : PropTypes.shape({
567
+ ...defaultObj(AppBar.propTypes),
577
568
  }),
578
569
  }),
579
570
  }