<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Nathan Hayflick on Medium]]></title>
        <description><![CDATA[Stories by Nathan Hayflick on Medium]]></description>
        <link>https://medium.com/@Nayflix?source=rss-2de6d20d9874------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*HP4heQn2lZKe06lJ.jpeg</url>
            <title>Stories by Nathan Hayflick on Medium</title>
            <link>https://medium.com/@Nayflix?source=rss-2de6d20d9874------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 29 Nov 2026 23:42:48 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@Nayflix/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Building React Native Music (Part 2): SoundCloud API, Search and NavigatorIOS]]></title>
            <link>https://medium.com/@Nayflix/building-a-soundcloud-app-with-react-native-part-2-5ee7f810123b?source=rss-2de6d20d9874------2</link>
            <guid isPermaLink="false">https://medium.com/p/5ee7f810123b</guid>
            <category><![CDATA[react-native]]></category>
            <category><![CDATA[reactjs]]></category>
            <category><![CDATA[ios]]></category>
            <dc:creator><![CDATA[Nathan Hayflick]]></dc:creator>
            <pubDate>Fri, 22 May 2015 04:27:18 GMT</pubDate>
            <atom:updated>2015-05-22T15:42:35.023Z</atom:updated>
            <content:encoded><![CDATA[<p>(Part 1 available <a href="https://medium.com/@Nayflix/building-a-soundcloud-app-with-react-native-1144b6d3773a">here</a>.)</p><h4>Live Data</h4><p>First go to developers.soundcloud.com and register your app to obtain an API ID for your requests. Declare your unique ID as a global constant:</p><pre>var SOUNDCLOUD_CLIENT_ID = ‘XXXXXX’;</pre><p>We add a method to our BrowseTracksView component to return a request url to query SoundCloud’s uploaded tracks with the client id appended and then modify our fetch method to perform an async XHR request.</p><pre>// List View For Browsing Songs<br>var BrowseTracksView = React.createClass({<br>  getInitialState: function () {<br>    return {<br>      dataSource: new ListView.DataSource({<br>        rowHasChanged: (row1, row2) =&gt; row1 !== row2,<br>      })<br>    };<br>  },<br>  componentDidMount: function() {<br>    this.fetchData();<br>  },<br>  fetchData: function () {<br>    // Return live data<br>    fetch(this.fetchEndpoint)<br>      .then((response) =&gt; response.json())<br>      .then((responseData) =&gt; {<br>        this.setState({<br>          dataSource: this.state.dataSource.cloneWithRows(responseData)<br>        })<br>        .catch((error) =&gt; {<br>          console.warn(error);<br>        });<br>      })<br>      .done();<br>  },<br>  fetchEndpoint: &#39;<a href="http://api.soundcloud.com/tracks.json?client_id=%27">http://api.soundcloud.com/tracks.json?client_id=&#39;</a> + SOUNDCLOUD_CLIENT_ID,<br>  render: function () {<br>    return (<br>      &lt;ListView <br>        dataSource={this.state.dataSource}<br>        renderRow={this.renderTrack}<br>        style={styles.listView}/&gt;<br>    );<br>  },<br>  renderTrack: function (track) {<br>    return (<br>      &lt;TrackCell track={track}/&gt;<br>    );<br>  }<br>});</pre><p>The Fetch method can be chained with processing, success and error callbacks. Here we call React’s setState method to signal the UI is ready for updating with our newly-fetched data.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/364/1*-6np5mDifrIQWzAaTQCWng.png" /><figcaption>Your ListView should now be populated with live data from SoundCloud!</figcaption></figure><h4>Adding Search</h4><p>Live data is nice and all, but as <em>discerning</em> music listeners we don’t want to listen to just any old tracks — we want to find some next-level beats! To make that possible let’s extend our app to include a new feature: Search.</p><p>In addition to rendering rows, the ListView API can take functions to render headers, section headers and footers. We are going to create a list header cell consisting of a search bar that will query SoundCloud for tracks matching out input. Modify BrowseTrackViews render function by adding a renderHeader attribute and then create a new method called renderSearchBar.</p><pre>  render: function () {<br>    return (<br>      &lt;ListView <br>        dataSource={this.state.dataSource}<br>        renderRow={this.renderTrack}<br>        renderHeader={this.renderSearchBar}<br>        style={styles.listView}/&gt;<br>    );<br>  },<br>  renderSearchBar: function () {<br>    return (<br>      &lt;View style={styles.searchCell}&gt;<br>        &lt;TextInput onChange={this.onSearchChange} placeholder={&#39;Search Here&#39;} style={styles.searchContainer}/&gt;<br>      &lt;/View&gt;<br>    )<br>  },</pre><p>We use the TextInput component here (don’t forget to add TextInput to your React imports) and give it an onChance callback. Use the onChange event to capture the input text and then pass it to BrowseTrackView’s newly modified fetchData method. We’ve also added a timeout to the search so the API doesn’t get hammered unnecessarily while the user is typing — this requires adding a mixin to our component.</p><p>At the top of the file import the react-timer-mixin module.</p><pre>var TimerMixin = require(‘react-timer-mixin’);</pre><p>Then we add it to BrowseTracksView before further modifying the component:</p><pre>// List View For Browsing Songs<br>var BrowseTracksView = React.createClass({<br>  mixins: [TimerMixin],<br>  timeoutID: (null: any),<br>  getInitialState: function () {<br>    return {<br>      dataSource: new ListView.DataSource({<br>        rowHasChanged: (row1, row2) =&gt; row1 !== row2<br>      })<br>    };<br>  },<br>  componentDidMount: function() {<br>    this.fetchData();<br>  },<br>  fetchData: function (query) {<br>    var queryString = &#39;&#39;;<br>    if (query) {<br>      queryString = &#39;&amp;q=&#39; + query<br>    }<br>    // Return live data<br>    fetch(this.fetchEndpoint + queryString)<br>      .then((response) =&gt; response.json())<br>      .then((responseData) =&gt; {<br>        this.setState({<br>          dataSource: this.state.dataSource.cloneWithRows(responseData)<br>        });<br>      }).catch((error) =&gt; {<br>        console.warn(error);<br>      })<br>      .done();<br>  },<br>  fetchEndpoint: &#39;<a href="http://api.soundcloud.com/tracks.json?client_id=%27">http://api.soundcloud.com/tracks.json?client_id=&#39;</a> + SOUNDCLOUD_CLIENT_ID,<br>  onSearchChange: function (event) {<br>    var q = event.nativeEvent.text.toLowerCase();<br>    this.clearTimeout(this.timeoutID);<br>    this.timeoutID = this.setTimeout(() =&gt; this.fetchData(q), 100);<br>  },<br>  render: function () {<br>    return (<br>      &lt;ListView <br>        dataSource={this.state.dataSource}<br>        renderRow={this.renderTrack}<br>        renderHeader={this.renderSearchBar}<br>        style={styles.listView}/&gt;<br>    );<br>  },<br>  renderSearchBar: function () {<br>    return (<br>      &lt;View style={styles.searchCell}&gt;<br>        &lt;TextInput onChange={this.onSearchChange} placeholder={&#39;Search Here&#39;} style={styles.searchContainer}/&gt;<br>      &lt;/View&gt;<br>    )<br>  },<br>  renderTrack: function (track) {<br>    return (<br>      &lt;TrackCell track={track}/&gt;<br>    );<br>  }<br>});</pre><p>Finally we add some styling attributes to give the searchContainer some layout info (if the height isn’t explicitly set here it will just collapse to zero.)</p><pre>searchCell: {<br>  flex: 1,<br>  flexDirection: &#39;row&#39;<br>},<br>searchContainer: {<br>  height: 40,<br>  width: 100,<br>  flex: 1,<br>  margin: 4,<br>  padding: 4,<br>  borderColor: &#39;gray&#39;,<br>  color: &#39;black&#39;,<br>  borderWidth: 1<br> },</pre><p>Try it out in the simulator by typing something awesome and checking out the results.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/368/1*lEElBW1Cx5hsF-pwVoC7Og.png" /><figcaption>Much better… we can now search for music.</figcaption></figure><h4>Navigation</h4><p>Sooner or later most apps need a UI for navigating between discrete screens —in iOS this is commonly handled via a navigation stack. An app starts on a single root view and when a user taps on an item to look at it’s details, a new screen is pushed on top of the view stack. The navigation header provides a consistent back button in the upper-left corner of the screen that pops the current view off the stack revealing the view below.</p><p>React Native allows access to the NavigationController via the NavigatorIOS component. After importing the component, we replace our BrowseTracksView with the NavigatorIOS component and then specify BrowseTracksView as the root component for our navigation. This will allow for seamless navigation between our list of track search results and individual detail views of tracks. Notice that we are keeping the Now Playing footer outside of the Navigator since it is a global UI element that should persist regardless of what screen we are currently viewing.</p><pre>var ReactNativeMusic = React.createClass({<br>  getInitialState: function () {<br>    return {<br>      nowPlaying: null<br>    }<br>  },<br>  render: function() {<br>    return (<br>      &lt;View style={styles.appContainer}&gt;<br>        &lt;NavigatorIOS style={styles.navContainer}<br>          barTintColor=&#39;#F5FCFF&#39; <br>          initialRoute={{<br>            title: &#39;React Native Music&#39;,<br>            component: BrowseTracksView<br>          }} /&gt;<br>        &lt;NowPlayingFooterView nowPlaying={this.props.nowPlaying}/&gt;<br>      &lt;/View&gt;<br>    );<br>  }<br>});</pre><p>Sure enough our tracks list is now wrapped by a navigation header. To turn our track cells into touchable navigation links, we wrap the TrackCell component with a TouchableHighlight and specify a press handler. A new component we are about to build, TrackScreen, is pushed onto the stack and passed the targeted track object as a property.</p><pre>var TrackCell = React.createClass({<br>  render: function () {<br>    return (<br>      &lt;TouchableOpacity onPress={() =&gt; this.selectTrack(this.props.track)} style={styles.rightContainer}&gt;<br>        &lt;View style={styles.trackCell}&gt;<br>          &lt;Image<br>            source={{uri: this.props.track.artwork_url}}<br>            style={styles.thumbnail} /&gt;<br>          &lt;View style={styles.rightContainer}&gt;<br>            &lt;Text style={styles.trackTitle}&gt;{this.props.track.title}&lt;/Text&gt;<br>            &lt;Text style={styles.trackArtist}&gt;{this.props.track.user.username}&lt;/Text&gt;<br>          &lt;/View&gt;<br>        &lt;/View&gt;<br>      &lt;/TouchableOpacity&gt;<br>    );<br>  },<br>  selectTrack: function (track) {<br>    this.props.navigator.push({<br>      title: track.title,<br>      component: TrackScreen,<br>      passProps: {track}<br>    });<br>  }<br>});</pre><p>We also need to pass BrowseTrackView’s navigator property to the cell by including it in a property on the renderTrack method.</p><pre>...,<br>  renderTrack: function (track) {<br>    return (<br>      &lt;TrackCell navigator={this.props.navigator} track={track}/&gt;<br>    );<br>  },<br>...</pre><p>Now let’s set up a basic details view within the TrackScreen component.</p><pre>var TrackScreen = React.createClass({<br>  render: function () {<br>    var largeImageUrl = this.props.track.artwork_url ? this.props.track.artwork_url.replace(&#39;-large&#39;, &#39;-t300x300&#39;) : &#39;&#39;;<br>    return (<br>      &lt;View style={styles.trackScreen}&gt;<br>       &lt;Image<br>          style={styles.largeArtwork}<br>          source={{uri: largeImageUrl}}&gt;<br>        &lt;/Image&gt;<br>        &lt;Text style={styles.trackTitle}&gt;{this.props.track.title}&lt;/Text&gt;<br>        &lt;Text style={styles.trackArtist}&gt;{this.props.track.user.username}&lt;/Text&gt;<br>        &lt;View style={styles.buttonRow}&gt;<br>          &lt;TouchableHighlight style={styles.playButton}&gt;<br>            &lt;Text style={styles.playButtonText}&gt;Play Track&lt;/Text&gt;<br>          &lt;/TouchableHighlight&gt;<br>        &lt;/View&gt;<br>      &lt;/View&gt;<br>    );<br>  }<br>});</pre><pre>var styles = StyleSheet.create({<br>  ...<br>  buttonRow: {<br>    flexDirection: &#39;row&#39;,<br>    justifyContent: &#39;space-between&#39;,<br>    alignItems: &#39;stretch&#39;,<br>  },<br>  largeArtwork: {<br>    width: 300,<br>    height: 300<br>  },<br>  playButton: {<br>    backgroundColor: &#39;#4472B9&#39;,<br>    margin: 4,<br>    padding: 4,<br>    borderRadius: 4,<br>    flex: 1<br>  },<br>  playButtonText: {<br>    color: &#39;white&#39;,<br>    fontSize: 20<br>  },<br>  trackScreen: {<br>    flex: 1,<br>    flexDirection: &#39;column&#39;,<br>    justifyContent: &#39;center&#39;,<br>    alignItems: &#39;center&#39;,<br>    backgroundColor: &#39;#F5FCFF&#39;,<br>  },<br>  trackTitle: {<br>    fontSize: 20,<br>    marginBottom: 8,<br>    textAlign: &#39;center&#39;,<br>  },<br>  trackArtist: {<br>    fontSize: 12,<br>    marginBottom: 6,<br>    textAlign: &#39;center&#39;,<br>  }, ...</pre><p>Voila! Tap on any of our track results to see our shiny new details view.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/374/1*lvI_nqsmSBhXMKXo0z1H5g.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5ee7f810123b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Building React Native Music (Part 1): Lists, Layouts & Flexbox]]></title>
            <link>https://medium.com/@Nayflix/building-a-soundcloud-app-with-react-native-1144b6d3773a?source=rss-2de6d20d9874------2</link>
            <guid isPermaLink="false">https://medium.com/p/1144b6d3773a</guid>
            <category><![CDATA[reactjs]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[ios]]></category>
            <dc:creator><![CDATA[Nathan Hayflick]]></dc:creator>
            <pubDate>Mon, 18 May 2015 04:44:56 GMT</pubDate>
            <atom:updated>2015-11-22T05:17:00.518Z</atom:updated>
            <content:encoded><![CDATA[<p>When Facebook announced they were developing and open-sourcing a React-based library for building native iOS apps in JavaScript, I couldn’t wait to get my hands on it. As a web developer, I’ve always had an interest in building native apps. Building with native iOS APIs like table views and touch handlers in the React component syntax? Yes please!</p><p>So I set out building my first app — a basic music streaming player using the SoundCloud API. This series of articles will you walk through some of the techniques and early tips I discovered while building my app, from coding your first iOS view in React component syntax all the way to creating your own custom Native Module to bridge ReactJS with an unlinked iOS API (AVPlayer).</p><h3>Part One: Set Up and Application Layout</h3><p><em>Looking for some code to fork? We’ve got that </em><a href="https://github.com/nhayflick/ReactNativeMusic"><em>here</em></a><em>.</em></p><p>After updating all your dependencies and installing the react-native-cli, setting up a new React Native project is as simple as typing &lt;code&gt;react-native init ReactNativeMusic&lt;/code&gt;. Fire up Xcode and your iOS simulator and you will see a placeholder view all ready to go.</p><p>This is a good chance to check out one of the cooler features of React Native — live reloading. Press Cmd+d in the iPhone simulator to toggle the Developer menu and then press ‘Enable Live Reload’. Open index.io.js, the main entry point for your React Native project. In the app’s render method, change ‘Welcome to React Native!’ to ‘Welcome to SoundCloud Native!’ and hit save. Now go back to your simulator — the new greeting is already waiting. This is huge if you’ve ever coded Objective-C in Xcode, where the work flow required you to kill the simulator and recompile to test every minor change. With React Native live reload, native applications can now be rapidly prototyped and tweaked just like web apps.</p><h4>Laying the Groundwork</h4><p>Let’s create a simple layout that we will build on for the rest of our music player app. We’ll swap out the render method on the ReactNativeMusic component to return a parent container with two React components: BrowseTracksView and NowPlayingFooterView.</p><pre>var ReactNativeMusic = React.createClass({<br>  return (<br>    &lt;View style={styles.appContainer}&gt;<br>        &lt;BrowseTracksView /&gt;<br>        &lt;NowPlayingFooterView /&gt;<br>    &lt;/View&gt;<br>  );<br>});</pre><p>The app container is styled with a flex attribute of 1 to let it expand to fill it’s parent — the iOS device window in this case.</p><pre>var styles = StyleSheet.create({<br>  appContainer: {<br>    flex: 1,<br>    paddingTop: 20<br>  }, ...<br>}</pre><h4>Enter the ListView</h4><p>BrowseTracksView will be used to hold an iOS list view that encompasses our search bar and list of tracks.</p><pre>require(&#39;react-native&#39;);<br>var {<br>  AppRegistry,<br>  ListView,<br>  NavigatorIOS,<br>  StyleSheet,<br>  Text,<br>  View,<br>} = React;</pre><pre>var mockedData = var mockedData = [{&quot;genre&quot;:&quot;Deep House&quot;,<br>  title: &quot;Coffee (Manhattoes Remix)&quot;,<br>  user:  {<br>    username: &quot;manhattoes&quot;<br>  },<br>  artwork_url: &quot;<a href="https://i1.sndcdn.com/artworks-000107004661-v4xg0d-large.jpg">https://i1.sndcdn.com/artworks-000107004661-v4xg0d-large.jpg</a>&quot;,<br>  stream_url: &quot;<a href="https://api.soundcloud.com/tracks/191554493/stream">https://api.soundcloud.com/tracks/191554493/stream</a>&quot;<br>},{genre: &quot;Bass&quot;,<br>  title: &quot;Threadsafe&quot;,<br>  user: {<br>    username: &quot;manhattoes&quot;<br>  },<br>  artwork_url: &quot;<a href="https://i1.sndcdn.com/artworks-000104588970-5kyi09-large.jpg">https://i1.sndcdn.com/artworks-000104588970-5kyi09-large.jpg</a>&quot;,<br>  stream_url: &quot;<a href="https://api.soundcloud.com/tracks/187885871/stream">https://api.soundcloud.com/tracks/187885871/stream</a>&quot;<br>}];<br>...</pre><pre>...<br>var BrowseTracksView = React.createClass({<br>  getInitialState: function () {<br>    return {<br>      dataSource: new ListView.DataSource({<br>        rowHasChanged: (row1, row2) =&gt; row1 !== row2,<br>      }).cloneWithRows(mockedData)<br>    };<br>  },<br>  componentDidMount: function() {<br>    this.fetchData();<br>  },<br>  fetchData: function () {<br>   // Return mocked data for now<br>    this.setState({<br>      dataSource: this.state.dataSource.cloneWithRows(mockedData)<br>    });<br>  },<br>  render: function () {<br>    return (<br>      &lt;ListView <br>       dataSource={this.state.dataSource}<br>       renderRow={this.renderTrack}<br>       style={styles.listView}/&gt;<br>    );<br>  },<br>  renderTrack: function (track) {<br>    return (<br>      &lt;TrackCell track={track}/&gt;<br>    );<br>  }<br>});</pre><p>First add ListView to your imported modules and then register BrowseTracksView as a new React class. ListView provides an API to iOS’s ubiquitous UITableView component (the workhorse layout behind UIs like the contacts list in your phone book) and it takes two essential properties: a data source object that can translate a collection of items onto the currently viewable screen real-estate as well as a function to use to render a list item for each track. (Don’t get too hung up on the DataSource implementation for this example — it’s a common pattern to allows iOS to reassign cells as soon as they scroll out of view to keep the UI running smoothly .) For now we are passing a hardcoded list of songs into the cloneWithRows method so we can worry about our HTTP requests later. The renderTrack method renders a new TrackCell component - we already passed it the track object by creating a track property on the component so accessing it is as simple as pulling it off the component’s attached props object.</p><pre>var TrackCell = React.createClass({<br>  render: function () {<br>    return (<br>      &lt;View style={styles.trackCell}&gt;<br>        &lt;Image<br>          source={{uri: this.props.track.artwork_url}}<br>          style={styles.thumbnail} /&gt;<br>        &lt;View style={styles.rightContainer}&gt;<br>          &lt;Text style={styles.trackTitle}&gt;{this.props.track.title}&lt;/Text&gt;<br>          &lt;Text style={styles.trackArtist}&gt;{this.props.track.user.username}&lt;/Text&gt;<br>        &lt;/View&gt;<br>      &lt;/View&gt;<br>    );<br>  }<br>});</pre><p>(Tip: Don’t forget to import React’s Image component if you haven’t already!)</p><h4>Building the Footer</h4><p>Modifying the ReactNativeMusic component to set a NowPlaying object globally, we pass it down to the footer component via a property:</p><pre>var ReactNativeMusic = React.createClass({<br>  getInitialState: function () {<br>    return {<br>      nowPlaying: null<br>    }<br>  },<br>  render: function() {<br>    return (<br>      &lt;View style={styles.appContainer}&gt;<br>        &lt;BrowseTracksView /&gt;<br>        &lt;NowPlayingFooterView nowPlaying={this.state.nowPlaying}/&gt;<br>      &lt;/View&gt;<br>    );<br>  }<br>});</pre><p>Initially the user won’t be playing any song so we need to render an appropriate empty state.</p><pre>var NowPlayingFooterView = React.createClass({<br>  render: function () {<br>    if (!this.props.nowPlaying) {<br>      return (<br>        &lt;View style={styles.nowPlayingFooter}&gt;<br>          &lt;Text style={styles.trackTitle}&gt;Welcome!&lt;/Text&gt;<br>          &lt;Text style={styles.trackArtist}&gt;No Track Right Now&lt;/Text&gt;<br>        &lt;/View&gt;<br>      );<br>    }<br>    return (<br>      &lt;View style={styles.nowPlayingFooter}&gt;<br>        &lt;Text style={styles.trackTitle}&gt;{this.props.nowPlaying.title}&lt;/Text&gt;<br>        &lt;Text style={styles.trackArtist}&gt;{this.props.nowPlaying.user.username}&lt;/Text&gt;<br>      &lt;/View&gt;<br>    );<br>  }<br>});</pre><p>Now we just need to update our app’s StyleSheet to properly display our new components.</p><pre>var styles = StyleSheet.create({<br>  appContainer: {<br>    flex: 1,<br>    paddingTop: 20,<br>    backgroundColor: &#39;#F5FCFF&#39;<br>  },<br>  navContainer: {<br>    flex: 1<br>  },<br>  listView: {<br>     backgroundColor: &#39;#F5FCFF&#39;,<br>  },<br>  nowPlayingFooter: {<br>    flex: 0,<br>    borderTopWidth: 1<br>  },<br>  thumbnail: {<br>    width: 50,<br>    height: 50,<br>  },<br>  trackCell: {<br>    flex: 1,<br>    flexDirection: &#39;row&#39;,<br>    justifyContent: &#39;center&#39;,<br>    alignItems: &#39;center&#39;,<br>    marginLeft: 4,<br>    marginRight: 4,<br>    padding: 4,<br>    borderBottomWidth: .5,<br>    borderColor: &#39;lightgray&#39;<br>  },<br>  trackTitle: {<br>    fontSize: 20,<br>    marginBottom: 8,<br>    textAlign: &#39;center&#39;,<br>  },<br>  trackArtist: {<br>    fontSize: 12,<br>    marginBottom: 6,<br>    textAlign: &#39;center&#39;,<br>  },<br>  rightContainer: {<br>    flex: 1,<br>  }<br>});</pre><p>While the styling is simple, there’s a cool demonstration of React Native’s flexbox powered layout engine here. Look at how the footer stays pinned to the bottom of the screen. There’s no need for ‘position: fixed’ here, instead by setting the nowPlayingFooter’s flex level lower than the listView (here we set it to 0), the footer constrains itself to it’s content size while allowing the listView to expand into the remaining space and push the footer down to the bottom of the screen.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/364/1*KQnm1PVsmMjJ5hfEVqOywA.png" /><figcaption>App with static components</figcaption></figure><p>Even better — the height of that list flexes dynamically so if we wanted to hide or expand the footer by adjusting it’s content-size, the list would automatically expand or contract to fill the remaining space. As you can see the flexbox approach opens up powerful and expressive new ways to lay out your applications.</p><p>Turning back to the simulator it looks like we’ve got a functional (though pretty static) iOS screen. Still you can already tell we are in native iOS and not a webview here: just scroll the ListView and observe the signature iOS momentum and elasticity.</p><p>Ready to hook up some live data from the SoundCloud API and tackle adding search and navigation functionality? Check out <a href="https://medium.com/@Nayflix/building-a-soundcloud-app-with-react-native-part-2-5ee7f810123b#.6bygzbz1k">Part 2</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1144b6d3773a" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>