ordering-ui-react-native 0.17.12-release → 0.17.13-release

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": "ordering-ui-react-native",
3
- "version": "0.17.12-release",
3
+ "version": "0.17.13-release",
4
4
  "description": "Reusable components made in react native",
5
5
  "main": "src/index.tsx",
6
6
  "author": "ordering.inc",
@@ -84,7 +84,8 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
84
84
  const appState = useRef(AppState.currentState)
85
85
  const isChewLayout = theme?.header?.components?.layout?.type?.toLowerCase() === 'chew'
86
86
  const [refreshing] = useState(false);
87
- const hideCities = (theme?.business_listing_view?.components?.cities?.hidden || orderState?.options?.type !== 2) ?? true
87
+ const allCitiesDisabled = citiesState?.cities?.every((city: any) => !city.enabled)
88
+ const hideCities = (theme?.business_listing_view?.components?.cities?.hidden || orderState?.options?.type !== 2 || allCitiesDisabled) ?? true
88
89
  const hideHero = theme?.business_listing_view?.components?.business_hero?.hidden
89
90
  const hidePreviousOrders = theme?.business_listing_view?.components?.previous_orders_block?.hidden
90
91
  const hideHighestBusiness = theme?.business_listing_view?.components?.highest_rated_business_block?.hidden
@@ -293,6 +294,12 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
293
294
  setIsOpenCities(false)
294
295
  }, [orderState?.options?.city_id])
295
296
 
297
+ useEffect(() => {
298
+ if (!citiesState?.cities?.length || !orderState?.options?.city_id) return
299
+ const selectedCity = citiesState?.cities?.find((city: any) => city?.id === orderState?.options?.city_id)
300
+ if (!selectedCity || !selectedCity?.enabled) changeCityFilter(null)
301
+ }, [citiesState, orderState?.options?.city_id])
302
+
296
303
  if (logosLayout) {
297
304
  return (
298
305
  <BusinessLogosContainer
@@ -47,7 +47,7 @@ export const CitiesControl = (props: any) => {
47
47
  return (
48
48
  <Container height={height - top - bottom - 60 - (isKeyboardShow ? 250 : 0)}>
49
49
  <View>
50
- {cities?.map((city: any) => (
50
+ {cities?.map((city: any) => city?.enabled && (
51
51
  <CityElement
52
52
  key={city?.id}
53
53
  activeOpacity={1}