This screen consists of a basic form, including one <Input>
for the URL from the feed and a <Button>
to retrieve the feed information from the provided URL to later store the feed's details in our store.
We will need to import two actions ( addFeed
and fetchFeed
), which will be called once the Add
button is pressed:
/*** src/screens/AddFeed.js ** */ import React from 'react'; import { Container, Content, Form, Item, Input, Button, Text, } from 'native-base'; import { addFeed, fetchFeed } from '../actions'; import { Alert, ActivityIndicator } from 'react-native'; export default class AddFeed extends React.Component { static navigationOptions = { title: 'Add feed', }; constructor(props) { super(props); this.state = { url: '', loading: false, }; } _handleAddPress() { if (this.state.url.length > 0) { this.setState({ loading: true }); fetchFeed(this.state.url) .then(feed...