@fto-consult/expo-ui 1.5.1 → 1.5.2

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/auth/Login.js +13 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fto-consult/expo-ui",
3
- "version": "1.5.1",
3
+ "version": "1.5.2",
4
4
  "description": "Bibliothèque de composants UI Expo,react-native",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/src/auth/Login.js CHANGED
@@ -170,6 +170,17 @@ export default function LoginComponent(props){
170
170
  setState({...state,step:step+1,data})
171
171
  }
172
172
  }
173
+ const loginFields = {};
174
+ let hasLoginFields = false;
175
+ Object.map(loginProps.fields,(field,i)=>{
176
+ if(isObj(field)){
177
+ if(typeof field.step ==='number' && field.step !== state.step){}
178
+ else {
179
+ loginFields[i] = Object.clone(field);
180
+ loginFields[i].autoFocus = !!loginFields[i].autoFocusOnStep;
181
+ }
182
+ }
183
+ });
173
184
  const withScrollView = typeof customWithScrollView =='boolean'? customWithScrollView : true;
174
185
  const Wrapper = withPortal ? ScreenWithoutAuthContainer : withScrollView ? ScrollView: View;
175
186
  const wrapperProps = withPortal ? {appBarProps,authRequired:false,title:loginTitle,withScrollView} : { style:styles.wrapper};
@@ -192,6 +203,7 @@ export default function LoginComponent(props){
192
203
  </View>}
193
204
  responsive = {false}
194
205
  {...loginProps}
206
+ fields = {loginFields}
195
207
  formProps = {{
196
208
  keyboardEvents : {
197
209
  ...defaultObj(keyboardEvents),
@@ -204,7 +216,7 @@ export default function LoginComponent(props){
204
216
  >
205
217
  <>
206
218
  {React.isValidElement(contentTop)? contentTop : null}
207
- {Object.size(loginProps.fields,true)?<View testID={testID+"_ButtonsContainer"} style={[styles.buttonWrapper]}>
219
+ {hasLoginFields?<View testID={testID+"_ButtonsContainer"} style={[styles.buttonWrapper]}>
208
220
  <Button
209
221
  ref = {nextButtonRef}
210
222
  primary