WhoBuilt

Scaffolding iOS style apps with react-native-ios-kit

May 16, 2018· 14 min· 913 views·Watch on YouTube

Speaker

Adam Trzciński, a front-end engineer at Callstack, demonstrates how to build an iOS-style contacts app with React Native iOS Kit.

Set up the app and theme

Adam introduces React Native iOS Kit, a library for adding iOS-specific components to React Native apps. He installs the kit and React Native Vector Icons, then wraps the app in the kit’s ThemeProvider so child components receive the app theme.

Build the header and search bar

Adam creates a standard view for the top bar, then adds inline buttons for “Groups” and a plus icon. He adds a styled title and a SearchBar, storing its value in `searchText` and updating that state when the user types.

Render grouped contacts

Adam passes the search text to a new list component and supplies six sample contacts with first names, last names, and IDs. He uses GroupList with a render function, an ID-based key extractor, and a grouping method based on the first letter of each last name. The result includes lettered group headers and an alphabet index.

Filter results as users type

Adam connects the search text to the contact data by filtering for matches in either the first or last name. Searching for “John” shows one result, while searching for “A” shows two; cancelling the search restores the full list.

Takeaways

  • Wrap the app root in ThemeProvider to make the library’s theme available to child components.
  • Use the kit’s inline Button option for toolbar actions that should look like text.
  • Group contacts by a derived value, such as the first letter of a last name.
  • Keep search state in the parent and pass it to the list so results can respond to input.
  • Filter across both first and last names to make contact search more useful.

Mentioned in this talk

Search inside this talk

What was claimed 5

Related talks

Scaffolding iOS style apps with react-native-ios-kit, Adam Trzciński · WhoBuilt