In react native, I want the FoodData class to accept an array of enum Tags instead of an…
- User
In react native, I want the FoodData class to accept an array of enum Tags instead of an array of strings. Each enum needs to have a readableName and an iconName
export default class FoodData { location: string; details: string; coords: string; date: number; tags: Array;
codeconstructor(location: string, details: string, coords: string, date: number, tags: Array<string>) { this.location = location; this.details = details; this.coords = coords; this.date = date; this.tags = tags; }}
enum Tags { OffCampus("Off-Campus", "car"), NeedEntry("Entry Needed", "sliding-door-lock"), NeedPhone("Need Phone", "phone"); }
- Assistant
To adapt your class to use an array of enums instead of an array of strings, you'll need to follow these steps: