muba-posting 4.2.3 → 4.2.4

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 (3) hide show
  1. package/Posting.js +10 -9
  2. package/Publish4.js +15 -11
  3. package/package.json +16 -16
package/Posting.js CHANGED
@@ -66,7 +66,6 @@ export default class Posting extends React.Component {
66
66
  countryPhone: '',
67
67
  businessId: this.props.businessId,
68
68
  picturesUploaded: 0,
69
- images: [],
70
69
  params: null,
71
70
  postingAd: {
72
71
  transaction: null,
@@ -433,8 +432,11 @@ export default class Posting extends React.Component {
433
432
 
434
433
  imageBrowserCallback = async (photos) => {
435
434
  this.setState({
436
- showImageBrowser: false,
437
- images: photos
435
+ showImageBrowser: false
436
+ }, () => {
437
+ for (let photo of photos) {
438
+ this.publish4?.loadUri(photo)
439
+ }
438
440
  });
439
441
  }
440
442
 
@@ -448,9 +450,8 @@ export default class Posting extends React.Component {
448
450
 
449
451
  _savePicture = async (picture) => {
450
452
  this.setState({
451
- showImageBrowser: false,
452
- images: [picture]
453
- });
453
+ showImageBrowser: false
454
+ }, () => this.publish4?.loadUri(picture));
454
455
  }
455
456
 
456
457
  render() {
@@ -558,6 +559,7 @@ export default class Posting extends React.Component {
558
559
 
559
560
  {this.state.view === Views.PUBLISH_4 ?
560
561
  <Publish4 postingAd={this.state.postingAd}
562
+ ref={publish4 => this.publish4 = publish4}
561
563
  saveEditAd={() => this._saveEditAd()}
562
564
  goToPage={(view) => this._goToPage(view)}
563
565
  request={this.props.request}
@@ -568,8 +570,7 @@ export default class Posting extends React.Component {
568
570
  progressBarHeight={this.state.progressBarHeight}
569
571
  headerHeight={this.state.headerHeight}
570
572
  openPictureSelector={() => this._openPictureSelector()}
571
- maxPictures={this.state.maxPictures}
572
- images={this.state.images} />
573
+ maxPictures={this.state.maxPictures} />
573
574
  :
574
575
  null
575
576
  }
@@ -648,7 +649,7 @@ export default class Posting extends React.Component {
648
649
  }
649
650
 
650
651
  </CustomScrollView>
651
- <PopupAdvice icon={<FontAwesomeIcon name='block' />} title={strings('setup.noPromoteTitle', { product: '' })} headerColor={commonStyles.red} ref={(popupAdvice) => { this.popupNoListings = popupAdvice; }}
652
+ <PopupAdvice icon={<FontAwesomeIcon name='block' />} title={strings('setup.noPromoteTitle', { product: '' })} headerColor={commonStyles.red} ref={popupAdvice => this.popupNoListings = popupAdvice}
652
653
  onClose={async () => this.state.view !== Views.PREVIEW ? this.goBack() : null} hideButton={true}>
653
654
  <OutputText style={commonStyles.popupText}>{strings('setup.noPromoteSubtitle', { countryPhone: this.state.countryPhone })}</OutputText>
654
655
  <TouchableOpacity style={[commonStyles.okBtnBoxPopup, commonStyles.okBtnPopup]} onPress={() => this.popupNoListings.hide()} >
package/Publish4.js CHANGED
@@ -25,7 +25,7 @@ export default class Publish4 extends React.Component {
25
25
  }
26
26
 
27
27
  componentDidMount() {
28
- for (let photo of this.props.images) {
28
+ for (let photo of this.props.postingAd.images) {
29
29
  this.loadImage(photo);
30
30
  }
31
31
 
@@ -37,9 +37,9 @@ export default class Publish4 extends React.Component {
37
37
  }
38
38
 
39
39
  componentDidUpdate = async (prevProps) => {
40
- if (!this.isSameList(prevProps.images, this.props.images)) {
40
+ if (!this.isSameList(prevProps.postingAd.images, this.props.postingAd.images)) {
41
41
  this.setState({ images: [] }, () => {
42
- for (let photo of this.props.images) {
42
+ for (let photo of this.props.postingAd.images) {
43
43
  this.loadImage(photo);
44
44
  }
45
45
  });
@@ -58,7 +58,7 @@ export default class Publish4 extends React.Component {
58
58
  return true;
59
59
  }
60
60
 
61
- async loadImage(imgUri) {
61
+ async loadUri(imgUri) {
62
62
  if (imgUri) {
63
63
  let fileType = imgUri.substring(imgUri.lastIndexOf('.') + 1).toLowerCase();
64
64
 
@@ -72,20 +72,24 @@ export default class Publish4 extends React.Component {
72
72
  extraInfo: this.state.images.length
73
73
  }
74
74
 
75
- let imagesArray = this.state.images;
76
- imagesArray.push(image);
75
+ this.loadImage(image);
76
+ }
77
+ }
77
78
 
78
- await this.setState({
79
- showErrorNoSelectedImages: false,
80
- images: imagesArray
81
- });
79
+ loadImage(image) {
80
+ let imagesArray = this.state.images;
81
+ imagesArray.push(image);
82
82
 
83
+ this.setState({
84
+ showErrorNoSelectedImages: false,
85
+ images: imagesArray
86
+ }, () => {
83
87
  if (this.state.images.length == this.props.maxPictures) {
84
88
  this.setState({ allPhotosSelected: true });
85
89
  } else if (this.state.images.length == 1) {
86
90
  this.selectMainPhoto(this.state.images[0]);
87
91
  }
88
- }
92
+ });
89
93
  }
90
94
 
91
95
  async deleteImage(itemId, index) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "muba-posting",
3
- "version": "4.2.3",
3
+ "version": "4.2.4",
4
4
  "description": "Posting",
5
5
  "main": "Posting.js",
6
6
  "scripts": {
@@ -18,20 +18,20 @@
18
18
  "homepage": "https://github.com/Mubawab/muba-posting#readme",
19
19
  "dependencies": {
20
20
  "@react-native-async-storage/async-storage": "~1.17.3",
21
- "muba-custom-scroll-view": "4",
22
- "muba-display-price": "4",
23
- "muba-font": "4",
24
- "muba-i18n": "4",
25
- "muba-input-select": "4",
26
- "muba-input-text": "4",
27
- "muba-loading-cursor": "4",
28
- "muba-map": "4",
29
- "muba-output-text": "4",
30
- "muba-phone-group": "4",
31
- "muba-picture": "4",
32
- "muba-payment-online": "4",
33
- "muba-popup-advice": "4",
34
- "muba-popup-permissions": "4",
35
- "muba-radio-button-group": "4"
21
+ "muba-custom-scroll-view": "5",
22
+ "muba-display-price": "5",
23
+ "muba-font": "5",
24
+ "muba-i18n": "5",
25
+ "muba-input-select": "5",
26
+ "muba-input-text": "5",
27
+ "muba-loading-cursor": "5",
28
+ "muba-map": "5",
29
+ "muba-output-text": "5",
30
+ "muba-phone-group": "5",
31
+ "muba-picture": "5",
32
+ "muba-payment-online": "5",
33
+ "muba-popup-advice": "5",
34
+ "muba-popup-permissions": "5",
35
+ "muba-radio-button-group": "5"
36
36
  }
37
37
  }